Class Servers
java.lang.Object
com.github.mjeanroy.junit.servers.engine.Servers
Static utilities for server instantiation
and configuration.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends AbstractConfiguration>
TfindConfiguration
(Class<?> klass) Find configuration object on static field / method on running class.static EmbeddedServer<?>
instantiate
(Class<?> klass) Instantiate jetty or tomcat embedded server.static <T extends AbstractConfiguration>
EmbeddedServer<T>instantiate
(T configuration) Instantiate jetty or tomcat embedded server.
-
Method Details
-
instantiate
Instantiate jetty or tomcat embedded server.Server configuration is automatically read on static field / methods available on given class (i.e field or method annotated with
TestServerConfiguration
annotation).Server implementation is automatically detected (jetty or tomcat) with classpath detection.
- Parameters:
klass
- Class to inspect.- Returns:
- Embedded server.
-
instantiate
Instantiate jetty or tomcat embedded server.Configuration is an optional parameter and can be null. If configuration is null, empty constructor will be used to instantiate embedded server. Otherwise, constructor with one parameter (configuration) will be used.
Server implementation is automatically detected (jetty or tomcat) with classpath detection.
- Type Parameters:
T
- Type of configuration.- Parameters:
configuration
- Optional configuration.- Returns:
- Embedded server.
-
findConfiguration
Find configuration object on static field / method on running class. Configuration is read from static method or static field annotated withTestServerConfiguration
annotation.- Type Parameters:
T
- Type of configuration.- Parameters:
klass
- Class to inspect.- Returns:
- Configuration.
-