Package org.glassfish.jersey.server

Examples of org.glassfish.jersey.server.ContainerResponse



    @Test
    public void testGetMultiple() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get", response.getEntity());
        assertResponseHeaders(response, "MyResource", "get");
        response = handler.apply(RequestContextBuilder.from("/resource/get-child", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-child", response.getEntity());
        assertResponseHeaders(response, "MyResource", "getChild");
    }
View Full Code Here


    }

    @Test
    public void testGetChild() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource/get-child", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-child", response.getEntity());

        final String className = "MyResource";
        final String methodName = "getChild";
        assertResponseHeaders(response, className, methodName);
View Full Code Here

    }

    @Test
    public void testPost() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource", "POST").entity("entity")
                .build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("post", response.getEntity());
        assertResponseHeaders(response, "MyResource", "post");
    }
View Full Code Here

    }

    @Test
    public void testGetAnotherResource() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource-another", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-another", response.getEntity());
        assertResponseHeaders(response, "MyAnotherResource", "getAnother");
    }
View Full Code Here

    @Test
    public void testBadStringConstructorValue() throws ExecutionException, InterruptedException {
        initiateWebApplication(ResourceString.class);

        final ContainerResponse responseContext = getResponseContext("/;arg1=ABCDEF;arg2=3145;arg3=http:%2F%2Ftest");

        assertEquals(404, responseContext.getStatus());
    }
View Full Code Here

    }

    @Test
    public void testGetSubResource() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource/locator", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-sub-resource", response.getEntity());
        assertResponseHeaders(response, "SubResource", "getFromSubResource");
    }
View Full Code Here


    @Test
    public void testInfoGet() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-info", response.getEntity());
        assertResponseHeaders(response, "ResourceTestingInfo", "getInfo");
    }
View Full Code Here

    }

    @Test
    public void testInfoGetChild() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info/child", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-info-child", response.getEntity());
        assertResponseHeaders(response, "ResourceTestingInfo", "getChildInfo");
    }
View Full Code Here

    }

    @Test
    public void test404() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/NOT_FOUND", "GET").build()).get();
        assertEquals(404, response.getStatus());
        assertResponseHeaders(response, "<null>", "<null>");
    }
View Full Code Here

        request = RequestContextBuilder.from("/hello2", "GET").build();
        assertEquals("Hello!", app.apply(request).get().getEntity());

        request = RequestContextBuilder.from("/hello2/world", "GET").build();
        final ContainerResponse response = app.apply(request).get();
        assertEquals(200, response.getStatus());
        assertEquals("Hello World!", response.getEntity());
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.ContainerResponse

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.