Package org.glassfish.jersey.test.spi

Examples of org.glassfish.jersey.test.spi.TestContainer


    public static class MyTestContainerFactory implements TestContainerFactory {

        @Override
        public TestContainer create(final URI baseUri, final DeploymentContext context) throws IllegalArgumentException {
            return new TestContainer() {

                @Override
                public ClientConfig getClientConfig() {
                    return null;
                }
View Full Code Here


        return testContainer;
    }

    @Override
    public TestContainer testContainer(final TestContainer testContainer) {
        final TestContainer old = this.testContainer;
        this.testContainer = testContainer;
        return old;
    }
View Full Code Here

        return testContainerLocal.get();
    }

    @Override
    public TestContainer testContainer(final TestContainer testContainer) {
        final TestContainer old = testContainerLocal.get();

        if (testContainer == null) {
            testContainerLocal.remove();
        } else {
            testContainerLocal.set(testContainer);
View Full Code Here

     *
     * @param testContainer a test container instance or {@code null} it the current test container should be released.
     * @return old test container instance.
     */
    /* package */ TestContainer setTestContainer(final TestContainer testContainer) {
        final TestContainer old = this.testContainer;
        this.testContainer = testContainer;
        return old;
    }
View Full Code Here

    public void setUp() throws Exception {
        if (isLogRecordingEnabled()) {
            registerLogHandler();
        }

        final TestContainer testContainer = createTestContainer(context);

        // Set current instance of test container and start it.
        setTestContainer(testContainer);
        testContainer.start();

        // Create an set new client.
        setClient(getClient(testContainer.getClientConfig()));
    }
View Full Code Here

     *
     * @return the base URI of the tested application.
     */
    // TODO make final
    protected URI getBaseUri() {
        final TestContainer container = getTestContainer();

        if (container != null) {
            // called from outside of JerseyTest constructor
            return container.getBaseUri();
        }

        // called from within JerseyTest constructor
        return UriBuilder.fromUri("http://localhost/").port(getPort()).build();
    }
View Full Code Here

     * Get the port to be used for test application deployments.
     *
     * @return The HTTP port of the URI
     */
    protected final int getPort() {
        final TestContainer container = getTestContainer();

        if (container != null) {
            // called from outside of JerseyTest constructor
            return container.getBaseUri().getPort();
        }

        // called from within JerseyTest constructor
        final String value = getProperty(TestProperties.CONTAINER_PORT);
        if (value != null) {
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.test.spi.TestContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.