use of org.jboss.pnc.client.ProductVersionClient 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.ProductVersionClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method testValidateWithExistingVersion.
@Test
public void testValidateWithExistingVersion() throws RemoteResourceException {
// with
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asUser());
ProductVersionClient productVersionClient = new ProductVersionClient(RestClientConfiguration.asUser());
final ProductMilestone milestone = productVersionClient.getMilestones("100").iterator().next();
// when
final ValidationResponse response = client.validateVersion(VersionValidationRequest.builder().productVersionId("100").version(milestone.getVersion()).build());
// then
assertThat(response.getIsValid()).isFalse();
assertThat(response.getErrorType()).isEqualTo(ValidationErrorType.DUPLICATION);
assertThat(response.getHints()).isNotEmpty();
}
use of org.jboss.pnc.client.ProductVersionClient 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();
}
use of org.jboss.pnc.client.ProductVersionClient 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.ProductVersionClient in project pnc by project-ncl.
the class ProductVersionEndpointTest method shouldNotUpdateGroupConfigsWithNonExistantGroupConfig.
@Test
public void shouldNotUpdateGroupConfigsWithNonExistantGroupConfig() throws ClientException {
// given
GroupConfigurationRef notExistingGC = GroupConfigurationRef.refBuilder().id("9999").name("i-dont-exist").build();
Map<String, GroupConfigurationRef> groupConfis = new HashMap<>();
// when
ProductVersionClient client = new ProductVersionClient(RestClientConfiguration.asUser());
ProductVersion productVersion = client.getSpecific(productVersionsId2);
groupConfis.putAll(productVersion.getGroupConfigs());
groupConfis.put(notExistingGC.getId(), notExistingGC);
ProductVersion toUpdate = productVersion.toBuilder().groupConfigs(groupConfis).build();
// then
assertThatThrownBy(() -> client.update(productVersion.getId(), toUpdate)).isInstanceOf(ClientException.class);
}
Aggregations