Search in sources :

Example 31 with TimeProvider

use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.

the class DatabaseAccessHelper method scheduleWithFileChanges.

private Pipeline scheduleWithFileChanges(PipelineConfig pipelineConfig) {
    BuildCause buildCause = BuildCause.createWithModifications(modifyOneFile(pipelineConfig), "");
    saveRevs(buildCause.getMaterialRevisions());
    return instanceFactory.createPipelineInstance(pipelineConfig, buildCause, new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY), md5, new TimeProvider());
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 32 with TimeProvider

use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.

the class DatabaseAccessHelper method schedulePipelineWithAllStages.

public Pipeline schedulePipelineWithAllStages(PipelineConfig pipelineConfig, BuildCause buildCause) {
    buildCause.assertMaterialsMatch(pipelineConfig.materialConfigs());
    DefaultSchedulingContext defaultSchedulingContext = new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY);
    Stages stages = new Stages();
    Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, buildCause, defaultSchedulingContext, md5, new TimeProvider());
    for (StageConfig stageConfig : pipelineConfig) {
        stages.add(instanceFactory.createStageInstance(stageConfig, defaultSchedulingContext, md5, new TimeProvider()));
    }
    pipeline.setStages(stages);
    return scheduleJobInstancesAndSavePipeline(pipeline);
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) StageConfig(com.thoughtworks.go.config.StageConfig)

Example 33 with TimeProvider

use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.

the class DatabaseAccessHelper method newPipelineWithFirstStagePassed.

public Pipeline newPipelineWithFirstStagePassed(PipelineConfig config) throws SQLException {
    Pipeline pipeline = instanceFactory.createPipelineInstance(config, BuildCause.createManualForced(modifyOneFile(new MaterialConfigConverter().toMaterials(config.materialConfigs()), ModificationsMother.nextRevision()), Username.ANONYMOUS), new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY), md5, new TimeProvider());
    saveMaterialsWIthPassedStages(pipeline);
    return pipeline;
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) MaterialConfigConverter(com.thoughtworks.go.server.service.MaterialConfigConverter)

Example 34 with TimeProvider

use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.

the class DatabaseAccessHelper method newPipelineWithFirstStageScheduled.

public Pipeline newPipelineWithFirstStageScheduled(PipelineConfig config) throws SQLException {
    Pipeline pipeline = instanceFactory.createPipelineInstance(config, BuildCause.createManualForced(modifyOneFile(new MaterialConfigConverter().toMaterials(config.materialConfigs()), ModificationsMother.nextRevision()), Username.ANONYMOUS), new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY), md5, new TimeProvider());
    savePipelineWithStagesAndMaterials(pipeline);
    return pipeline;
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) MaterialConfigConverter(com.thoughtworks.go.server.service.MaterialConfigConverter)

Example 35 with TimeProvider

use of com.thoughtworks.go.util.TimeProvider in project gocd by gocd.

the class JobAgentMetadataSqlMapDaoIntegrationTest method setup.

@Before
public void setup() throws Exception {
    dbHelper.onSetUp();
    PipelineConfig pipelineConfig = PipelineMother.withSingleStageWithMaterials(PIPELINE_NAME, STAGE_NAME, BuildPlanMother.withBuildPlans(JOB_NAME, OTHER_JOB_NAME));
    DefaultSchedulingContext schedulingContext = new DefaultSchedulingContext(DEFAULT_APPROVED_BY);
    Pipeline savedPipeline = instanceFactory.createPipelineInstance(pipelineConfig, modifySomeFiles(pipelineConfig), schedulingContext, "md5-test", new TimeProvider());
    dbHelper.savePipelineWithStagesAndMaterials(savedPipeline);
    Stage savedStage = savedPipeline.getFirstStage();
    jobId = savedStage.getJobInstances().getByName(JOB_NAME).getId();
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) TimeProvider(com.thoughtworks.go.util.TimeProvider) Before(org.junit.Before)

Aggregations

TimeProvider (com.thoughtworks.go.util.TimeProvider)177 Test (org.junit.Test)122 Date (java.util.Date)29 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)28 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)25 DateTime (org.joda.time.DateTime)18 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)16 GoConfigRevision (com.thoughtworks.go.domain.GoConfigRevision)13 Username (com.thoughtworks.go.server.domain.Username)13 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)13 Before (org.junit.Before)13 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)11 Materials (com.thoughtworks.go.config.materials.Materials)10 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)10 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)9 TransactionStatus (org.springframework.transaction.TransactionStatus)9 Material (com.thoughtworks.go.domain.materials.Material)7 Modification (com.thoughtworks.go.domain.materials.Modification)7 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)6