use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldTriggerWithRevisions_inDay3_whenSharedMaterialIsNotAvailableInDay2.
@Test
public void shouldTriggerWithRevisions_inDay3_whenSharedMaterialIsNotAvailableInDay2() throws Exception {
/**
* day 1.
* git -------> P1--------+
* \ |
* \ |
* \ v
* -----> P2 -----> P3
*
* day 2.
* git -------> P1--------+
* |
* |
* v
* svn -------> P2 -----> P3
*
* day 3.
* git -------> P1--------+
* \ |
* \ |
* \ v
* -----> P2 -----> P3
*/
GitMaterial git = u.wf(new GitMaterial("git"), "folder1");
String[] git_revs = { "g1", "g2", "g3" };
u.checkinInOrder(git, git_revs);
SvnMaterial svn = u.wf(new SvnMaterial("svn", "username", "password", false), "folder2");
String[] svn_revs = { "s1" };
u.checkinInOrder(svn, svn_revs);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("P1", u.m(git));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("P2", u.m(git));
ScheduleTestUtil.AddedPipeline p3 = u.saveConfigWith("P3", u.m(p1), u.m(p2));
CruiseConfig cruiseConfig = goConfigDao.load();
// day 1:
String p1_1 = u.runAndPass(p1, "g1");
String p2_1 = u.runAndPass(p2, "g1");
String p3_1 = u.runAndPass(p3, p1_1, p2_1);
// day 2:
configHelper.setMaterialConfigForPipeline("P2", svn.config());
cruiseConfig = goConfigDao.load();
String p1_2 = u.runAndPass(p1, "g2");
String p2_2 = u.runAndPass(new ScheduleTestUtil.AddedPipeline(cruiseConfig.pipelineConfigByName(new CaseInsensitiveString("P2")), p2.material), "s1");
String p3_2 = u.runAndPass(p3, p1_2, p2_2);
// day 3:
configHelper.setMaterialConfigForPipeline("P2", git.config());
cruiseConfig = goConfigDao.load();
String p1_3 = u.runAndPass(p1, "g2");
String p2_3 = u.runAndPass(p2, "g2");
MaterialRevisions given = u.mrs(u.mr(p1, true, p1_3), u.mr(p2, false, p2_3));
assertThat(getRevisionsBasedOnDependencies(p3, cruiseConfig, given), is(given));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldTrigger_withLatestOfUnsharedMaterial_keepingAllTheSharedMaterialRevisionsPegged.
@Test
public void shouldTrigger_withLatestOfUnsharedMaterial_keepingAllTheSharedMaterialRevisionsPegged() throws Exception {
/**
* git -------> P1--------+
* | |
* | |
* v v
* P2 -----> P3 <---- svn
*/
GitMaterial git = u.wf(new GitMaterial("git"), "folder1");
String[] git_revs = { "g1", "g2" };
u.checkinInOrder(git, git_revs);
SvnMaterial svn = u.wf(new SvnMaterial("svn", "username", "password", false), "folder2");
String[] svn_revs = { "s1", "s2" };
u.checkinInOrder(svn, svn_revs);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("P1", u.m(git));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("P2", u.m(p1));
ScheduleTestUtil.AddedPipeline p3 = u.saveConfigWith("P3", u.m(p1), u.m(p2), u.m(svn));
CruiseConfig cruiseConfig = goConfigDao.load();
String p1_1 = u.runAndPass(p1, "g1");
String p2_1 = u.runAndPass(p2, p1_1);
String p1_2 = u.runAndPass(p1, "g2");
u.scheduleWith(p2, p1_2);
String p3_1 = u.runAndPass(p3, p1_1, p2_1, "s1");
MaterialRevisions given = u.mrs(u.mr(p2, true, p2_1), u.mr(u.mw(p1), false, p1_2), u.mr(svn, true, "s2"));
MaterialRevisions expected = u.mrs(u.mr(p2, true, p2_1), u.mr(u.mw(p1), false, p1_1), u.mr(svn, true, "s2"));
MaterialRevisions finalRevisions = getRevisionsBasedOnDependencies(p3, cruiseConfig, given);
assertThat(finalRevisions, is(expected));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldChooseTheRevisionFromSecondWhenThirdIsNotModified.
@Test
public void shouldChooseTheRevisionFromSecondWhenThirdIsNotModified() throws Exception {
// Third <- Second
// | /
// | /
// Last
//
SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
String[] svn_revs = { "s1", "s2" };
int i = 1;
u.checkinInOrder(svn, u.d(i++), svn_revs);
ScheduleTestUtil.AddedPipeline second = u.saveConfigWith("second", u.m(svn));
ScheduleTestUtil.AddedPipeline third = u.saveConfigWith("third", u.m(second));
ScheduleTestUtil.AddedPipeline last = u.saveConfigWith("last", u.m(second), u.m(third));
String second_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s1");
String second_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s1");
String second_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s2");
String second_4 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s2");
String third_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_2);
String third_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_2);
String third_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_2);
MaterialRevisions given = u.mrs(u.mr(third, true, third_3), u.mr(second, true, second_4));
MaterialRevisions expected = u.mrs(u.mr(third, true, third_3), u.mr(second, true, second_2));
MaterialRevisions finalRevisions = getRevisionsBasedOnDependencies(goConfigDao.load(), given, new CaseInsensitiveString("last"));
assertThat(finalRevisions, is(expected));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldIgnoreUpstreamPipelineWhenThereIsNothingInCommon.
@Test
public void shouldIgnoreUpstreamPipelineWhenThereIsNothingInCommon() throws Exception {
SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
String[] svn_revs = { "s1", "s2" };
int i = 1;
u.checkinInOrder(svn, u.d(i++), svn_revs);
HgMaterial hg = u.wf(new HgMaterial("hg", null), "folder2");
String[] hg_revs = { "hg1", "hg2", "hg3" };
u.checkinInOrder(hg, u.d(i++), hg_revs);
ScheduleTestUtil.AddedPipeline up0 = u.saveConfigWith("up0", u.m(hg));
ScheduleTestUtil.AddedPipeline up1 = u.saveConfigWith("up1", u.m(up0));
ScheduleTestUtil.AddedPipeline current = u.saveConfigWith("current", u.m(up0), u.m(up1), u.m(svn));
String up0_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(up0, u.d(i++), "hg1", "hg2", "hg3");
String up0_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(up0, u.d(i++), "hg1", "hg2", "hg3");
String up1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(up1, u.d(i++), up0_1);
MaterialRevisions given = u.mrs(u.mr(up0, true, up0_2), u.mr(up1, false, up1_1), u.mr(svn, true, "s1", "s2"));
MaterialRevisions expected = u.mrs(u.mr(up0, true, up0_2), u.mr(up1, false, up1_1), u.mr(svn, true, "s2"));
MaterialRevisions finalRevisions = getRevisionsBasedOnDependencies(goConfigDao.load(), given, new CaseInsensitiveString("current"));
assertThat(finalRevisions, is(expected));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldChooseTheRevisionFromThirdWhenBothThirdAndSecondAreModified.
@Test
public void shouldChooseTheRevisionFromThirdWhenBothThirdAndSecondAreModified() throws Exception {
// Third <- Second <-- SVN
// | |
// v v
// Last
SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
String[] svn_revs = { "s1", "s2" };
int i = 1;
u.checkinInOrder(svn, u.d(i++), svn_revs);
ScheduleTestUtil.AddedPipeline second = u.saveConfigWith("second", u.m(svn));
ScheduleTestUtil.AddedPipeline third = u.saveConfigWith("third", u.m(second));
ScheduleTestUtil.AddedPipeline last = u.saveConfigWith("last", u.m(second), u.m(third));
String second_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s1");
String second_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s1");
String second_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s1");
String second_4 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(second, u.d(i++), "s2");
String third_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_1);
String third_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_1);
String third_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(third, u.d(i++), second_2);
MaterialRevisions given = u.mrs(u.mr(third, true, third_3), u.mr(second, true, second_4));
MaterialRevisions expected = u.mrs(u.mr(third, true, third_3), u.mr(second, true, second_3));
MaterialRevisions finalRevisions = getRevisionsBasedOnDependencies(goConfigDao.load(), given, new CaseInsensitiveString("last"));
assertThat(finalRevisions, is(expected));
}
Aggregations