use of jetbrains.buildServer.vcs.VcsRootInstance in project teamcity-rest by JetBrains.
the class BuildPromotionFinderTest method testRevision.
@Test
public void testRevision() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
MockVcsSupport vcs = new MockVcsSupport("vcs");
vcs.setDAGBased(true);
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
SVcsRootEx parentRoot2 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
VcsRootInstance root2 = buildConf.getVcsRootInstanceForParent(parentRoot2);
assert root1 != null;
assert root2 != null;
final BuildFinderTestBase.MockCollectRepositoryChangesPolicy changesPolicy = new BuildFinderTestBase.MockCollectRepositoryChangesPolicy();
vcs.setCollectChangesPolicy(changesPolicy);
changesPolicy.setCurrentState(root1, createVersionState("master", map("master", "rev_Vcs1_1")));
changesPolicy.setCurrentState(root2, createVersionState("master", map("master", "xxx")));
final BuildPromotion build10 = build().in(buildConf).finish().getBuildPromotion();
changesPolicy.setCurrentState(root1, createVersionState("master", map("master", "rev_Vcs1_2")));
final BuildPromotion build20 = build().in(buildConf).finish().getBuildPromotion();
changesPolicy.setCurrentState(root1, createVersionState("master", map("master", "xxx")));
changesPolicy.setCurrentState(root2, createVersionState("master", map("master", "rev_Vcs2_3")));
final BuildPromotion build30 = build().in(buildConf).finish().getBuildPromotion();
final MockVcsModification modification = new MockVcsModification(null, "comment", new Date(), "change_v1") {
@Override
public String getDisplayVersion() {
return "change_V1_display";
}
}.setRoot(root1);
vcs.addChange(root1, modification);
changesPolicy.setCurrentState(root1, createVersionState("master", map("master", "change_v1")));
final BuildPromotion build40 = build().in(buildConf).onModifications(modification).finish().getBuildPromotion();
checkBuilds("revision:rev_Vcs1_2", build20);
checkBuilds("revision:rev_Vcs1_");
checkBuilds("revision:(version:rev_Vcs1_2)", build20);
checkBuilds("revision:(version:rev_Vcs1_)");
checkBuilds("revision:(version:(value:rev_Vcs1_2))", build20);
checkBuilds("revision:(version:(value:rev_Vcs1_,matchType:equals))");
checkBuilds("revision:(version:(value:rev_Vcs1_2,matchType:contains))", build20);
checkBuilds("revision:(version:(value:rev_Vcs1_,matchType:contains))", build20, build10);
checkBuilds("revision:(version:(value:abra,matchType:contains))");
checkBuilds("revision:(internalVersion:change_v1)", build40);
checkBuilds("revision:(version:change_V1_display)", build40);
checkBuilds("revision:(version:change_V1_display,vcsRoot:(id:" + root1.getParent().getExternalId() + "))", build40);
checkBuilds("revision:(internalVersion:xxx)", build30, build20, build10);
checkBuilds("revision:(internalVersion:xxx,vcsRoot:(id:" + root1.getParent().getExternalId() + "))", build30);
}
Aggregations