Search in sources :

Example 71 with Pipeline

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));
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 72 with Pipeline

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));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Material(com.thoughtworks.go.domain.materials.Material) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) File(java.io.File) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 73 with Pipeline

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;
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 74 with 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));
}
Also used : StageStatusListener(com.thoughtworks.go.server.domain.StageStatusListener) JobInstance(com.thoughtworks.go.domain.JobInstance) JobStatusListener(com.thoughtworks.go.server.domain.JobStatusListener) Stage(com.thoughtworks.go.domain.Stage) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 75 with Pipeline

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();
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)184 Test (org.junit.Test)122 Stage (com.thoughtworks.go.domain.Stage)33 Username (com.thoughtworks.go.server.domain.Username)30 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)29 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)24 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)24 PipelineMaterialRevision (com.thoughtworks.go.domain.PipelineMaterialRevision)21 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)20 JobInstance (com.thoughtworks.go.domain.JobInstance)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)13 Modification (com.thoughtworks.go.domain.materials.Modification)13 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)13 Date (java.util.Date)13 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)11 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)10 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6