Search in sources :

Example 6 with GroupBuildParameters

use of org.jboss.pnc.rest.api.parameters.GroupBuildParameters 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)

Aggregations

GroupBuildParameters (org.jboss.pnc.rest.api.parameters.GroupBuildParameters)6 Test (org.junit.Test)5 GroupBuild (org.jboss.pnc.dto.GroupBuild)4 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)4 ContainerTest (org.jboss.pnc.test.category.ContainerTest)4 BuildStatus (org.jboss.pnc.enums.BuildStatus)3 GroupBuildRequest (org.jboss.pnc.dto.requests.GroupBuildRequest)2 Undertow (io.undertow.Undertow)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 ConstraintViolation (javax.validation.ConstraintViolation)1 ClientException (org.jboss.pnc.client.ClientException)1 BuildConfigurationRevision (org.jboss.pnc.dto.BuildConfigurationRevision)1 BuildConfigurationRevisionRef (org.jboss.pnc.dto.BuildConfigurationRevisionRef)1 GroupBuildChangedNotification (org.jboss.pnc.dto.notification.GroupBuildChangedNotification)1 AdvancedGroupConfigurationClient (org.jboss.pnc.restclient.AdvancedGroupConfigurationClient)1 VertxWebSocketClient (org.jboss.pnc.restclient.websocket.VertxWebSocketClient)1 WebSocketClient (org.jboss.pnc.restclient.websocket.WebSocketClient)1