use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceAdapterTest method testDecorationNewFile.
@Test
public void testDecorationNewFile() throws Exception {
// Create new file
write(new File(project.getLocation().toFile(), TEST_FILE), "Something");
project.refreshLocal(IResource.DEPTH_INFINITE, null);
IResource file = project.findMember(TEST_FILE);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(project).tracked().dirty(), new TestDecoratableResource(file) };
waitForIndexDiffUpdate(true);
IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
IDecoratableResource[] actualDRs = { new DecoratableResourceAdapter(indexDiffData, project), new DecoratableResourceAdapter(indexDiffData, file) };
assertArrayEquals(expectedDRs, actualDRs);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceAdapterTest method testDecorationNewEmptyFolder.
@Test
public void testDecorationNewEmptyFolder() throws Exception {
// Create new folder with sub folder
IFolder folder = project.getFolder(TEST_FOLDER);
folder.create(true, true, null);
IFolder subFolder = folder.getFolder(SUB_FOLDER);
subFolder.create(true, true, null);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(project).tracked(), new TestDecoratableResource(folder).ignored(), new TestDecoratableResource(subFolder).ignored() };
waitForIndexDiffUpdate(true);
IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
IDecoratableResource[] actualDRs = { new DecoratableResourceAdapter(indexDiffData, project), new DecoratableResourceAdapter(indexDiffData, folder), new DecoratableResourceAdapter(indexDiffData, subFolder) };
assertArrayEquals(expectedDRs, actualDRs);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceAdapterTest method testDecorationFolderPrefixOfOtherFolder.
@Test
public void testDecorationFolderPrefixOfOtherFolder() throws Exception {
project.getFolder(TEST_FOLDER).create(true, true, null);
IFolder testFolder2 = project.getFolder(TEST_FOLDER2);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(testFolder2).tracked() };
waitForIndexDiffUpdate(true);
IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
IDecoratableResource[] actualDRs = { new DecoratableResourceAdapter(indexDiffData, testFolder2) };
assertArrayEquals(expectedDRs, actualDRs);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceAdapterTest method testDecorationNewFileInSubfolder.
@Test
public void testDecorationNewFileInSubfolder() throws Exception {
// Create new folder with sub folder
IFolder folder = project.getFolder(TEST_FOLDER);
folder.create(true, true, null);
IFolder subFolder = folder.getFolder(SUB_FOLDER);
subFolder.create(true, true, null);
// Create new file
write(new File(subFolder.getLocation().toFile().getAbsolutePath(), TEST_FILE), "Something");
project.refreshLocal(IResource.DEPTH_INFINITE, null);
IResource file = subFolder.findMember(TEST_FILE);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(project).tracked().dirty(), new TestDecoratableResource(folder).dirty(), new TestDecoratableResource(subFolder).dirty(), new TestDecoratableResource(file) };
waitForIndexDiffUpdate(true);
IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
IDecoratableResource[] actualDRs = { new DecoratableResourceAdapter(indexDiffData, project), new DecoratableResourceAdapter(indexDiffData, folder), new DecoratableResourceAdapter(indexDiffData, subFolder), new DecoratableResourceAdapter(indexDiffData, file) };
for (int i = 0; i < expectedDRs.length; i++) assert (expectedDRs[i].equals(actualDRs[i]));
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceMappingTest method testMixedStagingStateIsModified_RemovedAdded.
@Test
public void testMixedStagingStateIsModified_RemovedAdded() throws Exception {
gitAdd(git, rmContentA);
gitCommit(git);
gitRemove(git, rmContentA);
gitAdd(git, rmContentB);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked().removed(), newExpectedDecoratableResource(rmContentB).tracked().added(), newExpectedDecoratableResourceMapping().tracked().modified() };
IndexDiffData indexDiffData = waitForIndexDiff(true);
IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
assertArrayEquals(expectedDRs, actualDRs);
assertDecorationStaged(resourceMapping);
}
Aggregations