Search in sources :

Example 11 with ProductMilestoneClient

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);
}
Also used : ProductMilestone(org.jboss.pnc.dto.ProductMilestone) ProductMilestoneClient(org.jboss.pnc.client.ProductMilestoneClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 12 with ProductMilestoneClient

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);
}
Also used : ProductMilestone(org.jboss.pnc.dto.ProductMilestone) ProductMilestoneClient(org.jboss.pnc.client.ProductMilestoneClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 13 with ProductMilestoneClient

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());
}
Also used : ProductMilestone(org.jboss.pnc.dto.ProductMilestone) ProductMilestoneClient(org.jboss.pnc.client.ProductMilestoneClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 14 with ProductMilestoneClient

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();
}
Also used : ProductMilestoneClient(org.jboss.pnc.client.ProductMilestoneClient) ValidationResponse(org.jboss.pnc.dto.response.ValidationResponse) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

ProductMilestoneClient (org.jboss.pnc.client.ProductMilestoneClient)14 ContainerTest (org.jboss.pnc.test.category.ContainerTest)13 Test (org.junit.Test)13 ProductMilestone (org.jboss.pnc.dto.ProductMilestone)9 ValidationResponse (org.jboss.pnc.dto.response.ValidationResponse)4 ProductVersionClient (org.jboss.pnc.client.ProductVersionClient)2 Artifact (org.jboss.pnc.dto.Artifact)2 Build (org.jboss.pnc.dto.Build)2 ProductMilestoneCloseResult (org.jboss.pnc.dto.ProductMilestoneCloseResult)2 ProductMilestoneCloseParameters (org.jboss.pnc.rest.api.parameters.ProductMilestoneCloseParameters)2 IOException (java.io.IOException)1 Instant (java.time.Instant)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Optional (java.util.Optional)1 BadRequestException (javax.ws.rs.BadRequestException)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)1