Search in sources :

Example 41 with JerseyClientBuilder

use of io.dropwizard.client.JerseyClientBuilder in project verify-hub by alphagov.

the class CountriesResourceIntegrationTest method setUp.

@BeforeClass
public static void setUp() {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(configAppRule.getEnvironment()).using(jerseyClientConfiguration).build(CountriesResourceIntegrationTest.class.getSimpleName());
}
Also used : JerseyClientConfiguration(io.dropwizard.client.JerseyClientConfiguration) JerseyClientBuilder(io.dropwizard.client.JerseyClientBuilder) BeforeClass(org.junit.BeforeClass)

Example 42 with JerseyClientBuilder

use of io.dropwizard.client.JerseyClientBuilder in project verify-hub by alphagov.

the class IdentityProviderResourceIntegrationTest method setUp.

@BeforeClass
public static void setUp() {
    configAppRule.newApplication();
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(configAppRule.getEnvironment()).using(jerseyClientConfiguration).build(IdentityProviderResourceIntegrationTest.class.getSimpleName());
}
Also used : JerseyClientConfiguration(io.dropwizard.client.JerseyClientConfiguration) JerseyClientBuilder(io.dropwizard.client.JerseyClientBuilder) BeforeClass(org.junit.BeforeClass)

Example 43 with JerseyClientBuilder

use of io.dropwizard.client.JerseyClientBuilder in project verify-hub by alphagov.

the class TransactionsResourceIntegrationTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    configAppRule.newApplication();
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(configAppRule.getEnvironment()).using(jerseyClientConfiguration).build(TransactionsResourceIntegrationTest.class.getSimpleName());
}
Also used : JerseyClientConfiguration(io.dropwizard.client.JerseyClientConfiguration) JerseyClientBuilder(io.dropwizard.client.JerseyClientBuilder) BeforeClass(org.junit.BeforeClass)

Example 44 with JerseyClientBuilder

use of io.dropwizard.client.JerseyClientBuilder in project dropwizard by dropwizard.

the class App1Test method custom204OnEmptyOptional.

@Test
public void custom204OnEmptyOptional() {
    final Client client = new JerseyClientBuilder(RULE.getEnvironment()).build("test client 1");
    final String url = String.format("http://localhost:%d/empty-optional", RULE.getLocalPort());
    final Response response = client.target(url).request().get();
    assertThat(response.getStatus()).isEqualTo(204);
}
Also used : Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) JerseyClientBuilder(io.dropwizard.client.JerseyClientBuilder) Test(org.junit.Test)

Example 45 with JerseyClientBuilder

use of io.dropwizard.client.JerseyClientBuilder in project dropwizard by dropwizard.

the class DropwizardSSLConnectionSocketFactoryTest method shouldBeOkIfHostnameVerificationOffAndServerHostnameMatchesAndFailVerfierSpecified.

@Test
public void shouldBeOkIfHostnameVerificationOffAndServerHostnameMatchesAndFailVerfierSpecified() throws Exception {
    tlsConfiguration.setVerifyHostname(false);
    final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).using(new FailVerifier()).build("bad_host_fail_verifier_working");
    final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getLocalPort())).request().get();
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : ClientResponse(org.glassfish.jersey.client.ClientResponse) Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) JerseyClientBuilder(io.dropwizard.client.JerseyClientBuilder) Test(org.junit.Test)

Aggregations

JerseyClientBuilder (io.dropwizard.client.JerseyClientBuilder)67 JerseyClientConfiguration (io.dropwizard.client.JerseyClientConfiguration)46 BeforeClass (org.junit.BeforeClass)45 Client (javax.ws.rs.client.Client)21 Test (org.junit.Test)21 Response (javax.ws.rs.core.Response)14 ClientResponse (org.glassfish.jersey.client.ClientResponse)7 File (java.io.File)4 ProcessingException (javax.ws.rs.ProcessingException)3 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)3 MultiPart (org.glassfish.jersey.media.multipart.MultiPart)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 FormDataBodyPart (org.glassfish.jersey.media.multipart.FormDataBodyPart)2 FormDataMultiPart (org.glassfish.jersey.media.multipart.FormDataMultiPart)2 Ignore (org.junit.Ignore)2 RequestAndResponse (httpstub.RequestAndResponse)1 ErrorMessage (io.dropwizard.jersey.errors.ErrorMessage)1 NoopHostnameVerifier (org.apache.http.conn.ssl.NoopHostnameVerifier)1 FileDataBodyPart (org.glassfish.jersey.media.multipart.file.FileDataBodyPart)1 Before (org.junit.Before)1