Class BaseJerseyTest5
java.lang.Object
org.glassfish.jersey.test.JerseyTest
ubic.gemma.rest.util.BaseJerseyTest5
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
AnnotationsUsageCountCacheTest, AnnotationsWebServiceTest, BaseJerseyIntegrationTest5, DatasetsWebServiceTest, TasksWebServiceTest
@ActiveProfiles({"web","test"})
@WebAppConfiguration
@ExtendWith(org.springframework.test.context.junit.jupiter.SpringExtension.class)
@TestExecutionListeners({org.springframework.test.context.web.ServletTestExecutionListener.class,org.springframework.test.context.support.DependencyInjectionTestExecutionListener.class,org.springframework.test.context.support.DirtiesContextTestExecutionListener.class})
public abstract class BaseJerseyTest5
extends org.glassfish.jersey.test.JerseyTest
implements org.springframework.context.ApplicationContextAware
JUnit 5 (Jupiter) counterpart of
BaseJerseyTest.
Jersey 3.1's jersey-test-framework-core does not ship a Jupiter
extension (only the JUnit 4 base JerseyTest and a TestNG variant), so
the container lifecycle is bridged by overriding JerseyTest.setUp() /
JerseyTest.tearDown() and re-annotating them with
BeforeEach / AfterEach. The underlying methods on
JerseyTest are plain public methods (no JUnit 4 annotations
baked into the bytecode), so this re-annotation is the canonical
bridge pattern and does not double-fire the lifecycle.
Spring's SpringExtension replaces the JUnit 4
SpringClassRule/SpringMethodRule pair used in
BaseJerseyTest.
- Author:
- poirigui
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final jakarta.ws.rs.core.Applicationprotected final voidconfigureClient(org.glassfish.jersey.client.ClientConfig config) protected final org.glassfish.jersey.test.spi.TestContainerFactoryfinal voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) final voidsetUp()Bridge the Jersey test-container setUp into Jupiter's lifecycle.final voidtearDown()Bridge the Jersey test-container tearDown into Jupiter's lifecycle.Methods inherited from class org.glassfish.jersey.test.JerseyTest
client, close, closeIfNotNull, configureDeployment, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getBaseUri, getClient, getLastLoggedRecord, getLoggedRecords, getPort, getSslContext, getSslParameters, isEnabled, set, set, setClient, target, target
-
Constructor Details
-
BaseJerseyTest5
public BaseJerseyTest5()
-
-
Method Details
-
getTestContainerFactory
protected final org.glassfish.jersey.test.spi.TestContainerFactory getTestContainerFactory() throws org.glassfish.jersey.test.spi.TestContainerException- Overrides:
getTestContainerFactoryin classorg.glassfish.jersey.test.JerseyTest- Throws:
org.glassfish.jersey.test.spi.TestContainerException
-
configure
protected final jakarta.ws.rs.core.Application configure()- Overrides:
configurein classorg.glassfish.jersey.test.JerseyTest
-
setApplicationContext
public final void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
configureClient
protected final void configureClient(org.glassfish.jersey.client.ClientConfig config) - Overrides:
configureClientin classorg.glassfish.jersey.test.JerseyTest
-
setUp
Bridge the Jersey test-container setUp into Jupiter's lifecycle.Intentionally
finalso subclasses cannot accidentally re-annotate this with a conflicting@BeforeEachor override the container bootstrap.- Overrides:
setUpin classorg.glassfish.jersey.test.JerseyTest- Throws:
Exception
-
tearDown
-