use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductReleaseEndpointTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
ProductClient productClient = new ProductClient(RestClientConfiguration.asAnonymous());
product = productClient.getAll().iterator().next();
productVersion = productClient.getProductVersions(product.getId()).iterator().next();
ProductVersionClient productVersionClient = new ProductVersionClient(RestClientConfiguration.asAnonymous());
milestone = productVersionClient.getMilestones(productVersion.getId()).iterator().next();
releaseId = productVersionClient.getReleases(productVersion.getId()).iterator().next().getId();
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductVersionEndpointTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
ProductClient productClient = new ProductClient(RestClientConfiguration.asAnonymous());
product = productClient.getAll().iterator().next();
Iterator<ProductVersion> it = productClient.getProductVersions(product.getId()).iterator();
productVersionsId = it.next().getId();
productVersionsId2 = it.next().getId();
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductEndpointTest method testUpdate.
@Test
public void testUpdate() throws ClientException {
ProductClient client = new ProductClient(RestClientConfiguration.asUser());
Product dto = client.getSpecific(productId);
Product toUpdate = dto.toBuilder().name("Updated name").build();
client.update(productId, toUpdate);
Product retrieved = client.getSpecific(dto.getId());
assertThat(retrieved).isEqualTo(toUpdate);
assertThat(retrieved).isEqualToIgnoringGivenFields(dto, "name");
assertThat(retrieved.getName()).isEqualTo("Updated name");
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductEndpointTest method testPatch.
@Test
public void testPatch() throws ClientException, PatchBuilderException {
// given
ProductClient client = new ProductClient(RestClientConfiguration.asUser());
Product original = client.getSpecific(productId);
final String newProductAbbreviation = "newAbb";
// when
client.patch(productId, new ProductPatchBuilder().replaceAbbreviation(newProductAbbreviation));
Product patched = client.getSpecific(original.getId());
// then
assertThat(patched).isEqualToIgnoringGivenFields(original, "abbreviation");
assertThat(patched.getAbbreviation()).isEqualTo(newProductAbbreviation);
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductEndpointTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
ProductClient client = new ProductClient(RestClientConfiguration.asAnonymous());
productId = client.getAll().iterator().next().getId();
}
Aggregations