Search in sources :

Example 6 with BuildConfigurationRevision

use of org.jboss.pnc.dto.BuildConfigurationRevision in project pnc by project-ncl.

the class BuildConfigurationEndpointTest method shouldNotCreateBuildConfigRevision.

@Test
public void shouldNotCreateBuildConfigRevision() throws ClientException {
    final String description = "Updated description again.";
    final String updatedName = "yetanotherupdatedname";
    BuildConfigurationClient client = new BuildConfigurationClient(RestClientConfiguration.asUser());
    BuildConfiguration bc = client.getSpecific(configuration2Id);
    BuildConfiguration newBC1 = bc.toBuilder().name(updatedName).description(description).build();
    BuildConfiguration newBC2 = newBC1.toBuilder().description(description + " and again").build();
    BuildConfigurationRevision newRevision1 = client.createRevision(configuration2Id, newBC1);
    BuildConfigurationRevision newRevision2 = client.createRevision(configuration2Id, newBC2);
    assertEquals(newRevision1.getRev(), newRevision2.getRev());
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) BuildConfigurationRevision(org.jboss.pnc.dto.BuildConfigurationRevision) BuildConfigurationClient(org.jboss.pnc.client.BuildConfigurationClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 7 with BuildConfigurationRevision

use of org.jboss.pnc.dto.BuildConfigurationRevision in project pnc by project-ncl.

the class BuildTest method shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems.

@Test
public void shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems() throws ClientException {
    // given
    GroupConfiguration groupConfiguration = groupConfigurationClient.getAll().iterator().next();
    assertThat(groupConfiguration.getBuildConfigs()).isNotEmpty();
    List<BuildConfigurationRevisionRef> buildConfigurationRevisions = new ArrayList<>();
    BuildConfigurationRevision buildConfigurationRevision = BuildConfigurationRevision.builder().id(groupConfiguration.getBuildConfigs().keySet().iterator().next()).rev(1).name(groupConfiguration.getName()).build();
    buildConfigurationRevisions.add(buildConfigurationRevision);
    GroupBuildRequest groupConfigWithAuditedBCsRest = GroupBuildRequest.builder().buildConfigurationRevisions(buildConfigurationRevisions).build();
    GroupBuildParameters groupBuildParameters = new GroupBuildParameters();
    groupBuildParameters.setRebuildMode(RebuildMode.FORCE);
    // when
    GroupBuild groupBuild = groupConfigurationClient.trigger(groupConfiguration.getId(), groupBuildParameters, groupConfigWithAuditedBCsRest);
    // then
    assertThat(groupBuild).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
    EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
    EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED);
    ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
Also used : GroupBuildRequest(org.jboss.pnc.dto.requests.GroupBuildRequest) GroupBuild(org.jboss.pnc.dto.GroupBuild) BuildConfigurationRevisionRef(org.jboss.pnc.dto.BuildConfigurationRevisionRef) ArrayList(java.util.ArrayList) BuildConfigurationRevision(org.jboss.pnc.dto.BuildConfigurationRevision) BuildStatus(org.jboss.pnc.enums.BuildStatus) GroupBuildParameters(org.jboss.pnc.rest.api.parameters.GroupBuildParameters) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 8 with BuildConfigurationRevision

use of org.jboss.pnc.dto.BuildConfigurationRevision in project pnc by project-ncl.

the class BuildConfigProviderTest method testGetRevision.

@Test
public void testGetRevision() {
    // With
    final Integer revision = 1;
    BuildConfigurationAudited bca = BuildConfigurationAudited.fromBuildConfiguration(bc, revision);
    when(buildConfigurationAuditedRepository.queryById(new IdRev(bc.getId(), revision))).thenReturn(bca);
    // When
    BuildConfigurationRevision bcr = provider.getRevision(bc.getId().toString(), revision);
    // Then
    assertThat(bcr).isNotNull();
    assertThat(bcr.getId()).isEqualTo(bc.getId().toString());
    assertThat(bcr.getRev()).isEqualTo(revision);
    assertThat(bcr.getName()).isEqualTo(bc.getName());
    assertThat(bcr.getProject().getId()).isEqualTo(bc.getProject().getId().toString());
    assertThat(bcr.getCreationTime()).isEqualTo(bc.getCreationTime().toInstant());
    assertThat(bcr.getBuildType()).isEqualTo(bc.getBuildType());
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) BuildConfigurationRevision(org.jboss.pnc.dto.BuildConfigurationRevision) IdRev(org.jboss.pnc.model.IdRev) Test(org.junit.Test)

Aggregations

BuildConfigurationRevision (org.jboss.pnc.dto.BuildConfigurationRevision)8 Test (org.junit.Test)8 ContainerTest (org.jboss.pnc.test.category.ContainerTest)7 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)5 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)3 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 InSequence (org.jboss.arquillian.junit.InSequence)1 BuildClient (org.jboss.pnc.client.BuildClient)1 BuildConfigurationRevisionRef (org.jboss.pnc.dto.BuildConfigurationRevisionRef)1 GroupBuild (org.jboss.pnc.dto.GroupBuild)1 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)1 GroupBuildRequest (org.jboss.pnc.dto.requests.GroupBuildRequest)1 BuildStatus (org.jboss.pnc.enums.BuildStatus)1 BuildConfigurationAudited (org.jboss.pnc.model.BuildConfigurationAudited)1 IdRev (org.jboss.pnc.model.IdRev)1 GroupBuildParameters (org.jboss.pnc.rest.api.parameters.GroupBuildParameters)1