use of jetbrains.buildServer.serverSide.impl.MockVcsSupport in project teamcity-rest by JetBrains.
the class ChangeStatusTest method setUp.
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
setFinder(myChangeFinder);
myFixture.getServerSettings().setPerProjectPermissionsEnabled(true);
myVcs = new MockVcsSupport("vcs");
myVcs.setDAGBased(true);
myFixture.getVcsManager().registerVcsSupport(myVcs);
myTestProject = createProject("someproject");
myUser = createUser("testuser");
myUser.addRole(RoleScope.projectScope(myTestProject.getProjectId()), getTestRoles().getProjectViewerRole());
myAnotherUser = createUser("anothertestuser");
}
use of jetbrains.buildServer.serverSide.impl.MockVcsSupport in project teamcity-rest by JetBrains.
the class VcsRootInstanceFinderTest method testRepositoryIdString.
@SuppressWarnings("ConstantConditions")
@Test
public void testRepositoryIdString() throws Exception {
MockVcsSupport svn = myFixture.registerVcsSupport("svn");
svn.addCustomVcsExtension(VcsPersonalSupport.class, new VcsPersonalSupport() {
@NotNull
@Override
public Collection<String> mapFullPath(@NotNull final VcsRootEntry rootEntry, @NotNull final String fullPath) throws VcsException {
String prefix = rootEntry.getProperties().get("prefix");
if (prefix != null && fullPath.startsWith(prefix))
return Collections.singletonList(fullPath.substring(prefix.length()));
return Collections.emptyList();
}
});
svn.addCustomVcsExtension(VcsClientMappingProvider.class, new VcsRootBasedMappingProvider() {
@Override
public Collection<VcsClientMapping> getClientMapping(@NotNull final VcsRoot vcsRoot) throws VcsException {
String prefix = vcsRoot.getProperties().get("prefix");
if (prefix != null)
return Collections.singletonList(new VcsClientMapping(prefix, ""));
return Collections.emptyList();
}
});
myFixture.registerVcsSupport("custom");
final ProjectEx project10 = getRootProject().createProject("project10", "Project name 10");
final SVcsRoot vcsRoot10 = project10.createVcsRoot("svn", "id10", "VCS root 10 name");
vcsRoot10.setProperties(CollectionsUtil.asMap("url", "22", "prefix", "000000-0000-1111-000000000001|trunk/path1"));
final SVcsRoot vcsRoot12 = project10.createVcsRoot("svn", "id12", "VCS root 12 name");
vcsRoot12.setProperties(CollectionsUtil.asMap("url", "", "prefix", "000000-0000-1111-000000000001|trunk/path2"));
final SVcsRoot vcsRoot15 = project10.createVcsRoot("custom", "id15", "VCS root 15 name");
vcsRoot15.setProperties(CollectionsUtil.asMap("url", "", "aaa", "3"));
final SBuildType bt10 = project10.createBuildType("id10", "name 10");
VcsRootInstance vInstance10 = attachVcsRoot(bt10, vcsRoot10);
VcsRootInstance vInstance20 = attachVcsRoot(bt10, vcsRoot12);
bt10.setCheckoutRules(vcsRoot10, new CheckoutRules("+:aaa=>bbb"));
check("repositoryIdString:xxx");
// pre-TeamCity 10 behavior
check("repositoryIdString:000000-0000-1111-000000000001|trunk/path1", vInstance10);
// pre-TeamCity 10 behavior
check("repositoryIdString:000000-0000-1111-000000000001|trunk/path1/aaa", vInstance10);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk/path1", vInstance10);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk/path1/aaa", vInstance10);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk/path2/aaa", vInstance20);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk2");
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk/path9");
check("repositoryIdString:svn://000000-0000-1111-000000000002|trunk/path1");
// does not work for now check("repositoryIdString:svn://000000-0000-1111-000000000001|", vInstance10, vInstance20);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk", vInstance10, vInstance20);
check("repositoryIdString:svn://000000-0000-1111-000000000001|trunk/path");
}
use of jetbrains.buildServer.serverSide.impl.MockVcsSupport in project teamcity-rest by JetBrains.
the class ChangeFinderTest method buildVcsRootInstance.
@NotNull
private VcsRootInstance buildVcsRootInstance() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
MockVcsSupport vcs = new MockVcsSupport("vcs");
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
assert root1 != null;
return root1;
}
use of jetbrains.buildServer.serverSide.impl.MockVcsSupport in project teamcity-rest by JetBrains.
the class ChangeFinderTest method testDuplicate.
@Test
public void testDuplicate() {
final BuildTypeImpl buildConf1 = registerBuildType("buildConf1", "project");
final BuildTypeImpl buildConf2 = registerBuildType("buildConf2", "project");
MockVcsSupport vcs = new MockVcsSupport("vcs");
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf1);
SVcsRootEx parentRoot2 = myFixture.addVcsRoot(vcs.getName(), "", buildConf2);
VcsRootInstance root1 = buildConf1.getVcsRootInstanceForParent(parentRoot1);
VcsRootInstance root2 = buildConf2.getVcsRootInstanceForParent(parentRoot2);
assert root1 != null && root2 != null;
final String version = "12345";
myFixture.addModification(modification().in(root1).by("user1").version(version));
myFixture.addModification(modification().in(root2).by("user1").version(version));
List<SVcsModificationOrChangeDescriptor> result = myChangeFinder.getItems("unique:true").myEntries;
assertEquals(1, result.size());
List<SVcsModificationOrChangeDescriptor> resultWithDuplicate = myChangeFinder.getItems("count:10").myEntries;
assertEquals(2, resultWithDuplicate.size());
}
use of jetbrains.buildServer.serverSide.impl.MockVcsSupport in project teamcity-rest by JetBrains.
the class ChangeFinderTest method testLimitedProcessing.
@Test
public void testLimitedProcessing() {
final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
final BuildTypeImpl buildConf2 = registerBuildType("buildConf2", "project");
MockVcsSupport vcs = new MockVcsSupport("vcs");
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
assert root1 != null;
SVcsModification m20 = myFixture.addModification(modification().in(root1).by("user1").version("20").parentVersions("10"));
SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
SVcsModification m40 = myFixture.addModification(modification().in(root1).version("40").parentVersions("10"));
SVcsModification m50 = myFixture.addModification(modification().in(root1).by("user1").version("50").parentVersions("40"));
SVcsModification m60 = myFixture.addModification(modification().in(root1).version("60").parentVersions("15"));
SVcsModification m70 = myFixture.addModification(modification().in(root1).version("70").parentVersions("10"));
myFixture.getVcsModificationChecker().checkForModifications(buildConf.getVcsRootInstances(), OperationRequestor.UNKNOWN);
check(null, m70, m60, m50, m40, m30, m20);
checkCounts("count:3", 3, 4);
checkCounts("lookupLimit:3", 3, 4);
checkCounts("username:user1", 2, 6);
checkCounts("buildType:(id:" + buildConf2.getExternalId() + ")", 0, 0);
checkCounts("version:50", 1, 6);
}
Aggregations