use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.
the class PipelineWithMultipleStages method scheduleAndCompleteFollowingStages.
protected void scheduleAndCompleteFollowingStages(Pipeline pipeline, JobResult result) {
for (int index = 2; index <= stagesSize; index++) {
StageConfig stageConfig = stageConfig(index);
Stage instance = new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), "md5-test", new TimeProvider());
instance.setOrderId(index);
dbHelper.getStageDao().saveWithJobs(pipeline, instance);
dbHelper.completeStage(instance, result);
}
}
use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.
the class JobInstanceSqlMapDaoTest method createNewPipeline.
private Pipeline createNewPipeline(PipelineConfig pipelineConfig) {
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, modifySomeFiles(pipelineConfig), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), "md5-test", new TimeProvider());
dbHelper.savePipelineWithStagesAndMaterials(pipeline);
return pipeline;
}
use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.
the class JobInstanceSqlMapDaoTest method shouldLoadRerunOfCounterValueForScheduledBuilds.
@Test
public void shouldLoadRerunOfCounterValueForScheduledBuilds() {
List<JobPlan> jobPlans = jobInstanceDao.orderedScheduledBuilds();
assertThat(jobPlans.size(), is(2));
assertThat(jobPlans.get(0).getIdentifier().getRerunOfCounter(), is(nullValue()));
assertThat(jobPlans.get(1).getIdentifier().getRerunOfCounter(), is(nullValue()));
dbHelper.passStage(savedStage);
Stage stage = instanceFactory.createStageForRerunOfJobs(savedStage, a(JOB_NAME), schedulingContext, pipelineConfig.getStage(new CaseInsensitiveString(STAGE_NAME)), new TimeProvider(), "md5");
dbHelper.saveStage(savedPipeline, stage, stage.getOrderId() + 1);
jobPlans = jobInstanceDao.orderedScheduledBuilds();
assertThat(jobPlans.size(), is(1));
assertThat(jobPlans.get(0).getIdentifier().getRerunOfCounter(), is(savedStage.getCounter()));
}
use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method schedulePipelineWithoutCounter.
private void schedulePipelineWithoutCounter(PipelineConfig pipelineConfig) {
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createWithModifications(modifyOneFile(pipelineConfig), ""), new DefaultSchedulingContext("anyone"), "md5-test", new TimeProvider());
save(pipeline);
for (Stage stage : pipeline.getStages()) {
stageDao.saveWithJobs(pipeline, stage);
}
}
use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldHaveUrlInGitMaterials.
@Test
public void shouldHaveUrlInGitMaterials() throws SQLException {
Materials gitMaterials = MaterialsMother.gitMaterials("gitUrl");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(gitMaterials.convertToConfigs());
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(modifyOneFile(pipelineConfig), Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
assertNotInserted(pipeline.getId());
savePipeline(pipeline);
Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
Materials materials = pipelineFromDB.getMaterials();
GitMaterial gitMaterial = (GitMaterial) materials.get(0);
assertThat(gitMaterial.getUrl(), is("gitUrl"));
}
Aggregations