Search in sources :

Example 1 with ApacheHttpClient43EngineWithRetry

use of org.jboss.pnc.client.ApacheHttpClient43EngineWithRetry in project pnc by project-ncl.

the class BuildEndpointTest method shouldGetSCMArchiveLink.

@Test
public void shouldGetSCMArchiveLink() throws ClientException, ReflectiveOperationException {
    BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
    // Disable redirects so we can test the actual response
    Field f = ClientBase.class.getDeclaredField("client");
    f.setAccessible(true);
    ResteasyClient reClient = (ResteasyClient) f.get(client);
    ApacheHttpClient43EngineWithRetry engine = (ApacheHttpClient43EngineWithRetry) reClient.httpEngine();
    engine.setFollowRedirects(false);
    Response internalScmArchiveLink = client.getInternalScmArchiveLink(buildId);
    assertThat(internalScmArchiveLink.getStatusInfo()).isEqualTo(Status.TEMPORARY_REDIRECT);
    assertThat(internalScmArchiveLink.getHeaderString("Location")).isNotEmpty();
}
Also used : Response(javax.ws.rs.core.Response) Field(java.lang.reflect.Field) ResteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient) BuildClient(org.jboss.pnc.client.BuildClient) ApacheHttpClient43EngineWithRetry(org.jboss.pnc.client.ApacheHttpClient43EngineWithRetry) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

Field (java.lang.reflect.Field)1 Response (javax.ws.rs.core.Response)1 ApacheHttpClient43EngineWithRetry (org.jboss.pnc.client.ApacheHttpClient43EngineWithRetry)1 BuildClient (org.jboss.pnc.client.BuildClient)1 ContainerTest (org.jboss.pnc.test.category.ContainerTest)1 ResteasyClient (org.jboss.resteasy.client.jaxrs.ResteasyClient)1 Test (org.junit.Test)1