
com.fitbur.testify.server.ServerProvider Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2015 Sharmarke Aden.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fitbur.testify.server;
/**
* A contract that defines methods for creating and destroying a server.
*
* @author saden
* @param the server context type
*/
public interface ServerProvider {
/**
*
* Method that must be implemented to configure a server. Configuring a
* server typically involves creating or using an existing a server
* configuration object so that a test class method annotated with
* {@link com.fitbur.testify.Config} can be called to further fine tune
* server configuration.
*
*
* Note that implementation of this method should not do any work beyond
* returning a mutable configuration object. It should not perform
* instantiation of the server as that should be handled in
* {@link #init(com.fitbur.testify.server.ServerDescriptor, java.lang.Object)}
* method.
*
*
* @param descriptor the server descriptor
* @return the server configuration object
*/
T configuration(ServerDescriptor descriptor);
/**
*
* Instantiate the server.
*
*
* @param descriptor the server descriptor
* @param configuration the server configuration context
* @return the server instance.
*/
ServerInstance init(ServerDescriptor descriptor, T configuration);
/**
* Destroy the server with the given descriptor.
*
* @param descriptor the server descriptor
* @param instance the server instance
* @param configuration configuration the server configuration context
*/
default void destroy(ServerDescriptor descriptor, ServerInstance instance, T configuration) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy