use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method prepareData.
@SuppressWarnings("unchecked")
@BeforeClass
public static void prepareData() throws Exception {
BuildConfigurationClient bcc = new BuildConfigurationClient(RestClientConfiguration.asAnonymous());
Iterator<BuildConfiguration> it = bcc.getAll().iterator();
configurationId = it.next().getId();
configuration2Id = it.next().getId();
configuration3Id = it.next().getId();
configuration4Id = it.next().getId();
ProductClient pdc = new ProductClient(RestClientConfiguration.asAnonymous());
productId = pdc.getAll().iterator().next().getId();
EnvironmentClient ec = new EnvironmentClient(RestClientConfiguration.asAnonymous());
environmentId = ec.getAll().iterator().next().getId();
ProjectClient pjc = new ProjectClient(RestClientConfiguration.asAnonymous());
projectId = pjc.getAll().iterator().next().getId();
SCMRepositoryClient scmrc = new SCMRepositoryClient(RestClientConfiguration.asAnonymous());
final Iterator<SCMRepository> scmrIt = scmrc.getAll(null, null).iterator();
repositoryConfigurationId = scmrIt.next().getId();
repositoryConfiguration2Id = scmrIt.next().getId();
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class GroupConfigurationEndpointTest method createProductVersion.
private ProductVersion createProductVersion() throws ClientException {
ProductClient pClient = new ProductClient(RestClientConfiguration.asUser());
Product product = pClient.getAll().iterator().next();
ProductVersionClient pvClient = new ProductVersionClient(RestClientConfiguration.asUser());
ProductVersion pv = ProductVersion.builder().version("3245.6742").product(ProductRef.refBuilder().id(product.getId()).build()).build();
return pvClient.createNew(pv);
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductEndpointTest method testCreateNew.
@Test
@InSequence(20)
public void testCreateNew() throws ClientException {
ProductClient client = new ProductClient(RestClientConfiguration.asUser());
Product product = Product.builder().name("New Product").abbreviation("NP").description("The newst product of them all").productVersions(Collections.emptyMap()).build();
Product created = client.createNew(product);
assertThat(created.getId()).isNotEmpty();
Product retrieved = client.getSpecific(created.getId());
assertThat(created).isEqualToIgnoringGivenFields(product, "id");
assertThat(retrieved).isEqualToIgnoringGivenFields(product, "id");
assertThat(retrieved).isEqualTo(created);
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductEndpointTest method shouldFailToAddConflictingProduct.
@Test
@InSequence(30)
public void shouldFailToAddConflictingProduct() throws URISyntaxException, ClientException {
ProductClient client = new ProductClient(RestClientConfiguration.asUser());
Product product = Product.builder().name("The Same Thing").abbreviation("TST").description("Let's keep doing the same thing over and over. Nobody will notice.").build();
Product created = client.createNew(product);
assertThat(created.getId()).isNotEmpty();
try {
client.createNew(product);
fail("Exception should be thrown");
} catch (ClientException ex) {
// OK
}
}
use of org.jboss.pnc.client.ProductClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest 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());
Iterator<ProductMilestone> it = productVersionClient.getMilestones(productVersion.getId()).iterator();
milestone = it.next();
milestoneId = milestone.getId();
milestone2 = it.next();
}
Aggregations