Search in sources :

Example 1 with SVcsRootImpl

use of jetbrains.buildServer.vcs.impl.SVcsRootImpl in project teamcity-rest by JetBrains.

the class ChangeFinderTest method testChangeBean.

@Test
public void testChangeBean() {
    MockVcsSupport vcsSupport = new MockVcsSupport("svn");
    myFixture.getVcsManager().registerVcsSupport(vcsSupport);
    SVcsRootImpl vcsRoot = myFixture.addVcsRoot(vcsSupport.getName(), "", myBuildType);
    VcsRootInstance vcsRootInstance = myBuildType.getVcsRootInstanceForParent(vcsRoot);
    MockVcsModification modification10 = MockVcsModification.createWithoutFiles("user1", "descr1", new Date());
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.ADDED, "root/a/file.txt", "a/file.txt", "9", "10"));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.CHANGED, "root/a/file2.txt", "a/file2.txt", null, null));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.REMOVED, "root/b/file.txt", "b/file.txt", null, null));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.NOT_CHANGED, "root/b/file3.txt", "b/file3.txt", null, null));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.DIRECTORY_ADDED, "root/c", "c", null, "after"));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.DIRECTORY_CHANGED, "root/c1", "c1", null, "after"));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.DIRECTORY_REMOVED, "root/d", "d", "before", null));
    modification10.addChange(new VcsChange(VcsChangeInfo.Type.DIRECTORY_COPIED, "root/e", "e", "before", "after"));
    vcsSupport.addChange(vcsRootInstance, modification10);
    Change change10 = new Change(modification10, Fields.ALL, getBeanContext(myServer));
    FileChanges fileChanges10 = change10.getFileChanges();
    assertEquals(Integer.valueOf(8), fileChanges10.count);
    // type names are part of API
    check(fileChanges10.files.get(0), "added", null, null, "root/a/file.txt", "a/file.txt");
    check(fileChanges10.files.get(1), "edited", null, null, "root/a/file2.txt", "a/file2.txt");
    check(fileChanges10.files.get(2), "removed", null, null, "root/b/file.txt", "b/file.txt");
    check(fileChanges10.files.get(3), "unchanged", null, null, "root/b/file3.txt", "b/file3.txt");
    check(fileChanges10.files.get(4), "added", null, true, "root/c", "c");
    check(fileChanges10.files.get(5), "edited", null, true, "root/c1", "c1");
    check(fileChanges10.files.get(6), "removed", null, true, "root/d", "d");
    check(fileChanges10.files.get(7), "copied", null, true, "root/e", "e");
}
Also used : SVcsRootImpl(jetbrains.buildServer.vcs.impl.SVcsRootImpl) MockVcsModification(jetbrains.buildServer.serverSide.impl.MockVcsModification) FileChanges(jetbrains.buildServer.server.rest.model.change.FileChanges) MockVcsSupport(jetbrains.buildServer.serverSide.impl.MockVcsSupport) FileChange(jetbrains.buildServer.server.rest.model.change.FileChange) Change(jetbrains.buildServer.server.rest.model.change.Change) Test(org.testng.annotations.Test)

Example 2 with SVcsRootImpl

use of jetbrains.buildServer.vcs.impl.SVcsRootImpl in project teamcity-rest by JetBrains.

the class BuildFinderByPromotionTest method testBuildsOrder.

@Test
public void testBuildsOrder() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    final SVcsRootImpl vcsRoot = myFixture.addVcsRoot("mock", "", buildConf);
    VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(vcsRoot);
    assert root1 != null;
    final SFinishedBuild build10 = build().in(buildConf).finish();
    myFixture.addModification(modification().in(root1).version("1"));
    final SVcsModification change20 = myFixture.addModification(modification().in(root1).version("2"));
    myFixture.addModification(modification().in(root1).version("3"));
    assertEquals(3, buildConf.getPendingChanges().size());
    final SFinishedBuild build20 = build().in(buildConf).finish();
    final SFinishedBuild build30 = build().in(buildConf).onModifications(change20).finish();
    checkBuilds(null, build30, build20, build10);
    checkBuilds("buildType:(id:" + buildConf.getExternalId() + ")", build30, build20, build10);
    checkBuilds("sinceBuild:(id:" + build20.getBuildId() + ")", build30);
}
Also used : SVcsRootImpl(jetbrains.buildServer.vcs.impl.SVcsRootImpl) SVcsModification(jetbrains.buildServer.vcs.SVcsModification) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance) Test(org.testng.annotations.Test)

Example 3 with SVcsRootImpl

use of jetbrains.buildServer.vcs.impl.SVcsRootImpl in project teamcity-rest by JetBrains.

the class BuildFinderTest method testBuildsOrder.

@Test
public void testBuildsOrder() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    final SVcsRootImpl vcsRoot = myFixture.addVcsRoot("mock", "", buildConf);
    VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(vcsRoot);
    assert root1 != null;
    final SFinishedBuild build10 = build().in(buildConf).finish();
    myFixture.addModification(modification().in(root1).version("1"));
    final SVcsModification change20 = myFixture.addModification(modification().in(root1).version("2"));
    myFixture.addModification(modification().in(root1).version("3"));
    assertEquals(3, buildConf.getPendingChanges().size());
    final SFinishedBuild build20 = build().in(buildConf).finish();
    final SFinishedBuild build30 = build().in(buildConf).onModifications(change20).finish();
    checkBuilds(null, build30, build20, build10);
    checkBuilds("buildType:(id:" + buildConf.getExternalId() + ")", build30, build20, build10);
    checkBuilds("sinceBuild:(id:" + build20.getBuildId() + ")", build30);
}
Also used : SVcsRootImpl(jetbrains.buildServer.vcs.impl.SVcsRootImpl) SVcsModification(jetbrains.buildServer.vcs.SVcsModification) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance) Test(org.testng.annotations.Test)

Aggregations

SVcsRootImpl (jetbrains.buildServer.vcs.impl.SVcsRootImpl)3 Test (org.testng.annotations.Test)3 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)2 VcsRootInstance (jetbrains.buildServer.vcs.VcsRootInstance)2 Change (jetbrains.buildServer.server.rest.model.change.Change)1 FileChange (jetbrains.buildServer.server.rest.model.change.FileChange)1 FileChanges (jetbrains.buildServer.server.rest.model.change.FileChanges)1 MockVcsModification (jetbrains.buildServer.serverSide.impl.MockVcsModification)1 MockVcsSupport (jetbrains.buildServer.serverSide.impl.MockVcsSupport)1