Search in sources :

Example 6 with PipelineWithMultipleStages

use of com.thoughtworks.go.fixture.PipelineWithMultipleStages in project gocd by gocd.

the class ScheduleStageTest method setUp.

@Before
public void setUp() throws Exception {
    configHelper = new GoConfigFileHelper().usingCruiseConfigDao(dao);
    fixture = new PipelineWithMultipleStages(3, materialRepository, transactionTemplate);
    fixture.usingThreeJobs();
    fixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
}
Also used : GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) Before(org.junit.Before)

Example 7 with PipelineWithMultipleStages

use of com.thoughtworks.go.fixture.PipelineWithMultipleStages in project gocd by gocd.

the class StageServiceIntegrationTest method shouldSaveTheStageStatusProperlyUponJobCancelAfterInvalidatingTheCache.

@Test
public void shouldSaveTheStageStatusProperlyUponJobCancelAfterInvalidatingTheCache() throws Exception {
    fixture = (PipelineWithMultipleStages) new PipelineWithMultipleStages(2, materialRepository, transactionTemplate).usingTwoJobs();
    fixture.usingConfigHelper(configFileHelper).usingDbHelper(dbHelper).onSetUp();
    Pipeline pipeline = fixture.createPipelineWithFirstStageAssigned();
    Stage currentStage = pipeline.getFirstStage();
    JobInstances jobs = currentStage.getJobInstances();
    JobInstance firstJob = jobs.first();
    firstJob.completing(JobResult.Passed);
    firstJob.completed(new Date());
    jobInstanceDao.updateStateAndResult(firstJob);
    // prime the cache
    stageService.findStageWithIdentifier(new StageIdentifier(pipeline, currentStage));
    stageService.cancelJob(jobs.last());
    Stage savedStage = stageService.stageById(currentStage.getId());
    assertThat(savedStage.getState(), is(StageState.Cancelled));
    assertThat(savedStage.getResult(), is(StageResult.Cancelled));
}
Also used : PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) Date(java.util.Date) Test(org.junit.Test)

Example 8 with PipelineWithMultipleStages

use of com.thoughtworks.go.fixture.PipelineWithMultipleStages in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    goCache.clear();
    pipelineOne = new PipelineWithMultipleStages(3, materialRepository, transactionTemplate);
    pipelineOne.setGroupName("group1");
    pipelineTwo = new PipelineWithTwoStages(materialRepository, transactionTemplate);
    pipelineTwo.setGroupName("group2");
    diskIsFull = new ArtifactsDiskIsFull();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    dbHelper.onSetUp();
    pipelineOne.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    pipelineTwo.usingConfigHelper(configHelper).usingDbHelper(dbHelper).addToSetup();
    pipelineOne.configStageAsManualApprovalWithApprovedUsers(pipelineOne.stageName(2), "jez");
    configHelper.addSecurityWithAdminConfig();
    configHelper.setOperatePermissionForGroup("group1", "jez");
    pipelineCommentFeatureToggleState = featureToggleService.isToggleOn(Toggles.PIPELINE_COMMENT_FEATURE_TOGGLE_KEY);
    featureToggleService.changeValueOfToggle(Toggles.PIPELINE_COMMENT_FEATURE_TOGGLE_KEY, true);
    notifier.disableUpdates();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) Before(org.junit.Before)

Example 9 with PipelineWithMultipleStages

use of com.thoughtworks.go.fixture.PipelineWithMultipleStages in project gocd by gocd.

the class StageServiceIntegrationTest method shouldReturnFalseWhenAllStagesAreCompletedInAGivenPipeline.

@Test
public void shouldReturnFalseWhenAllStagesAreCompletedInAGivenPipeline() throws Exception {
    fixture = new PipelineWithMultipleStages(4, materialRepository, transactionTemplate);
    fixture.usingConfigHelper(configFileHelper).usingDbHelper(dbHelper).onSetUp();
    Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
    assertThat(stageService.isAnyStageActiveForPipeline(fixture.pipelineName, pipeline.getCounter()), Is.is(false));
}
Also used : PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) Test(org.junit.Test)

Aggregations

PipelineWithMultipleStages (com.thoughtworks.go.fixture.PipelineWithMultipleStages)9 Before (org.junit.Before)6 Test (org.junit.Test)3 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 ArtifactsDiskIsFull (com.thoughtworks.go.fixture.ArtifactsDiskIsFull)1 PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)1 Date (java.util.Date)1