Search in sources :

Example 1 with DependencyMaterial

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

the class FetchTaskTest method buildCauseWithDependencyMaterial.

private BuildCause buildCauseWithDependencyMaterial(String upstreamPipelineName, int upstreamPipelineCounter, String upstreamPipelineLabel, String upstreamStageName, int upstreamStageCounter) {
    BuildCause buildCause = BuildCause.createWithEmptyModifications();
    MaterialRevisions materialRevisions = new MaterialRevisions();
    DependencyMaterialRevision materialRevision = DependencyMaterialRevision.create(upstreamPipelineName, upstreamPipelineCounter, upstreamPipelineLabel, upstreamStageName, upstreamStageCounter);
    MaterialRevision withRevision = materialRevision.convert(new DependencyMaterial(new CaseInsensitiveString(upstreamPipelineName), new CaseInsensitiveString(upstreamStageName)), new Date());
    materialRevisions.addRevision(withRevision);
    buildCause.setMaterialRevisions(materialRevisions);
    return buildCause;
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) DependencyMaterialRevision(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision) DependencyMaterialRevision(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Date(java.util.Date) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 2 with DependencyMaterial

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

the class ModificationBuildCauseTest method shouldReturnBuildCauseMessage.

@Test
public void shouldReturnBuildCauseMessage() {
    MaterialRevisions revisions = new MaterialRevisions();
    Modification modification = new Modification(new Date(), "pipelineName/123/stageName/1", "MOCK_LABEL-12", null);
    revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
    BuildCause modificationBuildCause = BuildCause.createWithModifications(revisions, "");
    String message = modificationBuildCause.getBuildCauseMessage();
    assertThat(message, containsString("triggered by pipelineName/123/stageName/1"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 3 with DependencyMaterial

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

the class ModificationBuildCauseTest method shouldGetBuildCausedByIfIsDenpendencyMaterial.

@Test
public void shouldGetBuildCausedByIfIsDenpendencyMaterial() throws Exception {
    MaterialRevisions revisions = new MaterialRevisions();
    Modification modification = new Modification(new Date(), "pipelineName/10/stageName/1", "MOCK_LABEL-12", null);
    revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
    assertThat(BuildCause.createWithModifications(revisions, "").getBuildCauseMessage(), is("triggered by pipelineName/10/stageName/1"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) Date(java.util.Date) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 4 with DependencyMaterial

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

the class DependencyMaterialAgentTest method materialRevision.

private MaterialRevision materialRevision(String pipelineName, Integer pipelineCounter, String pipelineLabel, String stageName, int stageCounter) {
    DependencyMaterial material = new DependencyMaterial(new CaseInsensitiveString(pipelineName), new CaseInsensitiveString(stageName));
    DependencyMaterialRevision revision = DependencyMaterialRevision.create(pipelineName, pipelineCounter, pipelineLabel, stageName, stageCounter);
    MaterialRevision materialRevision = revision.convert(material, new Date());
    return materialRevision;
}
Also used : DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date)

Example 5 with DependencyMaterial

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

the class ScheduleTestUtil method saveConfigWithTimer.

public AddedPipeline saveConfigWithTimer(String pipelineName, TimerConfig timer, MaterialDeclaration... materialDeclaration) {
    String stageName = AutoTriggerDependencyResolutionTest.STAGE_NAME;
    MaterialConfigs materialConfigs = new MaterialConfigs();
    for (MaterialDeclaration mDecl : materialDeclaration) {
        MaterialConfig materialConfig = AutoTriggerDependencyResolutionTest.CLONER.deepClone(mDecl.material.config());
        materialConfigs.add(materialConfig);
    }
    PipelineConfig cfg = configHelper.addPipelineWithGroupAndTimer(DEFAULT_GROUP, pipelineName, materialConfigs, stageName, timer, "job1");
    return new AddedPipeline(cfg, new DependencyMaterial(str(pipelineName), str(stageName)));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial)

Aggregations

DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)96 Test (org.junit.Test)75 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)65 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)30 Modification (com.thoughtworks.go.domain.materials.Modification)30 Date (java.util.Date)24 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)19 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)18 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)16 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)15 Stage (com.thoughtworks.go.domain.Stage)14 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)13 Materials (com.thoughtworks.go.config.materials.Materials)12 Username (com.thoughtworks.go.server.domain.Username)12 Pipeline (com.thoughtworks.go.domain.Pipeline)11 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)11 PipelineMaterialRevision (com.thoughtworks.go.domain.PipelineMaterialRevision)10 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)10 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)9