use of jetbrains.buildServer.server.rest.model.change.FileChanges 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");
}
Aggregations