use of org.jboss.pnc.client.ProductMilestoneClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method shouldUpdateProductMilestone.
@Test
public void shouldUpdateProductMilestone() throws Exception {
// given
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asUser());
final String version = "1.0.1.ER1";
assertThat(milestone.getProductRelease()).isNotNull();
ProductMilestone toUpdate = milestone.toBuilder().version(version).build();
// when
client.update(milestone.getId(), toUpdate);
// then
ProductMilestone retrieved = client.getSpecific(milestone.getId());
assertThat(retrieved).isEqualTo(toUpdate);
assertThat(retrieved).isEqualToIgnoringGivenFields(milestone, "version");
assertThat(retrieved.getVersion()).isEqualTo(version);
}
use of org.jboss.pnc.client.ProductMilestoneClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method shouldFailToCreateExistingMilestone.
@Test
public void shouldFailToCreateExistingMilestone() throws IOException {
// given
ProductMilestone copyWithoutId = milestone.toBuilder().id(null).build();
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asUser());
// when then
assertThatThrownBy(() -> client.createNew(copyWithoutId)).isInstanceOf(ClientException.class);
}
use of org.jboss.pnc.client.ProductMilestoneClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method testGetSpecific.
@Test
public void testGetSpecific() throws ClientException {
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asAnonymous());
ProductMilestone dto = client.getSpecific(milestoneId);
// from DatabaseDataInitializer
assertThat(dto.getVersion()).isEqualTo("1.0.0.Build1");
// from DatabaseDataInitializer
assertThat(dto.getProductVersion().getId()).isEqualTo(productVersion.getId());
}
use of org.jboss.pnc.client.ProductMilestoneClient in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method testSuccessfulValidationWithNewVersion.
@Test
public void testSuccessfulValidationWithNewVersion() throws RemoteResourceException {
// with
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asUser());
// when
final ValidationResponse response = client.validateVersion(VersionValidationRequest.builder().productVersionId("100").version("1.0.3.Build1").build());
// then
assertThat(response.getIsValid()).isTrue();
assertThat(response.getErrorType()).isNull();
assertThat(response.getHints()).isNullOrEmpty();
}
Aggregations