use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class TimedBuildTest method shouldReturnEmptyBuildCauseIfThereIsNoModification_whenTriggeringOnlyForMaterialChange.
@Test
public void shouldReturnEmptyBuildCauseIfThereIsNoModification_whenTriggeringOnlyForMaterialChange() throws Exception {
MaterialRevisions someRevisions = new MaterialRevisions(new MaterialRevision(MaterialsMother.gitMaterial("git://url"), ModificationsMother.aCheckIn("1", "file1.txt")));
BuildType timedBuild = new TimedBuild();
PipelineConfig timerConfig = PipelineConfigMother.pipelineConfigWithTimer("Timer", "* * * * * ?", true);
BuildCause buildCause = timedBuild.onEmptyModifications(timerConfig, someRevisions);
assertThat(buildCause, is(nullValue()));
}
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"));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineTest method shouldUseOldBuildCauseMessageIfThereIsNoneForThisPipeline.
@Test
public void shouldUseOldBuildCauseMessageIfThereIsNoneForThisPipeline() throws SQLException {
MaterialRevisions materialRevisions = ModificationsMother.multipleModifications();
BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, "");
Pipeline pipeline = new Pipeline("Test", buildCause);
assertThat(pipeline.getBuildCauseMessage(), not(Matchers.nullValue()));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldResolveTriangleDependencyViaAutoBuild.
@Test
public void shouldResolveTriangleDependencyViaAutoBuild() throws Exception {
SystemEnvironment env = mock(SystemEnvironment.class);
when(env.enforceRevisionCompatibilityWithUpstream()).thenReturn(false);
int i = 0;
GitMaterial git = new GitMaterial("git");
String[] git_revs = { "g1" };
u.checkinInOrder(git, git_revs);
ScheduleTestUtil.AddedPipeline p4 = u.saveConfigWith("p4", u.m(git));
ScheduleTestUtil.AddedPipeline p5 = u.saveConfigWith("p5", u.m(p4));
ScheduleTestUtil.AddedPipeline p6 = u.saveConfigWith("p6", u.m(p4), u.m(p5));
String p4_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p4, u.d(i++), "g1");
String p4_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p4, u.d(i++), "g1");
String p5_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p5, u.d(i++), p4_2);
String p4_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p4, u.d(i++), "g1");
String p4_4 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p4, u.d(i), "g1");
MaterialRevisions given = u.mrs(u.mr(p4, true, p4_4), u.mr(p5, true, p5_1));
MaterialRevisions expected = u.mrs(u.mr(p4, false, p4_2), u.mr(p5, false, p5_1));
AutoBuild autoBuild = new AutoBuild(goConfigService, pipelineService, p6.config.name().toString(), env, materialChecker, serverHealthService);
pipelineTimeline.update();
BuildCause buildCause = autoBuild.onModifications(given, false, null);
assertThat(buildCause.getMaterialRevisions(), is(expected));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class ManualBuildTest method shouldPopulateProducedBuildCauseApproverForEmptyModificationBuildCause.
@Test
public void shouldPopulateProducedBuildCauseApproverForEmptyModificationBuildCause() throws Exception {
BuildCause buildCause = manualBuild.onEmptyModifications(null, materialRevisions);
assertThat(buildCause.getApprover(), is("cruise-user"));
}
Aggregations