use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class StageControllerIntegrationTest method shouldNotRunStageIfPreviousStageHasNotBeenRun.
@Test
public void shouldNotRunStageIfPreviousStageHasNotBeenRun() throws Exception {
Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
String thirdStage = fixture.stageName(3);
ModelAndView mav = controller.rerunStage(fixture.pipelineName, pipeline.getLabel(), thirdStage, response, request);
Pipeline newPipeline = pipelineService.fullPipelineById(pipeline.getId());
assertThat("Should not run " + thirdStage, newPipeline.getStages().hasStage(thirdStage), is(false));
assertThat(((ResponseCodeView) mav.getView()).getStatusCode(), is(HttpServletResponse.SC_BAD_REQUEST));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class StageControllerIntegrationTest method shouldReturn404WhenReRunningNonExistantStage.
@Test
public void shouldReturn404WhenReRunningNonExistantStage() throws Exception {
Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
ModelAndView mav = controller.rerunStage(fixture.pipelineName, pipeline.getLabel(), "doesNotExist", response, request);
ResponseCodeView codeView = (ResponseCodeView) mav.getView();
assertThat(codeView.getStatusCode(), is(HttpServletResponse.SC_NOT_FOUND));
assertThat(codeView.getContent(), is("Stage 'doesNotExist' not found in pipeline '" + fixture.pipelineName + "'"));
}
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();
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PropertiesServiceTest method shouldReturnEmptyListIfLimitCountIsNotPositive.
@Test
public void shouldReturnEmptyListIfLimitCountIsNotPositive() {
Pipeline pipeline1 = createNewPipeline();
Pipeline pipeline2 = createNewPipeline();
List<Properties> propertiesList = propertiesService.loadHistory(fixture.pipelineName, fixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE, pipeline2.getId(), -1);
assertThat(propertiesList.size(), is(0));
propertiesList = propertiesService.loadHistory(fixture.pipelineName, fixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE, pipeline2.getId(), 0);
assertThat(propertiesList.size(), is(0));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class PropertiesServiceTest method shouldLoadHistoryUptoSpecifiedPipeline.
@Test
public void shouldLoadHistoryUptoSpecifiedPipeline() {
Pipeline pipeline1 = createNewPipeline();
Pipeline pipeline2 = createNewPipeline();
List<Properties> propertiesList = propertiesService.loadHistory(fixture.pipelineName, fixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE, pipeline2.getId(), 1);
assertThat(propertiesList.size(), is(1));
assertThat(propertiesList.get(0).getValue("cruise_pipeline_counter"), is(String.valueOf(pipeline2.getCounter())));
}
Aggregations