Beispiel #1
0
  @Test
  public void testReadProductReleaseUsingProxy() throws Exception {
    String relativeUrl = "/product-releases/" + productReleaseId;
    stubFor(
        get(urlEqualTo(CONTEXT_URL + relativeUrl))
            .willReturn(
                aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(readResponseBodyFromTemplate("product-releases-1.json"))));

    ProductReleaseEndpoint endpoint = client.target(pncUrl).proxy(ProductReleaseEndpoint.class);
    Response response = endpoint.getSpecific(productReleaseId);
    ProductReleaseRest entity =
        ((Singleton<ProductReleaseRest>)
                response.readEntity(new GenericType<Singleton<ProductReleaseRest>>() {}))
            .getContent();

    assertEquals(productReleaseId, entity.getId());
  }
Beispiel #2
0
  @Test
  public void testReadProductReleaseBuildConfigurations() throws Exception {
    String relativeUrl = "/product-releases/" + productReleaseId + "/distributed-build-records-ids";
    stubFor(
        get(urlEqualTo(CONTEXT_URL + relativeUrl))
            .willReturn(
                aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(
                        readResponseBodyFromTemplate(
                            "product-release-distributed-build-records-ids-1.json"))));

    ProductReleaseEndpoint endpoint = client.target(pncUrl).proxy(ProductReleaseEndpoint.class);
    Response response =
        endpoint.getAllBuildsInDistributedRecordsetOfProductRelease(productReleaseId);
    Page<BuildRecordRest> ids =
        ((Page<BuildRecordRest>) response.readEntity(new GenericType<Page<BuildRecordRest>>() {}));

    assertArrayEquals(asList(1, 2).toArray(), extractIds(ids.getContent()).toArray());
  }