Class BaseJerseyTest

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
    Direct Known Subclasses:
    AnnotationsWebServiceTest, BaseJerseyIntegrationTest, DatasetsWebServiceTest, SearchWebServiceTest

    @ActiveProfiles({"web","test"})
    @WebAppConfiguration
    @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 BaseJerseyTest
    extends org.glassfish.jersey.test.JerseyTest
    implements org.springframework.context.ApplicationContextAware
    Base class for Jersey-based tests that needs a WebApplicationContext for loading and configuring or mocking Spring components.

    Unfortunately, it is not possible to inherit from AbstractJUnit4SpringContextTests, so we have to borrow some its annotations here.

    Author:
    poirigui
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseJerseyTest()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javax.ws.rs.core.Application configure()  
      protected void configureClient​(org.glassfish.jersey.client.ClientConfig config)  
      protected org.glassfish.jersey.test.spi.TestContainerFactory getTestContainerFactory()  
      void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)  
      void setUp()
      This is intentionally made final to prevent subclasses from overriding.
      void tearDown()
      This is intentionally made final to prevent subclasses from overriding.
      • Methods inherited from class org.glassfish.jersey.test.JerseyTest

        client, close, closeIfNotNull, configureDeployment, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getBaseUri, getClient, getLastLoggedRecord, getLoggedRecords, getPort, isEnabled, set, set, setClient, target, target
    • Constructor Detail

      • BaseJerseyTest

        public BaseJerseyTest()
    • Method Detail

      • getTestContainerFactory

        protected final org.glassfish.jersey.test.spi.TestContainerFactory getTestContainerFactory()
                                                                                            throws org.glassfish.jersey.test.spi.TestContainerException
        Overrides:
        getTestContainerFactory in class org.glassfish.jersey.test.JerseyTest
        Throws:
        org.glassfish.jersey.test.spi.TestContainerException
      • configure

        protected final javax.ws.rs.core.Application configure()
        Overrides:
        configure in class org.glassfish.jersey.test.JerseyTest
      • setApplicationContext

        public final void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
      • configureClient

        protected final void configureClient​(org.glassfish.jersey.client.ClientConfig config)
        Overrides:
        configureClient in class org.glassfish.jersey.test.JerseyTest
      • setUp

        public final void setUp()
                         throws Exception
        This is intentionally made final to prevent subclasses from overriding.
        Overrides:
        setUp in class org.glassfish.jersey.test.JerseyTest
        Throws:
        Exception
      • tearDown

        public final void tearDown()
                            throws Exception
        This is intentionally made final to prevent subclasses from overriding.
        Overrides:
        tearDown in class org.glassfish.jersey.test.JerseyTest
        Throws:
        Exception