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());
}
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);
}
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());
}
Aggregations