use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class StageOrderTest method shouldIncreaseOrderBy1ForUnScheduledNextStage.
@Test
public void shouldIncreaseOrderBy1ForUnScheduledNextStage() throws Exception {
schedulePipelineWithFirstStage();
Pipeline pipeline = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
dbHelper.passStage(pipeline.getFirstStage());
scheduleService.automaticallyTriggerRelevantStagesFollowingCompletionOf(pipeline.getFirstStage());
Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
assertThat(mostRecent.getStages().byName(preCondition.ftStage).getOrderId(), is(1001));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PipelineServiceIntegrationTest method shouldReturnCorrectNumberOfMaterialRevisionsAndMaterials.
@Test
public void shouldReturnCorrectNumberOfMaterialRevisionsAndMaterials() throws Exception {
File file1 = new File("file1");
File file2 = new File("file2");
File file3 = new File("file3");
File file4 = new File("file4");
Material hg = new HgMaterial("url", "Dest");
String[] hgRevs = new String[] { "h1" };
u.checkinFiles(hg, "h1", a(file1, file2, file3, file4), ModifiedAction.added);
ScheduleTestUtil.AddedPipeline pair01 = u.saveConfigWith("pair01", "stageName", u.m(hg));
u.runAndPass(pair01, hgRevs);
ReflectionUtil.invoke(pipelineSqlMapDao, "initDao");
Pipeline pipeline = pipelineService.mostRecentFullPipelineByName("pair01");
MaterialRevisions materialRevisions = pipeline.getBuildCause().getMaterialRevisions();
assertThat(materialRevisions.getMaterials().size(), is(1));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PipelineServiceTest method pipeline.
private Pipeline pipeline(MaterialRevisions scheduleTime, JobConfigs configs) {
Pipeline pipeline = PipelineMother.schedule(PipelineConfigMother.pipelineConfig("mummy", scheduleTime.getMaterialRevision(0).getMaterial().config(), configs), BuildCause.createWithModifications(scheduleTime, "me"));
pipeline.setId(10);
return pipeline;
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PipelineServiceTest method shouldNotifyStageStatusListenersOnlyWhenTransactionCommits.
@Test
public void shouldNotifyStageStatusListenersOnlyWhenTransactionCommits() throws Exception {
StageStatusListener stageStatusListener = mock(StageStatusListener.class);
JobStatusListener jobStatusListener = mock(JobStatusListener.class);
Pipeline pipeline = stubPipelineSaveForStatusListener(stageStatusListener, jobStatusListener);
service.save(pipeline);
verify(stageStatusListener).stageStatusChanged(any(Stage.class));
verify(jobStatusListener).jobStatusChanged(any(JobInstance.class));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PipelineServiceTriangleDependencyTest method shouldTellPipelineMaterialModificationsToUpdateItselfOnSave.
@Test
public void shouldTellPipelineMaterialModificationsToUpdateItselfOnSave() throws Exception {
Pipeline pipeline = PipelineMother.pipeline("cruise");
when(pipelineDao.save(pipeline)).thenReturn(pipeline);
when(pipelineTimeline.pipelineBefore(anyLong())).thenReturn(9L);
when(pipelineTimeline.pipelineAfter(pipeline.getId())).thenReturn(-1L);
when(materialRepository.findMaterialRevisionsForPipeline(9L)).thenReturn(MaterialRevisions.EMPTY);
service.save(pipeline);
Mockito.verify(pipelineTimeline).update();
}
Aggregations