Search in sources :

Example 96 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveSvnMaterials.

@Test
public void shouldStoreAndRetrieveSvnMaterials() throws SQLException {
    SvnMaterial svnMaterial = svnMaterial("svnUrl", "folder");
    PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
    pipelineConfig.setMaterialConfigs(new MaterialConfigs(svnMaterial.config()));
    MaterialRevisions materialRevisions = new MaterialRevisions();
    materialRevisions.addRevision(svnMaterial, ModificationsMother.multipleModificationList());
    Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(materialRevisions, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
    assertNotInserted(pipeline.getId());
    savePipeline(pipeline);
    Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
    final Materials materials = pipelineFromDB.getMaterials();
    assertThat(materials.get(0), is(svnMaterial));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Materials(com.thoughtworks.go.config.materials.Materials) Test(org.junit.Test)

Example 97 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldFindPipelineThatPassedForStageAcrossStageReruns.

@Test
public void shouldFindPipelineThatPassedForStageAcrossStageReruns() throws Exception {
    PipelineConfig config = PipelineMother.createPipelineConfig("pipeline", new MaterialConfigs(MaterialConfigsMother.hgMaterialConfig()), "firstStage", "secondStage");
    Pipeline pipeline0 = dbHelper.newPipelineWithAllStagesPassed(config);
    dbHelper.updateNaturalOrder(pipeline0.getId(), 4.0);
    Pipeline pipeline1 = dbHelper.newPipelineWithFirstStagePassed(config);
    Stage stage = dbHelper.scheduleStage(pipeline1, config.get(1));
    dbHelper.failStage(stage);
    stage = dbHelper.scheduleStage(pipeline1, config.get(1));
    dbHelper.passStage(stage);
    dbHelper.updateNaturalOrder(pipeline1.getId(), 5.0);
    Stage passedStageRerun = StageMother.scheduledStage("pipeline", pipeline1.getCounter(), "secondStage", 2, "job");
    passedStageRerun = stageDao.saveWithJobs(pipeline1, passedStageRerun);
    dbHelper.passStage(passedStageRerun);
    Pipeline pipeline5 = dbHelper.newPipelineWithFirstStagePassed(config);
    stage = dbHelper.scheduleStage(pipeline5, config.get(1));
    dbHelper.failStage(stage);
    dbHelper.updateNaturalOrder(pipeline5.getId(), 9.0);
    Pipeline pipeline6 = dbHelper.newPipelineWithFirstStagePassed(config);
    stage = dbHelper.scheduleStage(pipeline6, config.get(1));
    dbHelper.failStage(stage);
    dbHelper.updateNaturalOrder(pipeline6.getId(), 10.0);
    Pipeline pipeline = pipelineDao.findEarlierPipelineThatPassedForStage("pipeline", "secondStage", 10.0);
    assertThat(pipeline.getId(), is(pipeline1.getId()));
    assertThat(pipeline.getNaturalOrder(), is(5.0));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Test(org.junit.Test)

Example 98 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class JobRunnerTest method getWork.

private BuildWork getWork(JobConfig jobConfig) {
    CruiseConfig config = new BasicCruiseConfig();
    config.server().setArtifactsDir("logs");
    String stageName = "mingle";
    String pipelineName = "pipeline1";
    config.addPipeline(BasicPipelineConfigs.DEFAULT_GROUP, new PipelineConfig(new CaseInsensitiveString(pipelineName), new MaterialConfigs(), new StageConfig(new CaseInsensitiveString(stageName), new JobConfigs(jobConfig))));
    String pipelineLabel = "100";
    JobPlan jobPlan = JobInstanceMother.createJobPlan(jobConfig, new JobIdentifier(pipelineName, -2, pipelineLabel, stageName, "100", JOB_PLAN_NAME, 0L), new DefaultSchedulingContext());
    jobPlan.setFetchMaterials(true);
    jobPlan.setCleanWorkingDir(false);
    List<Builder> builder = BuilderMother.createBuildersAssumingAllExecTasks(config, pipelineName, stageName, JOB_PLAN_NAME);
    BuildAssignment buildAssignment = BuildAssignment.create(jobPlan, BuildCause.createWithEmptyModifications(), builder, new File(CruiseConfig.WORKING_BASE_DIR + pipelineName));
    return new BuildWork(buildAssignment);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) Builder(com.thoughtworks.go.domain.builder.Builder) BuildAssignment(com.thoughtworks.go.remote.work.BuildAssignment) BuildWork(com.thoughtworks.go.remote.work.BuildWork) File(java.io.File)

Example 99 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class ApprovalTest method shouldValidateTree.

@Test
public void shouldValidateTree() {
    Approval approval = new Approval(new AuthConfig(new AdminRole(new CaseInsensitiveString("role"))));
    BasicCruiseConfig cruiseConfig = GoConfigMother.defaultCruiseConfig();
    cruiseConfig.server().security().adminsConfig().addRole(new AdminRole(new CaseInsensitiveString("super-admin")));
    PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p1"), new MaterialConfigs());
    cruiseConfig.addPipeline("g1", pipelineConfig);
    assertThat(approval.validateTree(PipelineConfigSaveValidationContext.forChain(true, "g1", cruiseConfig, pipelineConfig)), is(false));
    assertThat(approval.getAuthConfig().errors().isEmpty(), is(false));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) Test(org.junit.Test)

Example 100 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineHistoryMother method pipeline.

public static PipelineModel pipeline() {
    PipelineModel pipelineModel = new PipelineModel("pipe1", true, true, PipelinePauseInfo.notPaused());
    MaterialRevisions materialRevisions = ModificationsMother.createHgMaterialRevisions();
    PipelineInstanceModel instanceModel = PipelineInstanceModel.createPipeline("pipe1", -1, "label1", BuildCause.createWithModifications(materialRevisions, "foo-bar"), new StageInstanceModels());
    instanceModel.setMaterialConfigs(new MaterialConfigs(materialRevisions.getMaterialRevision(0).getMaterial().config()));
    instanceModel.setLatestRevisions(materialRevisions);
    pipelineModel.addPipelineInstance(instanceModel);
    return pipelineModel;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)

Aggregations

MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)208 Test (org.junit.Test)160 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)40 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)35 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)33 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)30 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)26 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)24 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)23 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)22 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)20 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)18 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)18 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)15 ValueStreamMapPresentationModel (com.thoughtworks.go.server.presentation.models.ValueStreamMapPresentationModel)15 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)14 Material (com.thoughtworks.go.domain.materials.Material)13 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)12 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)12 ArrayList (java.util.ArrayList)12