Search in sources :

Example 16 with PipelineWithTwoStages

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

the class RestfulServiceTest method setUp.

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

Example 17 with PipelineWithTwoStages

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

the class ScheduleServiceCachedIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    preCondition = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    dbHelper.onSetUp();
    preCondition.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) Before(org.junit.Before)

Example 18 with PipelineWithTwoStages

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

the class ScheduleServiceIntegrationTest method setup.

@Before
public void setup() throws Exception {
    configHelper = new GoConfigFileHelper();
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    configHelper.onSetUp();
    pipelineFixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
    pipelineFixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    repository = new SvnCommand(null, testRepo.projectRepositoryUrl());
    mingleConfig = configHelper.addPipeline("mingle", STAGE_NAME, repository, JOB_NAME, "functional");
    goConfigService.forceNotifyListeners();
    agentAssignment.clear();
    goCache.clear();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper)

Example 19 with PipelineWithTwoStages

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

the class BuildAssignmentServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    configCache = new ConfigCache();
    registry = ConfigElementImplementationRegistryMother.withNoPlugins();
    configHelper = new GoConfigFileHelper().usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    dbHelper.onSetUp();
    fixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
    fixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    repository = new SvnCommand(null, testRepo.projectRepositoryUrl());
    evolveConfig = configHelper.addPipeline("evolve", STAGE_NAME, repository, "unit");
    configHelper.addPipeline("anotherPipeline", STAGE_NAME, repository, "anotherTest");
    configHelper.addPipeline("thirdPipeline", STAGE_NAME, repository, "yetAnotherTest");
    goConfigService.forceNotifyListeners();
    goCache.clear();
    u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
    agent = new AgentStub();
    notifier.disableUpdates();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) AgentStub(com.thoughtworks.go.server.websocket.AgentStub)

Example 20 with PipelineWithTwoStages

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

the class BuildAssignmentServiceIntegrationTest method shouldCancelBuildsForDeletedJobsWhenPipelineConfigChanges.

@Test
public void shouldCancelBuildsForDeletedJobsWhenPipelineConfigChanges() throws Exception {
    buildAssignmentService.initialize();
    fixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder).usingTwoJobs();
    fixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    fixture.createPipelineWithFirstStageScheduled();
    buildAssignmentService.onTimer();
    PipelineConfig pipelineConfig = new Cloner().deepClone(configHelper.getCachedGoConfig().currentConfig().getPipelineConfigByName(new CaseInsensitiveString(fixture.pipelineName)));
    String xml = new MagicalGoConfigXmlWriter(configCache, registry).toXmlPartial(pipelineConfig);
    String md5 = CachedDigestUtils.md5Hex(xml);
    StageConfig devStage = pipelineConfig.findBy(new CaseInsensitiveString(fixture.devStage));
    devStage.getJobs().remove(devStage.jobConfigByConfigName(new CaseInsensitiveString(fixture.JOB_FOR_DEV_STAGE)));
    pipelineConfigService.updatePipelineConfig(loserUser, pipelineConfig, md5, new HttpLocalizedOperationResult());
    Pipeline pipeline = pipelineDao.mostRecentPipeline(fixture.pipelineName);
    JobInstance deletedJob = pipeline.getFirstStage().getJobInstances().getByName(fixture.JOB_FOR_DEV_STAGE);
    assertThat(deletedJob.getState(), is(JobState.Completed));
    assertThat(deletedJob.getResult(), is(JobResult.Cancelled));
    JobInstance retainedJob = pipeline.getFirstStage().getJobInstances().getByName(fixture.DEV_STAGE_SECOND_JOB);
    assertThat(retainedJob.getState(), is(JobState.Scheduled));
    assertThat(retainedJob.getResult(), is(JobResult.Unknown));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) Cloner(com.rits.cloning.Cloner)

Aggregations

PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)28 Before (org.junit.Before)22 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)10 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)3 SchedulerFixture (com.thoughtworks.go.fixture.SchedulerFixture)2 Test (org.junit.Test)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 Cloner (com.rits.cloning.Cloner)1 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 ArtifactsDiskIsFull (com.thoughtworks.go.fixture.ArtifactsDiskIsFull)1 PipelineWithMultipleStages (com.thoughtworks.go.fixture.PipelineWithMultipleStages)1 ShineDao (com.thoughtworks.go.server.dao.sparql.ShineDao)1 Username (com.thoughtworks.go.server.domain.Username)1 InMemoryEmailNotificationTopic (com.thoughtworks.go.server.messaging.InMemoryEmailNotificationTopic)1 StageNotificationListener (com.thoughtworks.go.server.messaging.StageNotificationListener)1 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)1 AgentStub (com.thoughtworks.go.server.websocket.AgentStub)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1