Package javax.ws.rs.client

Examples of javax.ws.rs.client.Client


    public static void preinit() {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Client c = createClient();
                    c.target("http://localhost:4848");
                } catch (Throwable th) {
                }
                try {
                    createStandardSslContext(System.console() != null);
                } catch (Throwable th) {
View Full Code Here


                .iterator().hasNext()).isFalse();
    }

    @Test
    public void usesAnObjectMapperFromTheEnvironment() throws Exception {
        final Client client = builder.using(environment).build("test");

        assertThat(client.getConfiguration().isRegistered(JacksonMessageBodyProvider.class)).isTrue();
    }
View Full Code Here

    @Test
    public void usesChunkedEncodingIfChunkedEncodingIsEnabled() throws Exception {
        final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
        configuration.setChunkedEncodingEnabled(true);

        final Client client = builder.using(configuration)
                .using(executorService, objectMapper).build("test");
        assertThat(client.getConfiguration().getProperty(ClientProperties.REQUEST_ENTITY_PROCESSING)).isEqualTo(RequestEntityProcessing.CHUNKED);
    }
View Full Code Here

    @Test
    public void usesBufferedEncodingIfChunkedEncodingIsDisabled() throws Exception {
        final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
        configuration.setChunkedEncodingEnabled(false);

        final Client client = builder.using(configuration)
                .using(executorService, objectMapper).build("test");
        assertThat(client.getConfiguration().getProperty(ClientProperties.REQUEST_ENTITY_PROCESSING)).isEqualTo(RequestEntityProcessing.BUFFERED);
    }
View Full Code Here

        }
    }

    @Test
    public void buildsAnApache4BasedClient() throws Exception {
        final Client client = builder.using(executorService, objectMapper).build("test");
        final ClientConfig jerseyConfig = (ClientConfig) client.getConfiguration();

        assertThat(jerseyConfig.getConnectorProvider()).isInstanceOf(ApacheConnectorProvider.class);
    }
View Full Code Here

        assertThat(jerseyConfig.getConnectorProvider()).isInstanceOf(ApacheConnectorProvider.class);
    }

    @Test
    public void includesJerseyProperties() throws Exception {
        final Client client = builder.withProperty("poop", true)
                .using(executorService, objectMapper)
                .build("test");

        assertThat(client.getConfiguration().getProperty("poop")).isEqualTo(Boolean.TRUE);
    }
View Full Code Here

    }

    @Test
    public void includesJerseyProviderSingletons() throws Exception {
        final FakeMessageBodyReader provider = new FakeMessageBodyReader();
        final Client client = builder.withProvider(provider)
                .using(executorService, objectMapper)
                .build("test");

        assertThat(client.getConfiguration().isRegistered(provider)).isTrue();
    }
View Full Code Here

        assertThat(client.getConfiguration().isRegistered(provider)).isTrue();
    }

    @Test
    public void includesJerseyProviderClasses() throws Exception {
        @SuppressWarnings("unused")
        final Client client = builder.withProvider(FakeMessageBodyReader.class)
                .using(executorService, objectMapper)
                .build("test");

        assertThat(client.getConfiguration().isRegistered(FakeMessageBodyReader.class)).isTrue();
    }
View Full Code Here

        assertThat(client.getConfiguration().isRegistered(FakeMessageBodyReader.class)).isTrue();
    }

    @Test
    public void usesTheObjectMapperForJson() throws Exception {
        final Client client = builder.using(executorService, objectMapper).build("test");
        assertThat(client.getConfiguration().isRegistered(JacksonMessageBodyProvider.class)).isTrue();
    }
View Full Code Here

        assertThat(client.getConfiguration().isRegistered(JacksonMessageBodyProvider.class)).isTrue();
    }

    @Test
    public void usesTheGivenThreadPool() throws Exception {
        final Client client = builder.using(executorService, objectMapper).build("test");

        for (Object o : client.getConfiguration().getInstances()) {
            if (o instanceof DropwizardExecutorProvider) {
                final DropwizardExecutorProvider provider = (DropwizardExecutorProvider) o;
                assertThat(provider.getRequestingExecutor()).isSameAs(executorService);
            }
        }
View Full Code Here

TOP

Related Classes of javax.ws.rs.client.Client

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.