use of com.thoughtworks.go.domain.buildcause.BuildCause 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;
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class BuildCauseTest method shouldSetBuildTriggerOnUpdatingMaterialRevisions.
@Test
public void shouldSetBuildTriggerOnUpdatingMaterialRevisions() {
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(MaterialsMother.svnMaterial(), oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createWithEmptyModifications();
buildCause.setMaterialRevisions(first);
assertThat(buildCause.getBuildCauseMessage(), is("modified by lgao"));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class BuildCauseTest method shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger.
@Test
public void shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createWithModifications(first, "");
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
try {
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
} catch (BuildCauseOutOfDateException ex) {
// good
return;
}
fail("should have thrown");
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createManualForced();
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class ModificationBuildCauseTest method shouldReturnBuildCauseMessageForLegacyDependencyRevision.
@Test
public void shouldReturnBuildCauseMessageForLegacyDependencyRevision() {
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);
BuildCause modificationBuildCause = BuildCause.createWithModifications(revisions, "");
String message = modificationBuildCause.getBuildCauseMessage();
assertThat(message, containsString("triggered by pipelineName/10/stageName/1"));
}
Aggregations