Package org.glassfish.jersey.server

Examples of org.glassfish.jersey.server.ApplicationHandler.apply()


        }

        final ApplicationHandler app = new ApplicationHandler(resourceConfig);

        final URI baseUri = URI.create("/");
        assertEquals(response, app.apply(new ContainerRequest(baseUri, baseUri, "GET", null, new MapPropertiesDelegate())).get()
                .getEntity());
    }
}
View Full Code Here


    @Test
    public void testCustomRuntimeThreadProviderSupport() throws ExecutionException, InterruptedException {
        ApplicationHandler ah = createApplication(CustomThreadProvider.class, ExecutorsTestResource.class);

        final ContainerResponse response = ah.apply(RequestContextBuilder.from("/executors-test", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("Some executor test assertions failed.", 111, response.getEntity());
    }
}
View Full Code Here

    @Test
    public void testWithInstance() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(Resource.class)
                .register(UriModifyFilter.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/a/b/c", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("/a/b?filter=c", response.getEntity());
    }
}
View Full Code Here

    @Ignore("JERSEY-2414 - not yet implemented")
    public void testResourceMethod() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocator.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
View Full Code Here

    @Ignore("JERSEY-2414 - not yet implemented")
    public void testResourceSubresourceMethod() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocator.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub/submethod", "GET")
                .build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
View Full Code Here

    @Ignore("JERSEY-2414 - not yet implemented")
    public void testResourceMethodOnClass() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocatorOnClass.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
View Full Code Here

    @Ignore("JERSEY-2414 - not yet implemented")
    public void testResourceSubresourceMethodOnClass() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocatorOnClass.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub/submethod", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
View Full Code Here

    @Test
    public void testResourceMethodMultiple() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithMethodMultiple.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
View Full Code Here

    @Test
    public void testResourceSubresourceMethodMultiple() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithMethodMultiple.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/submethod", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
View Full Code Here

    @Test
    public void testGetResource() throws Exception {
        ApplicationHandler app = createApplication(ResourceA.class, ResourceB.class);

        assertEquals("B: c",
                app.apply(RequestContextBuilder.from("/a/b/c", "GET").build())
                        .get().getEntity());
        assertEquals("SR: foo",
                app.apply(RequestContextBuilder.from("/a/foo", "GET").build())
                        .get().getEntity());
        assertEquals("null",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.