Class GuiceyJerseyTest
- java.lang.Object
-
- org.glassfish.jersey.test.JerseyTest
-
- ru.vyarus.dropwizard.guice.test.rest.support.GuiceyJerseyTest
-
public class GuiceyJerseyTest extends org.glassfish.jersey.test.JerseyTestJersey rest stubs implementation (based onJerseyTest). Configures:- Random port
- Requests logging
- Enables restricted headers and method workaround (for url connection)
- Set default timeouts to avoid infinite calls
- Enable multipart support (if available in classpath)
Application deployment context used (same as in normal dropwizard application). Guicey disables not wanted extensions, if required.
Assume 2 possible containers: in-memory (may not support some rest features) and grizzly. By default, should delegate container selection to
JerseyTest, which selects grizzly, if available or use in-memory. Also, supports custom system property.- Since:
- 25.02.2025
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGuiceyJerseyTest(boolean logRequests)Create jersey test.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureClient(org.glassfish.jersey.client.ClientConfig clientConfig)protected org.glassfish.jersey.test.DeploymentContextconfigureDeployment()static GuiceyJerseyTestcreate(io.dropwizard.core.setup.Environment environment, TestContainerPolicy policy, boolean logRequests)protected java.net.URIgetBaseUri()java.net.URIgetRootUri()org.glassfish.jersey.test.spi.TestContainerFactorygetTestContainerFactory()-
Methods inherited from class org.glassfish.jersey.test.JerseyTest
client, close, closeIfNotNull, configure, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getClient, getLastLoggedRecord, getLoggedRecords, getPort, getSslContext, getSslParameters, isEnabled, set, set, setClient, setUp, target, target, tearDown
-
-
-
-
Method Detail
-
create
public static GuiceyJerseyTest create(io.dropwizard.core.setup.Environment environment, TestContainerPolicy policy, boolean logRequests)
- Parameters:
environment- environmentpolicy- container policylogRequests- log requests and responses- Returns:
- jersey test instance
-
getRootUri
public java.net.URI getRootUri()
- Returns:
- rest root url
-
getTestContainerFactory
public org.glassfish.jersey.test.spi.TestContainerFactory getTestContainerFactory()
- Overrides:
getTestContainerFactoryin classorg.glassfish.jersey.test.JerseyTest
-
getBaseUri
protected java.net.URI getBaseUri()
- Overrides:
getBaseUriin classorg.glassfish.jersey.test.JerseyTest
-
configureDeployment
protected org.glassfish.jersey.test.DeploymentContext configureDeployment()
- Overrides:
configureDeploymentin classorg.glassfish.jersey.test.JerseyTest
-
configureClient
protected void configureClient(org.glassfish.jersey.client.ClientConfig clientConfig)
- Overrides:
configureClientin classorg.glassfish.jersey.test.JerseyTest
-
-