Search in sources :

Example 21 with SvnMaterial

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));
}
Also used : GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) Test(org.junit.Test)

Example 22 with SvnMaterial

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));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 23 with SvnMaterial

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));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 24 with SvnMaterial

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));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 25 with SvnMaterial

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

the class ManualBuildTest method setUp.

@Before
public void setUp() {
    manualBuild = new ManualBuild(new Username(new CaseInsensitiveString("cruise-user")));
    SvnMaterial material = new SvnMaterial("http://foo.bar/baz", "user", "pass", false);
    materialRevisions = new MaterialRevisions(new MaterialRevision(material, new Modification(new Date(), "1234", "MOCK_LABEL-12", null)));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) Username(com.thoughtworks.go.server.domain.Username) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) Before(org.junit.Before)

Aggregations

SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)136 Test (org.junit.Test)113 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)44 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)37 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)21 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)20 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)19 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)19 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)18 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)17 Material (com.thoughtworks.go.domain.materials.Material)16 Modification (com.thoughtworks.go.domain.materials.Modification)16 Date (java.util.Date)14 Materials (com.thoughtworks.go.config.materials.Materials)13 Username (com.thoughtworks.go.server.domain.Username)9 File (java.io.File)9 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)7