/** * Create and configure deployment context for the tested application. * <p> * This method may be overridden by subclasses to provide custom test container deployment context for the tested * application. The method may be also used to configure {@code JerseyTest} instance properties. * <p> * The method is invoked from {@code JerseyTest} constructors to provide deployment context for the tested application. * Default implementation of this method creates * {@link DeploymentContext#newInstance(javax.ws.rs.core.Application) new deployment context} * using JAX-RS application instance obtained by calling the {@link #configure()} method. * </p> * <p> * Note that since the method is invoked from {@code JerseyTest} constructor, the overriding implementation of the method * must not depend on any subclass fields as those will not be initialized yet when the method is invoked. * </p> * <p> * Also note that in case the {@link #JerseyTest(javax.ws.rs.core.Application)} constructor is used, the method is never * invoked. * </p> * * @return configured deployment context for the tested application. * @since 2.8 */ protected DeploymentContext configureDeployment() { return DeploymentContext.builder(configure()).build(); }
@Override public Builder contextPath(String contextPath) { super.contextPath(contextPath); return this; }
/** * Create a new deployment context for a JAX-RS / Jersey application instance. * <p> * The created deployment context will be configured to use default values. * </p> * * @param applicationClass a JAX-RS / Jersey application to be tested. * @return new deployment context instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code applicationClass} is {@code null}. */ public static DeploymentContext newInstance(final Class<? extends Application> applicationClass) { return new Builder(applicationClass).build(); }
/** * Create a new deployment context for a JAX-RS / Jersey application instance. * <p> * The created deployment context will be configured to use default values. * </p> * * @param application a JAX-RS / Jersey application to be tested. * @return new deployment context instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code application} is {@code null}. */ public static DeploymentContext newInstance(final Application application) { return new Builder(application).build(); }
/** * Build a new application deployment context configured by the current state of this * application deployment context builder. * * @return this application deployment context builder. */ public DeploymentContext build() { final DeploymentContext lld = new DeploymentContext(this); reset(); return lld; }
/** * Create a new deployment context builder for a JAX-RS / Jersey application instance. * * @param application a JAX-RS / Jersey application to be tested. * @return new deployment context builder instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code application} is {@code null}. */ public static Builder builder(final Application application) { return new Builder(application); }
/** * Create a new deployment context builder for a JAX-RS / Jersey application instance. * * @param applicationClass a JAX-RS / Jersey application to be tested. * @return new deployment context builder instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code applicationClass} is {@code null}. */ public static Builder builder(final Class<? extends Application> applicationClass) { return new Builder(applicationClass); }
@Override protected void reset() { super.reset(); this.initParams = null; this.contextParams = null; this.servletInstance = null; this.servletClass = ServletContainer.class; this.filters = null; this.listeners = null; this.servletPath = ""; } }
/** * Create and configure deployment context for the tested application. * <p> * This method may be overridden by subclasses to provide custom test container deployment context for the tested * application. The method may be also used to configure {@code JerseyTest} instance properties. * <p> * The method is invoked from {@code JerseyTest} constructors to provide deployment context for the tested application. * Default implementation of this method creates * {@link DeploymentContext#newInstance(javax.ws.rs.core.Application) new deployment context} * using JAX-RS application instance obtained by calling the {@link #configure()} method. * </p> * <p> * Note that since the method is invoked from {@code JerseyTest} constructor, the overriding implementation of the method * must not depend on any subclass fields as those will not be initialized yet when the method is invoked. * </p> * <p> * Also note that in case the {@link #JerseyTest(javax.ws.rs.core.Application)} constructor is used, the method is never * invoked. * </p> * * @return configured deployment context for the tested application. * @since 2.8 */ protected DeploymentContext configureDeployment() { return DeploymentContext.builder(configure()).build(); }
/** * Create a new deployment context for a JAX-RS / Jersey application instance. * <p> * The created deployment context will be configured to use default values. * </p> * * @param application a JAX-RS / Jersey application to be tested. * @return new deployment context instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code application} is {@code null}. */ public static DeploymentContext newInstance(final Application application) { return new Builder(application).build(); }
/** * Create a new deployment context for a JAX-RS / Jersey application instance. * <p> * The created deployment context will be configured to use default values. * </p> * * @param applicationClass a JAX-RS / Jersey application to be tested. * @return new deployment context instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code applicationClass} is {@code null}. */ public static DeploymentContext newInstance(final Class<? extends Application> applicationClass) { return new Builder(applicationClass).build(); }
@Override protected void reset() { super.reset(); this.initParams = null; this.contextParams = null; this.servletInstance = null; this.servletClass = ServletContainer.class; this.filters = null; this.listeners = null; this.servletPath = ""; } }
/** * Build a new application deployment context configured by the current state of this * application deployment context builder. * * @return this application deployment context builder. */ public DeploymentContext build() { final DeploymentContext lld = new DeploymentContext(this); reset(); return lld; }
@Override public Builder contextPath(String contextPath) { super.contextPath(contextPath); return this; }
@Override protected DeploymentContext configureDeployment() { return DeploymentContext.builder(configure()).contextPath(CONTEXT_ROOT).build(); }
/** * Create a new deployment context builder for a JAX-RS / Jersey application instance. * * @param application a JAX-RS / Jersey application to be tested. * @return new deployment context builder instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code application} is {@code null}. */ public static Builder builder(final Application application) { return new Builder(application); }
/** * Create a new deployment context builder for a JAX-RS / Jersey application instance. * * @param applicationClass a JAX-RS / Jersey application to be tested. * @return new deployment context builder instance associated with the JAX-RS / Jersey application to be tested. * * @throws java.lang.NullPointerException in case the {@code applicationClass} is {@code null}. */ public static Builder builder(final Class<? extends Application> applicationClass) { return new Builder(applicationClass); }