Package org.glassfish.jersey.test
Class DeploymentContext
- java.lang.Object
-
- org.glassfish.jersey.test.DeploymentContext
-
- Direct Known Subclasses:
ServletDeploymentContext
public class DeploymentContext extends Object
Basic application deployment context.An instance of this class is created by creating using
DeploymentContext.Builder
, that allows to configure the deployment context state, and finally building the context by invoking theDeploymentContext.Builder.build()
method.This deployment context is compatible with basic non-Servlet test containers. The following test container factories support the descriptor:
org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory
for testing with the Grizzly HTTP container.org.glassfish.jersey.test.jetty.JettyTestContainerFactory
for testing with the Jetty HTTP container.org.glassfish.jersey.test.simple.SimpleTestContainerFactory
for testing with the Simple HTTP container.org.glassfish.jersey.test.jdkhttp.JdkHttpServerTestContainerFactory
for testing with the Light Weight HTTP server distributed with Java SE.org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory
for testing in memory without using underlying HTTP client and server side functionality to send requests and receive responses.org.glassfish.jersey.test.external.ExternalTestContainerFactory
for testing Java EE Web applications deployed independently in a separate JVM to that of the tests. For example, the application may be deployed to the GlassFish or WebLogic application server.
- Since:
- 2.8
- Author:
- Paul Sandoz, Marek Potociar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DeploymentContext.Builder
Deployment context builder for building a basic application deployment context for the JAX-RS / Jersey application defined by the associatedApplication
class or instance.
-
Constructor Summary
Constructors Modifier Constructor Description protected
DeploymentContext(DeploymentContext.Builder b)
Create new application deployment context.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DeploymentContext.Builder
builder(Application application)
Create a new deployment context builder for a JAX-RS / Jersey application instance.static DeploymentContext.Builder
builder(Class<? extends Application> applicationClass)
Create a new deployment context builder for a JAX-RS / Jersey application instance.String
getContextPath()
Get the deployed application context path.ResourceConfig
getResourceConfig()
Get the deployed application resource configuration.Optional<SSLContext>
getSslContext()
Get the deployed application ssl context.Optional<SSLParameters>
getSslParameters()
Get the deployed application ssl parameters.static DeploymentContext
newInstance(Application application)
Create a new deployment context for a JAX-RS / Jersey application instance.static DeploymentContext
newInstance(Class<? extends Application> applicationClass)
Create a new deployment context for a JAX-RS / Jersey application instance.
-
-
-
Constructor Detail
-
DeploymentContext
protected DeploymentContext(DeploymentContext.Builder b)
Create new application deployment context.- Parameters:
b
-DeploymentContext.Builder
instance.
-
-
Method Detail
-
builder
public static DeploymentContext.Builder builder(Application application)
Create a new deployment context builder for a JAX-RS / Jersey application instance.- Parameters:
application
- a JAX-RS / Jersey application to be tested.- Returns:
- new deployment context builder instance associated with the JAX-RS / Jersey application to be tested.
- Throws:
NullPointerException
- in case theapplication
isnull
.
-
builder
public static DeploymentContext.Builder builder(Class<? extends Application> applicationClass)
Create a new deployment context builder for a JAX-RS / Jersey application instance.- Parameters:
applicationClass
- a JAX-RS / Jersey application to be tested.- Returns:
- new deployment context builder instance associated with the JAX-RS / Jersey application to be tested.
- Throws:
NullPointerException
- in case theapplicationClass
isnull
.
-
newInstance
public static DeploymentContext newInstance(Application application)
Create a new deployment context for a JAX-RS / Jersey application instance.The created deployment context will be configured to use default values.
- Parameters:
application
- a JAX-RS / Jersey application to be tested.- Returns:
- new deployment context instance associated with the JAX-RS / Jersey application to be tested.
- Throws:
NullPointerException
- in case theapplication
isnull
.
-
newInstance
public static DeploymentContext newInstance(Class<? extends Application> applicationClass)
Create a new deployment context for a JAX-RS / Jersey application instance.The created deployment context will be configured to use default values.
- Parameters:
applicationClass
- a JAX-RS / Jersey application to be tested.- Returns:
- new deployment context instance associated with the JAX-RS / Jersey application to be tested.
- Throws:
NullPointerException
- in case theapplicationClass
isnull
.
-
getResourceConfig
public ResourceConfig getResourceConfig()
Get the deployed application resource configuration.This method can be overridden in a subclass to support conversion of non-resource config initialization scenario (e.g. via Servlet init parameters) into a resource configuration.
- Returns:
- the deployed application resource configuration.
-
getContextPath
public final String getContextPath()
Get the deployed application context path.- Returns:
- the deployed application context path.
-
getSslContext
public Optional<SSLContext> getSslContext()
Get the deployed application ssl context.- Returns:
- the deployed application ssl context.
-
getSslParameters
public Optional<SSLParameters> getSslParameters()
Get the deployed application ssl parameters.- Returns:
- the deployed application ssl parameters.
-
-