use of com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldReturnPipelinesInConfigOrder.
@Test
public void shouldReturnPipelinesInConfigOrder() throws Exception {
pipelineTwo.createdPipelineWithAllStagesPassed();
pipelineOne.createdPipelineWithAllStagesPassed();
configHelper.setViewPermissionForGroup("group1", "jez");
List<PipelineGroupModel> groupModels = pipelineHistoryService.allActivePipelineInstances(new Username(new CaseInsensitiveString("jez")), PipelineSelections.ALL);
assertThat(groupModels.size(), is(2));
List<PipelineModel> pipelineOneModels = groupModels.get(0).getPipelineModels();
assertThat(pipelineOneModels.size(), is(1));
assertThat(pipelineOneModels.get(0).getActivePipelineInstances().get(0).getName(), is(pipelineTwo.pipelineName));
List<PipelineModel> pipelineTwoModels = groupModels.get(1).getPipelineModels();
assertThat(pipelineTwoModels.size(), is(1));
assertThat(pipelineTwoModels.get(0).getActivePipelineInstances().get(0).getName(), is(pipelineOne.pipelineName));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldIncludePauseInformationWhenGettingLatestPipelineInstanceFromAllPipelineGroups.
@Test
public void shouldIncludePauseInformationWhenGettingLatestPipelineInstanceFromAllPipelineGroups() throws Exception {
pipelineOne.createdPipelineWithAllStagesPassed();
configHelper.setOperatePermissionForGroup("group1", "chris", "raghu");
Username userNameChris = new Username(new CaseInsensitiveString("chris"));
pipelinePauseService.pause(pipelineOne.pipelineName, "paused", userNameChris);
Username userNameRaghu = new Username(new CaseInsensitiveString("raghu"));
pipelinePauseService.pause(pipelineTwo.pipelineName, "other paused", userNameRaghu);
configHelper.setViewPermissionForGroup("group1", "jez");
List<PipelineGroupModel> groupModels = pipelineHistoryService.allActivePipelineInstances(new Username(new CaseInsensitiveString("jez")), PipelineSelections.ALL);
assertThat(groupModels.size(), is(2));
List<PipelineModel> pipelineOneModels = groupModels.get(0).getPipelineModels();
assertThat(pipelineOneModels.size(), is(1));
PipelinePauseInfo pausedInfo = pipelineOneModels.get(0).getPausedInfo();
assertThat("isPaused", pausedInfo.isPaused(), is(true));
assertThat(pausedInfo.getPauseBy(), is("chris"));
assertThat(pausedInfo.getPauseCause(), is("paused"));
List<PipelineModel> pipelineTwoModels = groupModels.get(1).getPipelineModels();
assertThat(pipelineTwoModels.size(), is(1));
PipelinePauseInfo pipelineTwoPausedInfo = pipelineTwoModels.get(0).getPausedInfo();
assertThat("isPaused", pipelineTwoPausedInfo.isPaused(), is(true));
assertThat(pipelineTwoPausedInfo.getPauseBy(), is("raghu"));
assertThat(pipelineTwoPausedInfo.getPauseCause(), is("other paused"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldGetLatestPipelineInstanceWithPreviousStateFromAllPipelineGroups.
@Test
public void shouldGetLatestPipelineInstanceWithPreviousStateFromAllPipelineGroups() throws Exception {
configHelper.setViewPermissionForGroup("group1", "jez");
dbHelper.updateNaturalOrder(pipelineOne.createdPipelineWithAllStagesPassed().getId(), 1.0);
dbHelper.updateNaturalOrder(pipelineTwo.createdPipelineWithAllStagesPassed().getId(), 1.0);
dbHelper.updateNaturalOrder(pipelineTwo.createPipelineWithFirstStagePassedAndSecondStageRunning().getId(), 2.0);
Pipeline toRerun = pipelineTwo.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
pipelineTwo.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
dbHelper.updateNaturalOrder(toRerun.getId(), 3);
dbHelper.scheduleStage(toRerun, pipelineTwo.devStage());
pipelineRepository.updatePipelineTimeline(pipelineTimeline, new ArrayList<>());
List<PipelineGroupModel> groupModels = pipelineHistoryService.allActivePipelineInstances(new Username(new CaseInsensitiveString("jez")), PipelineSelections.ALL);
assertThat(groupModels.size(), is(2));
List<PipelineModel> pipelineOneModels = groupModels.get(1).getPipelineModels();
assertThat(pipelineOneModels.size(), is(1));
PipelineInstanceModels pipelineOneInstances = pipelineOneModels.get(0).getActivePipelineInstances();
assertThat(pipelineOneInstances.size(), is(1));
PipelineInstanceModel pipelineOne = pipelineOneInstances.get(0);
assertThat(pipelineOne.getCounter(), is(1));
List<PipelineModel> pipelineTwoModels = groupModels.get(0).getPipelineModels();
assertThat(pipelineTwoModels.size(), is(1));
PipelineInstanceModels pipelineTwoInstances = pipelineTwoModels.get(0).getActivePipelineInstances();
assertThat(pipelineTwoInstances.size(), is(3));
PipelineInstanceModel pipelineTwoJustScheduled = pipelineTwoInstances.get(0);
assertThat(pipelineTwoJustScheduled.getCounter(), is(4));
assertThat(pipelineTwoJustScheduled.getStageHistory().size(), is(2));
StageInstanceModel activeStage = pipelineTwoJustScheduled.activeStage();
assertThat(activeStage, is(nullValue()));
PipelineInstanceModel pipelineTwoPostFirstStage = pipelineTwoInstances.get(1);
assertThat(pipelineTwoPostFirstStage.getCounter(), is(3));
assertThat(pipelineTwoPostFirstStage.getStageHistory().size(), is(2));
activeStage = pipelineTwoPostFirstStage.activeStage();
assertThat(activeStage.getName(), is("dev"));
assertThat(activeStage.hasPreviousStage(), is(true));
assertThat(activeStage.getPreviousStage().getResult(), is(StageResult.Passed));
PipelineInstanceModel pipelineTwoWithSecondStageRunning = pipelineTwoInstances.get(2);
assertThat(pipelineTwoWithSecondStageRunning.getCounter(), is(2));
assertThat(pipelineTwoWithSecondStageRunning.getStageHistory().size(), is(2));
activeStage = pipelineTwoWithSecondStageRunning.activeStage();
assertThat(activeStage.getName(), is("ft"));
assertThat(activeStage.hasPreviousStage(), is(true));
assertThat(activeStage.getPreviousStage().getResult(), is(StageResult.Passed));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldReturnActiveInstanceOfAPipeline.
@Test
public void shouldReturnActiveInstanceOfAPipeline() throws Exception {
pipelineOne.createdPipelineWithAllStagesPassed();
configHelper.setViewPermissionForGroup("group1", "jez");
String pipelineName = pipelineOne.pipelineName;
List<PipelineGroupModel> groupModels = pipelineHistoryService.getActivePipelineInstance(new Username(new CaseInsensitiveString("jez")), pipelineName.toUpperCase());
assertThat(groupModels.size(), is(1));
List<PipelineModel> pipelineOneModels = groupModels.get(0).getPipelineModels();
assertThat(pipelineOneModels.size(), is(1));
assertThat(pipelineOneModels.get(0).getActivePipelineInstances().get(0).getName(), is(pipelineName));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldSkipPipelinesThatAreScheduledButNotInConfigFile.
@Test
public void shouldSkipPipelinesThatAreScheduledButNotInConfigFile() throws Exception {
pipelineOne.createPipelineWithFirstStageScheduled();
configHelper.removePipeline(pipelineOne.pipelineName);
configHelper.removePipeline(pipelineTwo.pipelineName);
List<PipelineGroupModel> groupModels = pipelineHistoryService.allActivePipelineInstances(new Username(new CaseInsensitiveString("jez")), PipelineSelections.ALL);
assertThat(groupModels.size(), is(0));
}
Aggregations