/** * Initialize JerseyTest instance. * <p> * This constructor can be used from an extending subclass. * <p> * When this constructor is used, the extending concrete subclass must implement one of the * {@link #configure()} or {@link #configureDeployment()} methods are ignored. * </p> * <p> * Please note that when this constructor is used, recording of startup logs as well as configuring * other {@code JerseyTest} properties and features may not work properly. While using this constructor * should generally be avoided, in certain scenarios it may be necessary to use this constructor. * (E.g. when running parameterized tests in which application is created based on test parameters * passed in by JUnit framework via test constructor - in such case it is not possible to propagate * the necessary information to one of the overridden {@code JerseyTest.configure...} methods). * </p> * * @param jaxrsApplication tested application. */ public JerseyTest(final Application jaxrsApplication) { this.context = DeploymentContext.newInstance(jaxrsApplication); this.testContainerFactory = getTestContainerFactory(); }
/** * Initialize JerseyTest instance. * <p> * This constructor can be used from an extending subclass. * <p> * When this constructor is used, the extending concrete subclass must implement one of the * {@link #configure()} or {@link #configureDeployment()} methods are ignored. * </p> * <p> * Please note that when this constructor is used, recording of startup logs as well as configuring * other {@code JerseyTest} properties and features may not work properly. While using this constructor * should generally be avoided, in certain scenarios it may be necessary to use this constructor. * (E.g. when running parameterized tests in which application is created based on test parameters * passed in by JUnit framework via test constructor - in such case it is not possible to propagate * the necessary information to one of the overridden {@code JerseyTest.configure...} methods). * </p> * * @param jaxrsApplication tested application. */ public JerseyTest(final Application jaxrsApplication) { this.context = DeploymentContext.newInstance(jaxrsApplication); this.testContainerFactory = getTestContainerFactory(); }
public JaxrsTestingHttpProcessor(URI baseUri, Object... jaxRsSingletons) { Set<Object> jaxRsSingletonsSet = ImmutableSet.copyOf(jaxRsSingletons); Application application = new Application() { @Override public Set<Object> getSingletons() { return jaxRsSingletonsSet; } }; TestContainer testContainer = new InMemoryTestContainerFactory() .create(baseUri, DeploymentContext.newInstance(application)); ClientConfig clientConfig = testContainer.getClientConfig(); this.client = JerseyClientBuilder.createClient(clientConfig); }
public JaxrsTestingHttpProcessor(URI baseUri, Object... jaxRsSingletons) { Set<Object> jaxRsSingletonsSet = ImmutableSet.copyOf(jaxRsSingletons); Application application = new Application() { @Override public Set<Object> getSingletons() { return jaxRsSingletonsSet; } }; TestContainer testContainer = new InMemoryTestContainerFactory() .create(baseUri, DeploymentContext.newInstance(application)); ClientConfig clientConfig = testContainer.getClientConfig(); this.client = JerseyClientBuilder.createClient(clientConfig); }