diff options
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare')
29 files changed, 532 insertions, 660 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java index d8c3928aa..13e608fea 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java @@ -177,7 +177,8 @@ public class CompareGitTestCase extends CompareTestCase { return new SubscriberStorageAccessor(subscriber); } - protected static void assertDiffCount(List<Diff> differences, int expectedOutgoing, int expectedIncoming) { + protected static void assertDiffCount(List<Diff> differences, int expectedOutgoing, + int expectedIncoming) { assertEquals(expectedOutgoing + expectedIncoming, differences.size()); int outgoingCount = 0; diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java index b17be02ea..ce7a19cf4 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java @@ -286,8 +286,8 @@ public class GitTestRepository { * @throws GitAPIException * @throws NoFilepatternException */ - public void addToIndex(IResource resource) throws CoreException, IOException, NoFilepatternException, - GitAPIException { + public void addToIndex(IResource resource) + throws CoreException, IOException, NoFilepatternException, GitAPIException { String repoPath = getRepoRelativePath(resource.getLocation().toString()); Git git = new Git(repository); try { @@ -373,8 +373,8 @@ public class GitTestRepository { * @param resources * Resources to add to the index. */ - public void addToIndex(IResource... resources) throws CoreException, IOException, NoFilepatternException, - GitAPIException { + public void addToIndex(IResource... resources) + throws CoreException, IOException, NoFilepatternException, GitAPIException { Git git = new Git(repository); try { for (IResource resource : resources) { @@ -392,8 +392,8 @@ public class GitTestRepository { * @param resources * Resources to add to the index. */ - public void removeFromIndex(IResource... resources) throws CoreException, IOException, - NoFilepatternException, GitAPIException { + public void removeFromIndex(IResource... resources) + throws CoreException, IOException, NoFilepatternException, GitAPIException { Git git = new Git(repository); try { for (IResource resource : resources) { @@ -646,7 +646,8 @@ public class GitTestRepository { */ public Subscriber createSubscriberForResolution(String sourceRef, String targetRef, boolean includeLocal) throws IOException { - final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, includeLocal); + final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, + includeLocal); final GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data); final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(dataSet); subscriber.init(new NullProgressMonitor()); @@ -676,15 +677,16 @@ public class GitTestRepository { */ public Subscriber createSubscriberForComparison(String sourceRef, String targetRef, IFile comparedFile, boolean includeLocal) throws IOException { - final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, includeLocal); + final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, + includeLocal); final GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data); final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(dataSet); subscriber.init(new NullProgressMonitor()); final ResourceMapping[] mappings = getResourceMappings(comparedFile, ResourceMappingContext.LOCAL_CONTEXT); - final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext( - subscriber, dataSet); + final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext(subscriber, + dataSet); final SubscriberScopeManager manager = new SubscriberScopeManager(subscriber.getName(), mappings, subscriber, remoteContext, true); final GitSubscriberMergeContext context = new GitSubscriberMergeContext(subscriber, manager, dataSet); @@ -718,8 +720,8 @@ public class GitTestRepository { final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(dataSet); subscriber.init(new NullProgressMonitor()); - final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext( - subscriber, dataSet); + final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext(subscriber, + dataSet); final ResourceMapping[] mappings = getResourceMappings(comparedFile, remoteContext); final SubscriberScopeManager manager = new SubscriberScopeManager(subscriber.getName(), mappings, subscriber, remoteContext, true); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/DirCacheResourceVariantTreeProviderTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/DirCacheResourceVariantTreeProviderTest.java index a69db1d5e..8a2bed4dd 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/DirCacheResourceVariantTreeProviderTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/DirCacheResourceVariantTreeProviderTest.java @@ -42,8 +42,8 @@ public class DirCacheResourceVariantTreeProviderTest { IFile iFile1 = project.getFile("file1"); //$NON-NLS-1$ // untracked file : not part of the index - DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider( - repository, true); + DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider(repository, + true); assertTrue(treeProvider.getKnownResources().isEmpty()); assertFalse(treeProvider.getBaseTree().hasResourceVariant(iFile1)); assertFalse(treeProvider.getSourceTree().hasResourceVariant(iFile1)); @@ -69,8 +69,8 @@ public class DirCacheResourceVariantTreeProviderTest { IFile iFile2 = iProject.getFile("file2"); //$NON-NLS-1$ // no conflict on either file : present in the trees anyway - DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider( - repository, true); + DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider(repository, + true); assertEquals(3, treeProvider.getKnownResources().size()); assertTrue(treeProvider.getBaseTree().hasResourceVariant(iFile1)); @@ -93,8 +93,8 @@ public class DirCacheResourceVariantTreeProviderTest { // conflict on file 1 : present in all three trees // no conflict on file 2 : present anyway - DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider( - repository, true); + DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider(repository, + true); assertTrue(treeProvider.getKnownResources().contains(iFile1)); assertTrue(treeProvider.getKnownResources().contains(iFile2)); @@ -118,8 +118,8 @@ public class DirCacheResourceVariantTreeProviderTest { // conflict on file 1 : file 1 has three stages. // conflict on file 2, but was not in the base : only stage 2 and 3 - DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider( - repository, true); + DirCacheResourceVariantTreeProvider treeProvider = new DirCacheResourceVariantTreeProvider(repository, + true); assertTrue(treeProvider.getKnownResources().contains(iFile1)); assertTrue(treeProvider.getKnownResources().contains(iFile2)); @@ -133,8 +133,8 @@ public class DirCacheResourceVariantTreeProviderTest { assertTrue(treeProvider.getRemoteTree().hasResourceVariant(iFile2)); } - private void addToIndex(Repository repository, IFile file) throws CoreException, IOException, - NoFilepatternException, GitAPIException { + private void addToIndex(Repository repository, IFile file) + throws CoreException, IOException, NoFilepatternException, GitAPIException { String filePath = file.getProject().getName() + "/" + file.getProjectRelativePath(); //$NON-NLS-1$ Git git = new Git(repository); try { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/GitResourceVariantTreeSubscriberTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/GitResourceVariantTreeSubscriberTest.java index ceed9bc9e..bc71ef82a 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/GitResourceVariantTreeSubscriberTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/GitResourceVariantTreeSubscriberTest.java @@ -262,13 +262,13 @@ public class GitResourceVariantTreeSubscriberTest extends VariantsTestCase { repository.createBranch(MASTER, BASE); repository.createAndCheckoutBranch(MASTER, BRANCH); file2 = repository.createFile(iProject, "file2"); - repository - .appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "Creation of file2 in branch2."); + repository.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, + "Creation of file2 in branch2."); repository.checkoutBranch(MASTER); file1 = repository.createFile(iProject, "file1"); - repository - .appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "Creation of file1 in branch1."); + repository.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, + "Creation of file1 in branch1."); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); @@ -290,11 +290,11 @@ public class GitResourceVariantTreeSubscriberTest extends VariantsTestCase { private GitResourceVariantTreeProvider createTreeProviderWithDeletions() throws Exception { file1 = repository.createFile(iProject, "file1"); - repository - .appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "Creation of file1 in branch1."); + repository.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, + "Creation of file1 in branch1."); file2 = repository.createFile(iProject, "file2"); - repository - .appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "Creation of file2 in branch2."); + repository.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, + "Creation of file2 in branch2."); repository.createBranch(MASTER, BASE); repository.createAndCheckoutBranch(MASTER, BRANCH); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java index 0bd9bf1c9..5f39f29c3 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RemoteNewProjectTests.java @@ -105,8 +105,8 @@ public class RemoteNewProjectTests extends CompareTestCase { SystemReader.setInstance(mockSystemReader); final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); String gitRepoPath = workspaceRoot.getRawLocation().toFile() + File.separator + "repo"; - mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY, workspaceRoot.getLocation() - .toFile().getParentFile().getAbsoluteFile().toString()); + mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY, + workspaceRoot.getLocation().toFile().getParentFile().getAbsoluteFile().toString()); gitDir = new File(gitRepoPath, Constants.DOT_GIT); repository = new GitTestRepository(gitDir); repository.ignore(workspaceRoot.getRawLocation().append(".metadata").toFile()); @@ -115,8 +115,8 @@ public class RemoteNewProjectTests extends CompareTestCase { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider.getModelProviderDescriptor( - EMFModelProvider.PROVIDER_ID).getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); repository.dispose(); Activator.getDefault().getRepositoryCache().clear(); @@ -184,8 +184,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Add a new Package child2 under Package root. resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); EPackage child2 = createPackage(root, "child2"); save(resource1); @@ -209,8 +209,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 @@ -289,8 +289,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Change the name of the sub-package. resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); child = root.getESubpackages().get(0); child.setName("newChild"); @@ -315,8 +315,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 @@ -364,8 +364,8 @@ public class RemoteNewProjectTests extends CompareTestCase { repository.addAllAndCommit("1st-commit"); repository.createBranch(MASTER, BRANCH_1); - TestProject testProject2 = new TestProject("Project2", ResourcesPlugin.getWorkspace().getRoot() - .getLocation().toString()); + TestProject testProject2 = new TestProject("Project2", + ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()); IProject iProject2 = testProject2.getProject(); File file2 = testProject2.getOrCreateFile(iProject2, "file2.ecore"); IFile iFile2 = testProject2.getIFile(iProject2, file2); @@ -393,8 +393,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Add a new attribute under C1 resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); c1 = (EClass)root.getEClassifiers().get(0); EAttribute att1 = createAttribute(c1, "attribute1", null); @@ -419,10 +419,10 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); - resource2 = resourceSet.getResource(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); + resource2 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); assertEquals("parent", root.getName()); c1 = (EClass)root.getEClassifiers().get(0); @@ -451,8 +451,8 @@ public class RemoteNewProjectTests extends CompareTestCase { throws Exception { ResourceSetImpl resourceSet = new ResourceSetImpl(); File workingDirectory = repository.getRepository().getWorkTree(); - TestProject testProject1 = new TestProject("Project1", workingDirectory.getAbsolutePath() - + "/a/b/c/d/e/f/g/"); + TestProject testProject1 = new TestProject("Project1", + workingDirectory.getAbsolutePath() + "/a/b/c/d/e/f/g/"); IProject iProject = testProject1.getProject(); repository.connect(iProject); File file1 = testProject1.getOrCreateFile(iProject, "folder1/folder2/folder3/file1.ecore"); @@ -471,7 +471,8 @@ public class RemoteNewProjectTests extends CompareTestCase { repository.addAllAndCommit("1st-commit"); repository.createBranch(MASTER, BRANCH_1); - TestProject testProject2 = new TestProject("Project2", workingDirectory.getAbsolutePath() + "/h/i/j/"); + TestProject testProject2 = new TestProject("Project2", + workingDirectory.getAbsolutePath() + "/h/i/j/"); IProject iProject2 = testProject2.getProject(); repository.connect(iProject2); File file2 = testProject2.getOrCreateFile(iProject2, "folder1/folder2/folder3/folder4/file2.ecore"); @@ -523,8 +524,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 @@ -570,8 +571,8 @@ public class RemoteNewProjectTests extends CompareTestCase { repository.addAllAndCommit("1st-commit"); repository.createBranch(MASTER, BRANCH_1); - TestProject testProject2 = new TestProject("Project2", workingDirectory.getAbsolutePath() - + "/Project1/a/"); + TestProject testProject2 = new TestProject("Project2", + workingDirectory.getAbsolutePath() + "/Project1/a/"); IProject iProject2 = testProject2.getProject(); repository.connect(iProject2); File file2 = testProject2.getOrCreateFile(iProject2, "file2.ecore"); @@ -623,8 +624,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 @@ -705,8 +706,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Change the name of the sub-packages. resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); child1 = root.getESubpackages().get(0); child1.setName("newChild1"); @@ -735,8 +736,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(file22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); resource3 = resourceSet.getResource(URI.createFileURI(file3.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." @@ -829,8 +830,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Change the name of the sub-packages. resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); child1 = root.getESubpackages().get(0); child1.setName("newChild1"); @@ -861,8 +862,8 @@ public class RemoteNewProjectTests extends CompareTestCase { resourceSet.getResources().clear(); resource3 = resourceSet.getResource(URI.createFileURI(file3.getAbsolutePath()), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 resource2.setURI(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), true)); @@ -940,8 +941,8 @@ public class RemoteNewProjectTests extends CompareTestCase { // 3rd commit: // Change the name of the sub-package. resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); root = (EPackage)resource1.getContents().get(0); child = root.getESubpackages().get(0); child.setName("newChild"); @@ -963,8 +964,8 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(iFile22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); resource2 = resourceSet.getResource(URI.createFileURI(file2.getAbsolutePath()), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 @@ -1059,10 +1060,10 @@ public class RemoteNewProjectTests extends CompareTestCase { assertTrue(iFile22.exists()); // Check the contents resourceSet.getResources().clear(); - resource1 = resourceSet.getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), - true), true); - resource2 = resourceSet.getResource(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), - true), true); + resource1 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile1.getFullPath().toString(), true), true); + resource2 = resourceSet + .getResource(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), true), true); // The proxy of child element has the following form : "platform:/resource/..." // So we have to update the uri of the resource2 // resource2.setURI(URI.createPlatformResourceURI(iFile2.getFullPath().toString(), true)); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RenamedControlledResourceTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RenamedControlledResourceTests.java index 23c33bb7d..b0b3694a2 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RenamedControlledResourceTests.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/RenamedControlledResourceTests.java @@ -63,10 +63,10 @@ public class RenamedControlledResourceTests { assertTrue(iProject.getFile("file2_new.ecore").exists()); // Check the contents ResourceSet resourceSet = new ResourceSetImpl(); - Resource testRoot = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflicts/file1.ecore", true), true); - Resource testChild = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflicts/file2_new.ecore", true), true); + Resource testRoot = resourceSet + .getResource(URI.createPlatformResourceURI("/renameNoConflicts/file1.ecore", true), true); + Resource testChild = resourceSet + .getResource(URI.createPlatformResourceURI("/renameNoConflicts/file2_new.ecore", true), true); EPackage testRootPack = (EPackage)testRoot.getContents().get(0); assertEquals("parent", testRootPack.getName()); EPackage testChildPack = testRootPack.getESubpackages().get(0); @@ -91,10 +91,10 @@ public class RenamedControlledResourceTests { assertTrue(iProject.getFile("file2_new.ecore").exists()); // Check the contents ResourceSet resourceSet = new ResourceSetImpl(); - Resource testRoot = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflicts/file1.ecore", true), true); - Resource testChild = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflicts/file2_new.ecore", true), true); + Resource testRoot = resourceSet + .getResource(URI.createPlatformResourceURI("/renameNoConflicts/file1.ecore", true), true); + Resource testChild = resourceSet + .getResource(URI.createPlatformResourceURI("/renameNoConflicts/file2_new.ecore", true), true); EPackage testRootPack = (EPackage)testRoot.getContents().get(0); assertEquals("parent", testRootPack.getName()); EPackage testChildPack = testRootPack.getESubpackages().get(0); @@ -118,10 +118,10 @@ public class RenamedControlledResourceTests { assertTrue(iProject.getFile("file2_new.ecore").exists()); // Check the contents ResourceSet resourceSet = new ResourceSetImpl(); - Resource testRoot = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflictsLocalChanges/file1.ecore", true), true); - Resource testChild = resourceSet.getResource(URI.createPlatformResourceURI( - "/renameNoConflictsLocalChanges/file2_new.ecore", true), true); + Resource testRoot = resourceSet.getResource( + URI.createPlatformResourceURI("/renameNoConflictsLocalChanges/file1.ecore", true), true); + Resource testChild = resourceSet.getResource( + URI.createPlatformResourceURI("/renameNoConflictsLocalChanges/file2_new.ecore", true), true); EPackage testRootPack = (EPackage)testRoot.getContents().get(0); assertEquals("parent", testRootPack.getName()); EPackage testChildPack = testRootPack.getESubpackages().get(0); @@ -147,8 +147,8 @@ public class RenamedControlledResourceTests { // 2- renamed file2 to file2_new assertEquals(2, comparison.getDifferences().size()); assertEquals(1, size(filter(comparison.getDifferences(), instanceOf(ReferenceChange.class)))); - assertEquals(1, size(filter(comparison.getDifferences(), and( - instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); + assertEquals(1, size(filter(comparison.getDifferences(), + and(instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); } @GitCompare(localBranch = "branch", remoteBranch = "master", fileToCompare = "file1.ecore") @@ -163,8 +163,8 @@ public class RenamedControlledResourceTests { // 2- renamed file2 to file2_new assertEquals(2, comparison.getDifferences().size()); assertEquals(1, size(filter(comparison.getDifferences(), instanceOf(ReferenceChange.class)))); - assertEquals(1, size(filter(comparison.getDifferences(), and( - instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); + assertEquals(1, size(filter(comparison.getDifferences(), + and(instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); } @GitMerge(localBranch = "master", remoteBranch = "branch") @@ -194,13 +194,13 @@ public class RenamedControlledResourceTests { // 2 diffs: // 2- renamed file2 to file2_new (remote) and to file_other (local) assertEquals(2, comparison.getDifferences().size()); - assertEquals(2, size(filter(comparison.getDifferences(), and( - instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); + assertEquals(2, size(filter(comparison.getDifferences(), + and(instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); // 2 diffs in conflict assertEquals(2, comparison.getConflicts().get(0).getDifferences().size()); // Both a re resource location changes - assertEquals(2, size(filter(comparison.getConflicts().get(0).getDifferences(), and( - instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); + assertEquals(2, size(filter(comparison.getConflicts().get(0).getDifferences(), + and(instanceOf(ResourceAttachmentChange.class), ofKind(DifferenceKind.MOVE))))); } } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/ResourceVariantTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/ResourceVariantTest.java index b152d0010..5890ca3f1 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/ResourceVariantTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/ResourceVariantTest.java @@ -155,8 +155,8 @@ public class ResourceVariantTest extends VariantsTestCase { tw.addTree(walk.parseTree(baseId)); while (tw.next()) { - AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, tw.getTree(0, - CanonicalTreeParser.class), null); + AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, + tw.getTree(0, CanonicalTreeParser.class), null); assertEquals(tw.getObjectId(0).getName(), variant.getContentIdentifier()); assertEquals(tw.getObjectId(0), variant.getObjectId()); @@ -191,8 +191,8 @@ public class ResourceVariantTest extends VariantsTestCase { tw.addTree(walk.parseTree(baseId)); while (tw.next()) { - AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, tw.getTree(0, - CanonicalTreeParser.class), null); + AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, + tw.getTree(0, CanonicalTreeParser.class), null); assertEquals(tw.getObjectId(0).getName(), variant.getContentIdentifier()); assertEquals(tw.getObjectId(0), variant.getObjectId()); @@ -227,8 +227,8 @@ public class ResourceVariantTest extends VariantsTestCase { tw.addTree(walk.parseTree(baseId)); while (tw.next()) { - AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, tw.getTree(0, - CanonicalTreeParser.class), null); + AbstractGitResourceVariant variant = TreeParserResourceVariant.create(repo, + tw.getTree(0, CanonicalTreeParser.class), null); assertEquals(tw.getObjectId(0).getName(), variant.getContentIdentifier()); assertEquals(tw.getObjectId(0), variant.getObjectId()); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/StrategyRecursiveModelTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/StrategyRecursiveModelTest.java index 837911195..3be7a0c20 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/StrategyRecursiveModelTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/merge/StrategyRecursiveModelTest.java @@ -38,7 +38,8 @@ import org.junit.Test; * <ol> * <li><code>org.eclipse.core.resources.modelProviders</code>: SampleModelProvider provides logical models for * <code>*.sample</code> files and the</li> - * <li><code>org.eclipse.core.runtime.adapters</code>: SampleModelProvider adapts to IResourceMappingMerger</li> + * <li><code>org.eclipse.core.runtime.adapters</code>: SampleModelProvider adapts to IResourceMappingMerger + * </li> * </ol> * * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> @@ -84,8 +85,8 @@ public class StrategyRecursiveModelTest extends ModelTestCase { } // Select strategy recursive as preferred strategy - InstanceScope.INSTANCE.getNode(Activator.getPluginId()).put( - GitCorePreferences.core_preferredMergeStrategy, "model recursive"); //$NON-NLS-1$ + InstanceScope.INSTANCE.getNode(Activator.getPluginId()) + .put(GitCorePreferences.core_preferredMergeStrategy, "model recursive"); //$NON-NLS-1$ } @After diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/ModelTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/ModelTestCase.java index 07027fcf4..e3fb6e4a8 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/ModelTestCase.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/ModelTestCase.java @@ -42,8 +42,8 @@ public abstract class ModelTestCase extends CompareGitTestCase { public void setUp() throws Exception {
super.setUp();
- IContentType textType = Platform.getContentTypeManager().getContentType(
- "org.eclipse.core.runtime.text"); //$NON-NLS-1$
+ IContentType textType = Platform.getContentTypeManager()
+ .getContentType("org.eclipse.core.runtime.text"); //$NON-NLS-1$
textType.addFileSpec(SAMPLE_FILE_EXTENSION, IContentType.FILE_EXTENSION_SPEC);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/SampleResourceMapping.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/SampleResourceMapping.java index 1ded45ba7..f44f2290c 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/SampleResourceMapping.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/models/SampleResourceMapping.java @@ -55,8 +55,8 @@ public class SampleResourceMapping extends ResourceMapping { }
}
final IResource[] resourceArray = sampleSiblings.toArray(new IResource[sampleSiblings.size()]);
- return new ResourceTraversal[] {new ResourceTraversal(resourceArray, IResource.DEPTH_ONE,
- IResource.NONE), };
+ return new ResourceTraversal[] {
+ new ResourceTraversal(resourceArray, IResource.DEPTH_ONE, IResource.NONE), };
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java index 1b126a69f..3e49bbba2 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/GitTests.java @@ -40,32 +40,24 @@ import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) -@SuiteClasses({ - DirCacheResourceVariantTreeProviderTest.class, +@SuiteClasses({DirCacheResourceVariantTreeProviderTest.class, // GitLogicalMergeTest.class, // GitLogicalMergeWithCustomDependenciesTest.class, GitLogicalModelTest.class, // GitMergeTest.class, - GitResourceVariantTreeSubscriberTest.class, - IncomingMultiEReferenceTest.class, - IncomingSingleEReferenceOldSerializationTest.class, - IncomingSingleEReferenceTest.class, - OutgoingSingleEReferenceOldSerializationTest.class, - OutgoingSingleEReferenceTest.class, + GitResourceVariantTreeSubscriberTest.class, IncomingMultiEReferenceTest.class, + IncomingSingleEReferenceOldSerializationTest.class, IncomingSingleEReferenceTest.class, + OutgoingSingleEReferenceOldSerializationTest.class, OutgoingSingleEReferenceTest.class, OutgoingMultiEReferenceTest.class, // ModelResolverLocalTest.class, // ModelResolverRemoteTest.class, // MovedImplicitResourceAmongChangedResourcesTest.class, // RenamedControlledResourceTests.class, // RemoteNewProjectTests.class, - ResourceVariantTest.class, - ResourceUtilPathTest.class, - RevisionedURIConverterTest.class, + ResourceVariantTest.class, ResourceUtilPathTest.class, RevisionedURIConverterTest.class, // StrategyRecursiveModelTest.class, // StrategyRecursiveModelWithDeepProjectTest.class, - ThreadedModelResolverResolutionTest.class, - TreeWalkResourceVariantTreeProviderTest.class, -}) + ThreadedModelResolverResolutionTest.class, TreeWalkResourceVariantTreeProviderTest.class, }) public class GitTests { /** * Launches the test with the given arguments. diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractGitLogicalModelTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractGitLogicalModelTest.java index 55c53c1ac..c1765302c 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractGitLogicalModelTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractGitLogicalModelTest.java @@ -47,7 +47,7 @@ public class AbstractGitLogicalModelTest extends CompareGitTestCase { private ResourceSet resourceSet; protected IProject iProject; - + public AbstractGitLogicalModelTest() { super(); } @@ -70,19 +70,19 @@ public class AbstractGitLogicalModelTest extends CompareGitTestCase { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider.getModelProviderDescriptor( - EMFModelProvider.PROVIDER_ID).getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); super.tearDown(); } - + protected Resource createAndConnectResource(String fileName) throws Exception { final File file = project.getOrCreateFile(iProject, fileName); final IFile iFile = project.getIFile(iProject, file); return connectResource(iFile, resourceSet); } - - protected File getFile(String fileName) throws Exception{ + + protected File getFile(String fileName) throws Exception { return project.getOrCreateFile(iProject, fileName); } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractURITest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractURITest.java index 730cc32a1..27ce45a64 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractURITest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/AbstractURITest.java @@ -65,17 +65,15 @@ public class AbstractURITest extends CompareGitTestCase { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider) ModelProvider - .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID) - .getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); super.tearDown(); } /** - * We'll create a repo with a single file and three commits such as there's - * an initial commit, one more commit on master, then one commit on a branch - * starting from the initial one. + * We'll create a repo with a single file and three commits such as there's an initial commit, one more + * commit on master, then one commit on a branch starting from the initial one. * * <pre> * initial commit -> master @@ -102,9 +100,9 @@ public class AbstractURITest extends CompareGitTestCase { repository.checkoutBranch(BRANCH); reload(resource1); - root1 = (EPackage) findObject(resource1, "P1"); - class1 = (EClass) findObject(resource1, "C1"); - class2 = (EClass) findObject(resource1, "C2"); + root1 = (EPackage)findObject(resource1, "P1"); + class1 = (EClass)findObject(resource1, "C1"); + class2 = (EClass)findObject(resource1, "C2"); class1.getESuperTypes().add(class2); createClass(root1, "C3"); @@ -118,9 +116,8 @@ public class AbstractURITest extends CompareGitTestCase { } /** - * We'll create a repo with a single file and multiple commits such as there - * are multiple commits in-between the compared one and the expected common - * ancestor. + * We'll create a repo with a single file and multiple commits such as there are multiple commits + * in-between the compared one and the expected common ancestor. * * <pre> * initial commit -> commit-master-1 -> commit-master-2 -> commit-master-3 @@ -128,8 +125,7 @@ public class AbstractURITest extends CompareGitTestCase { * \-> commit-branch2-1 * </pre> */ - protected void setupMultipleCommitsRepo(String branch1Name, - String branch2Name) throws Exception { + protected void setupMultipleCommitsRepo(String branch1Name, String branch2Name) throws Exception { EPackage root1 = createPackage(null, "P1"); EClass class1 = createClass(root1, "C1"); resource1.getContents().add(root1); @@ -154,8 +150,8 @@ public class AbstractURITest extends CompareGitTestCase { repository.checkoutBranch(branch1Name); reload(resource1); - class1 = (EClass) findObject(resource1, "C1"); - class2 = (EClass) findObject(resource1, "C2"); + class1 = (EClass)findObject(resource1, "C1"); + class2 = (EClass)findObject(resource1, "C2"); class1.getESuperTypes().add(class2); save(resource1); repository.addAndCommit(project, "commit-branch1-1", file1); @@ -170,7 +166,7 @@ public class AbstractURITest extends CompareGitTestCase { repository.checkoutBranch(branch2Name); reload(resource1); - root1 = (EPackage) findObject(resource1, "P1"); + root1 = (EPackage)findObject(resource1, "P1"); createClass(root1, "C3"); save(resource1); repository.addAndCommit(project, "commit-branch2-1", file1); @@ -181,76 +177,70 @@ public class AbstractURITest extends CompareGitTestCase { assertFalse(status.hasUncommittedChanges()); } - protected void assertStateInitial(URI fileURI, - IStorageProviderAccessor accessor, DiffSide side) throws Exception { + protected void assertStateInitial(URI fileURI, IStorageProviderAccessor accessor, DiffSide side) + throws Exception { URIConverter delegate = new ExtensibleURIConverterImpl(); - RevisionedURIConverter converter = new RevisionedURIConverter(delegate, - accessor, side); - InputStream stream = converter.createInputStream(fileURI, - Collections.emptyMap()); + RevisionedURIConverter converter = new RevisionedURIConverter(delegate, accessor, side); + InputStream stream = converter.createInputStream(fileURI, Collections.emptyMap()); ResourceSet tmpSet = new ResourceSetImpl(); Resource tmpResource = tmpSet.createResource(fileURI); tmpResource.load(stream, Collections.emptyMap()); assertEquals(1, tmpResource.getContents().size()); assertTrue(tmpResource.getContents().get(0) instanceof EPackage); - EPackage tmpPack = (EPackage) tmpResource.getContents().get(0); + EPackage tmpPack = (EPackage)tmpResource.getContents().get(0); assertEquals("P1", tmpPack.getName()); assertEquals(2, tmpPack.eContents().size()); assertTrue(tmpPack.eContents().get(0) instanceof EClass); assertTrue(tmpPack.eContents().get(1) instanceof EClass); - EClass tmpClass = (EClass) tmpPack.eContents().get(0); + EClass tmpClass = (EClass)tmpPack.eContents().get(0); assertEquals("C1", tmpClass.getName()); assertTrue(tmpClass.eContents().isEmpty()); - tmpClass = (EClass) tmpPack.eContents().get(1); + tmpClass = (EClass)tmpPack.eContents().get(1); assertEquals("C2", tmpClass.getName()); assertTrue(tmpClass.eContents().isEmpty()); } - protected void assertStateMaster(URI fileURI, - IStorageProviderAccessor accessor, DiffSide side) throws Exception { + protected void assertStateMaster(URI fileURI, IStorageProviderAccessor accessor, DiffSide side) + throws Exception { URIConverter delegate = new ExtensibleURIConverterImpl(); - RevisionedURIConverter converter = new RevisionedURIConverter(delegate, - accessor, side); - InputStream stream = converter.createInputStream(fileURI, - Collections.emptyMap()); + RevisionedURIConverter converter = new RevisionedURIConverter(delegate, accessor, side); + InputStream stream = converter.createInputStream(fileURI, Collections.emptyMap()); ResourceSet tmpSet = new ResourceSetImpl(); Resource tmpResource = tmpSet.createResource(fileURI); tmpResource.load(stream, Collections.emptyMap()); assertEquals(1, tmpResource.getContents().size()); assertTrue(tmpResource.getContents().get(0) instanceof EPackage); - EPackage tmpPack = (EPackage) tmpResource.getContents().get(0); + EPackage tmpPack = (EPackage)tmpResource.getContents().get(0); assertEquals("P1", tmpPack.getName()); assertEquals(1, tmpPack.eContents().size()); assertTrue(tmpPack.eContents().get(0) instanceof EClass); - EClass tmpClass = (EClass) tmpPack.eContents().get(0); + EClass tmpClass = (EClass)tmpPack.eContents().get(0); assertEquals("C1_renamed", tmpClass.getName()); assertTrue(tmpClass.eContents().isEmpty()); } - protected void assertStateBranch(URI fileURI, - IStorageProviderAccessor accessor, DiffSide side) throws Exception { + protected void assertStateBranch(URI fileURI, IStorageProviderAccessor accessor, DiffSide side) + throws Exception { URIConverter delegate = new ExtensibleURIConverterImpl(); - RevisionedURIConverter converter = new RevisionedURIConverter(delegate, - accessor, side); - InputStream stream = converter.createInputStream(fileURI, - Collections.emptyMap()); + RevisionedURIConverter converter = new RevisionedURIConverter(delegate, accessor, side); + InputStream stream = converter.createInputStream(fileURI, Collections.emptyMap()); ResourceSet tmpSet = new ResourceSetImpl(); Resource tmpResource = tmpSet.createResource(fileURI); tmpResource.load(stream, Collections.emptyMap()); assertEquals(1, tmpResource.getContents().size()); assertTrue(tmpResource.getContents().get(0) instanceof EPackage); - EPackage tmpPack = (EPackage) tmpResource.getContents().get(0); + EPackage tmpPack = (EPackage)tmpResource.getContents().get(0); assertEquals("P1", tmpPack.getName()); assertEquals(3, tmpPack.eContents().size()); assertTrue(tmpPack.eContents().get(0) instanceof EClass); assertTrue(tmpPack.eContents().get(1) instanceof EClass); assertTrue(tmpPack.eContents().get(2) instanceof EClass); - EClass tmpClass1 = (EClass) tmpPack.eContents().get(0); - EClass tmpClass2 = (EClass) tmpPack.eContents().get(1); - EClass tmpClass3 = (EClass) tmpPack.eContents().get(2); + EClass tmpClass1 = (EClass)tmpPack.eContents().get(0); + EClass tmpClass2 = (EClass)tmpPack.eContents().get(1); + EClass tmpClass3 = (EClass)tmpPack.eContents().get(2); assertEquals("C1", tmpClass1.getName()); assertEquals(1, tmpClass1.eContents().size()); assertTrue(tmpClass1.eContents().get(0) instanceof EGenericType); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeTest.java index 8c2da6590..c7fff5d57 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeTest.java @@ -37,7 +37,8 @@ public class GitLogicalMergeTest extends AbstractGitLogicalModelTest { /** * Sets up the repository so that there are three commits affecting a single file. * <ul> - * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2.</li> + * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2. + * </li> * <li>master commit : delete C2</li> * <li>branch commit : make C2 a super-class of C1</li> * </ul> @@ -89,7 +90,8 @@ public class GitLogicalMergeTest extends AbstractGitLogicalModelTest { /** * Sets up the repository so that there are three commits affecting a single file. * <ul> - * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2.</li> + * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2. + * </li> * <li>master commit : rename C1 into C10</li> * <li>branch commit : make C2 a super-class of C1</li> * </ul> @@ -143,7 +145,8 @@ public class GitLogicalMergeTest extends AbstractGitLogicalModelTest { /** * Sets up the repository so that there are three commits affecting a single file. * <ul> - * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2.</li> + * <li>initial commit : A single file "file1" contains a package P1 which contains the classes C1 and C2. + * </li> * <li>master commit : delete C2</li> * <li>branch commit : delete C2</li> * </ul> diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeWithCustomDependenciesTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeWithCustomDependenciesTest.java index dc4377f6e..acf2b677b 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeWithCustomDependenciesTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalMergeWithCustomDependenciesTest.java @@ -142,8 +142,8 @@ public class GitLogicalMergeWithCustomDependenciesTest extends AbstractGitLogica repository.addAndCommit(project, "branch-commit", dependentFile, file1); // install mock dependency provider - installMockModelDependencyProvider(ImmutableMap.of(file1.getName(), ImmutableSet - .of(DEPENDENT_FILE_NAME))); + installMockModelDependencyProvider( + ImmutableMap.of(file1.getName(), ImmutableSet.of(DEPENDENT_FILE_NAME))); // checkout master and merge branch repository.checkoutBranch(MASTER); @@ -194,7 +194,8 @@ public class GitLogicalMergeWithCustomDependenciesTest extends AbstractGitLogica } private void assertCorrectMergingIfRemoteBranchDeletesUnlinkedButDependentFile( - final Collection<EObject> contentsOfDeletedResource) throws IOException, CoreException, Exception { + final Collection<EObject> contentsOfDeletedResource) + throws IOException, CoreException, Exception { // add another dependent file and commit state as common ancestor commit save(createResourceWithContents(DEPENDENT_FILE_NAME, contentsOfDeletedResource)); repository.addAllAndCommit("initial-commit"); @@ -220,8 +221,8 @@ public class GitLogicalMergeWithCustomDependenciesTest extends AbstractGitLogica repository.addAndCommit(project, "branch-commit", file1, dependentFile); // install mock dependency provider - installMockModelDependencyProvider(ImmutableMap.of(file1.getName(), ImmutableSet - .of(DEPENDENT_FILE_NAME))); + installMockModelDependencyProvider( + ImmutableMap.of(file1.getName(), ImmutableSet.of(DEPENDENT_FILE_NAME))); // checkout master and merge branch repository.checkoutBranch(MASTER); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitMergeTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitMergeTest.java index 02242fe83..e9d6429f1 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitMergeTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitMergeTest.java @@ -36,9 +36,9 @@ public class GitMergeTest extends AbstractGitLogicalModelTest { * <li>BRANCH commit: deletes C1 and adds a new class C3.</li> * </ul> * <p> - * Checked out is MASTER and the branch BRANCH is to be merged in MASTER. The merge should not finish - * due to conflicts, but the non-conflicting differences should be successfully merged (classes C2 and - * C3 should both be present in the model after the merge). + * Checked out is MASTER and the branch BRANCH is to be merged in MASTER. The merge should not finish due + * to conflicts, but the non-conflicting differences should be successfully merged (classes C2 and C3 + * should both be present in the model after the merge). * </p> * * @throws Exception @@ -46,50 +46,50 @@ public class GitMergeTest extends AbstractGitLogicalModelTest { */ private void setup001() throws Exception { - // initial commit - EPackage ePackage = createPackage(null, "P1"); - EClass class1 = createClass(ePackage, "C1"); - resource1.getContents().add(ePackage); - save(resource1); - repository.addAllAndCommit("initial-commit"); + // initial commit + EPackage ePackage = createPackage(null, "P1"); + EClass class1 = createClass(ePackage, "C1"); + resource1.getContents().add(ePackage); + save(resource1); + repository.addAllAndCommit("initial-commit"); - // create new branch, but stay on MASTER - repository.createBranch(MASTER, BRANCH); + // create new branch, but stay on MASTER + repository.createBranch(MASTER, BRANCH); - // master commit - createClass(ePackage, "C2"); - class1.setName("C1new"); - save(resource1); - repository.addAllAndCommit("update-C1-add-C2"); + // master commit + createClass(ePackage, "C2"); + class1.setName("C1new"); + save(resource1); + repository.addAllAndCommit("update-C1-add-C2"); - // branch commit - repository.checkoutBranch(BRANCH); - reload(resource1); - ePackage = (EPackage)findObject(resource1, "P1"); - class1 = (EClass)findObject(resource1, "C1"); - ePackage.getEClassifiers().remove(class1); - createClass(ePackage, "C3"); - save(resource1); - repository.addAllAndCommit("remove-C1-add-C3"); + // branch commit + repository.checkoutBranch(BRANCH); + reload(resource1); + ePackage = (EPackage)findObject(resource1, "P1"); + class1 = (EClass)findObject(resource1, "C1"); + ePackage.getEClassifiers().remove(class1); + createClass(ePackage, "C3"); + save(resource1); + repository.addAllAndCommit("remove-C1-add-C3"); - // back on master - repository.checkoutBranch(MASTER); - reload(resource1); + // back on master + repository.checkoutBranch(MASTER); + reload(resource1); } @Test public void merge001() throws Exception { - setup001(); + setup001(); - repository.mergeLogical(BRANCH); - reload(resource1); + repository.mergeLogical(BRANCH); + reload(resource1); - Status status = repository.status(); - Set<String> conflicting = status.getConflicting(); - assertEquals(1, conflicting.size()); - assertNotNull(findObject(resource1, "C1new")); - assertNotNull(findObject(resource1, "C2")); - assertNotNull(findObject(resource1, "C3")); + Status status = repository.status(); + Set<String> conflicting = status.getConflicting(); + assertEquals(1, conflicting.size()); + assertNotNull(findObject(resource1, "C1new")); + assertNotNull(findObject(resource1, "C2")); + assertNotNull(findObject(resource1, "C3")); } } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/LocalResolutionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/LocalResolutionTest.java index 8a0889585..ddf02e368 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/LocalResolutionTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/LocalResolutionTest.java @@ -102,8 +102,8 @@ public abstract class LocalResolutionTest extends LogicalModelGraphTest { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider.getModelProviderDescriptor( - EMFModelProvider.PROVIDER_ID).getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); setResolutionScope(originalResolutionScope); iFile1 = null; diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java index 81b572818..ecd261171 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java @@ -98,8 +98,8 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider.getModelProviderDescriptor( - EMFModelProvider.PROVIDER_ID).getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); setResolutionScope(originalResolutionScope); iFile1 = null; @@ -200,7 +200,8 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1, iFile2)); Set<IStorage> expectedTraversal = storageSet(iFile1, iFile2); - ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, Diagnostic.ERROR); + ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, + Diagnostic.ERROR); for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER)) { setResolutionScope(scope); @@ -468,7 +469,8 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1, iFile2)); Set<IStorage> expectedTraversal = storageSet(iFile1, iFile2); - ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, Diagnostic.ERROR); + ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, + Diagnostic.ERROR); setResolutionScope(WORKSPACE); resolveAndCheckResult(files, expectedResult, expectedResult); @@ -773,7 +775,8 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1, iFile2, iFile3)); Set<IStorage> expectedTraversal = storageSet(iFile1, iFile2, iFile3); - ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, Diagnostic.ERROR); + ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, + Diagnostic.ERROR); for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER)) { setResolutionScope(scope); @@ -1275,7 +1278,8 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1, iFile2, iFile3)); Set<IStorage> expectedTraversal = storageSet(iFile1, iFile2, iFile3); - ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, Diagnostic.ERROR); + ExpectedResult expectedResult = new ExpectedResult(expectedGraph, expectedTraversal, + Diagnostic.ERROR); setResolutionScope(WORKSPACE); resolveAndCheckResult(files, expectedResult, expectedResult, expectedResult); @@ -1519,14 +1523,14 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<IStorage> expectedFile2Traversal = storageSet(iFile2); Set<IStorage> expectedFile3Traversal = storageSet(iFile3); Set<IStorage> expectedFile4Traversal = storageSet(iFile4); - ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Or2Graph, - expectedFile1Traversal, Diagnostic.OK); - ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile1Or2Graph, - expectedFile2Traversal, Diagnostic.OK); - ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Or4Graph, - expectedFile3Traversal, Diagnostic.ERROR); - ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile3Or4Graph, - expectedFile4Traversal, Diagnostic.ERROR); + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Or2Graph, expectedFile1Traversal, + Diagnostic.OK); + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile1Or2Graph, expectedFile2Traversal, + Diagnostic.OK); + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Or4Graph, expectedFile3Traversal, + Diagnostic.ERROR); + ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile3Or4Graph, expectedFile4Traversal, + Diagnostic.ERROR); for (CrossReferenceResolutionScope scope : Arrays.asList(PROJECT, CONTAINER)) { setResolutionScope(scope); @@ -1654,14 +1658,14 @@ public class ModelResolverLocalTest extends LogicalModelGraphTest { Set<IStorage> expectedFile2Traversal = storageSet(iFile2); Set<IStorage> expectedFile3Traversal = storageSet(iFile3); Set<IStorage> expectedFile4Traversal = storageSet(iFile4); - ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Or2Graph, - expectedFile1Traversal, Diagnostic.OK); - ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile1Or2Graph, - expectedFile2Traversal, Diagnostic.OK); - ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Or4Graph, - expectedFile3Traversal, Diagnostic.OK); - ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile3Or4Graph, - expectedFile4Traversal, Diagnostic.OK); + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Or2Graph, expectedFile1Traversal, + Diagnostic.OK); + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile1Or2Graph, expectedFile2Traversal, + Diagnostic.OK); + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Or4Graph, expectedFile3Traversal, + Diagnostic.OK); + ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile3Or4Graph, expectedFile4Traversal, + Diagnostic.OK); for (CrossReferenceResolutionScope scope : Arrays.asList(PROJECT, CONTAINER)) { setResolutionScope(scope); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java index a25ea9f4d..22bded42a 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java @@ -111,12 +111,9 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { @Override @Before public void setUp() throws Exception { - final IPreferenceStore store = EMFCompareIDEUIPlugin.getDefault() - .getPreferenceStore(); - final String stringValue = store - .getString(EMFCompareUIPreferences.RESOLUTION_SCOPE_PREFERENCE); - originalResolutionScope = CrossReferenceResolutionScope - .valueOf(stringValue); + final IPreferenceStore store = EMFCompareIDEUIPlugin.getDefault().getPreferenceStore(); + final String stringValue = store.getString(EMFCompareUIPreferences.RESOLUTION_SCOPE_PREFERENCE); + originalResolutionScope = CrossReferenceResolutionScope.valueOf(stringValue); project2 = new TestProject(PROJECT2_NAME); @@ -126,9 +123,8 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { @Override @After public void tearDown() throws Exception { - final EMFModelProvider emfModelProvider = (EMFModelProvider) ModelProvider - .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID) - .getModelProvider(); + final EMFModelProvider emfModelProvider = (EMFModelProvider)ModelProvider + .getModelProviderDescriptor(EMFModelProvider.PROVIDER_ID).getModelProvider(); emfModelProvider.clear(); setResolutionScope(originalResolutionScope); iFile1 = null; @@ -153,15 +149,13 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { resource2.getContents().add(createBasicModel(FILE2_SUFFIX)); save(resourceSet); - initialCommit = repository.addAllAndCommit("initial-commit").getId() - .getName(); + initialCommit = repository.addAllAndCommit("initial-commit").getId().getName(); makeCrossReference(resource1, resource2); save(resourceSet); // force a little diff in file2 so that git thinks it's not in sync. addWhiteLine(iFile2); - targetCommit = repository.addAllAndCommit("first-commit").getId() - .getName(); + targetCommit = repository.addAllAndCommit("first-commit").getId().getName(); final Status status = repository.status(); assertFalse(status.hasUncommittedChanges()); @@ -176,92 +170,70 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { List<IFile> files = setUpCase1(); assertEquals(2, files.size()); - Set<? extends Set<URI>> expectedGraph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2)); + Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedGraph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedGraph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedGraph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedGraph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); - for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, - PROJECT, CONTAINER)) { + for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER)) { setResolutionScope(scope); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result); } } - + @Test public void test_case1_outgoing() throws Exception { List<IFile> files = setUpCase1(); assertEquals(2, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2)); + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2)); + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(OUTGOING); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result); } - + @Test public void test_case1_self() throws Exception { List<IFile> files = setUpCase1(); assertEquals(2, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2)); + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1)); + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile1)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(SELF); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result); } - + private List<IFile> setUpCase2() throws Exception { final IProject iProject = project.getProject(); final ResourceSet resourceSet = new ResourceSetImpl(); @@ -274,22 +246,20 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { resource2.getContents().add(createBasicModel(FILE2_SUFFIX)); save(resourceSet); - initialCommit = repository.addAllAndCommit("initial-commit").getId() - .getName(); - + initialCommit = repository.addAllAndCommit("initial-commit").getId().getName(); + final File file1 = project.getOrCreateFile(iProject, FILE1_NAME); iFile1 = project.getIFile(iProject, file1); - + final Resource resource1 = connectResource(iFile1, resourceSet); - + resource1.getContents().add(createBasicModel(FILE1_SUFFIX)); makeCrossReference(resource1, resource2); save(resourceSet); // force a little diff in file2 so that git thinks it's not in sync. addWhiteLine(iFile2); - targetCommit = repository.addAllAndCommit("first-commit").getId() - .getName(); + targetCommit = repository.addAllAndCommit("first-commit").getId().getName(); final Status status = repository.status(); assertFalse(status.hasUncommittedChanges()); @@ -298,37 +268,31 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { return Arrays.asList(iFile1, iFile2); } - + @Test public void test_case2_workspace_project_container_outgoing_self() throws Exception { List<IFile> files = setUpCase2(); assertEquals(2, files.size()); - - Set<? extends Set<URI>> expectedGraph = ImmutableSet.of( - uriSet(iFile2)); - StorageTraversal expectedTraversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); + Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile2)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedGraph, expectedTraversal, + StorageTraversal expectedTraversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); + + ExpectedResult expectedFile1Result = new ExpectedResult(expectedGraph, expectedTraversal, expectedTraversal, expectedTraversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedGraph, expectedTraversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedGraph, expectedTraversal, expectedTraversal, expectedTraversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); - for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, - PROJECT, CONTAINER, OUTGOING, SELF)) { + for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER, OUTGOING, + SELF)) { setResolutionScope(scope); // File1 is not present locally, so we can't start the resolution from there - resolveAndCheckResult(accessor, Arrays.asList(iFile2), expectedFile1Result, - expectedFile2Result); + resolveAndCheckResult(accessor, Arrays.asList(iFile2), expectedFile1Result, expectedFile2Result); } } - + private List<IFile> setUpCase3() throws Exception { final IProject iProject = project.getProject(); final ResourceSet resourceSet = new ResourceSetImpl(); @@ -347,20 +311,18 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { resource1.getContents().add(createBasicModel(FILE1_SUFFIX)); resource2.getContents().add(createBasicModel(FILE2_SUFFIX)); resource3.getContents().add(createBasicModel(FILE3_SUFFIX)); - + makeCrossReference(resource2, resource3); save(resourceSet); - initialCommit = repository.addAllAndCommit("initial-commit").getId() - .getName(); - + initialCommit = repository.addAllAndCommit("initial-commit").getId().getName(); + makeCrossReference(resource1, resource2); save(resourceSet); // force a little diff in file2 and file3 so that git thinks they're not in sync. addWhiteLine(iFile2); addWhiteLine(iFile3); - targetCommit = repository.addAllAndCommit("first-commit").getId() - .getName(); + targetCommit = repository.addAllAndCommit("first-commit").getId().getName(); final Status status = repository.status(); assertFalse(status.hasUncommittedChanges()); @@ -369,112 +331,87 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { return Arrays.asList(iFile1, iFile2, iFile3); } - + @Test public void test_case3_workspace_project_container() throws Exception { List<IFile> files = setUpCase3(); assertEquals(3, files.size()); - Set<? extends Set<URI>> expectedGraph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2, iFile3)); + Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2, iFile3)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2, iFile3)); - StorageTraversal expectedFile2Or3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2, iFile3)); + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2, iFile3)); + StorageTraversal expectedFile2Or3Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile2, iFile3)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedGraph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedGraph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Or3Result = new ExpectedResult( - expectedGraph, expectedFile2Or3Traversal, + ExpectedResult expectedFile2Or3Result = new ExpectedResult(expectedGraph, expectedFile2Or3Traversal, expectedFile2Or3Traversal, expectedFile2Or3Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); - for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, - PROJECT, CONTAINER)) { + for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER)) { setResolutionScope(scope); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Or3Result, expectedFile2Or3Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Or3Result, + expectedFile2Or3Result); } } - + @Test public void test_case3_outgoing() throws Exception { List<IFile> files = setUpCase3(); assertEquals(3, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2, iFile3)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2, iFile3)); - Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of( - uriSet(iFile3)); - - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2, iFile3)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2, iFile3)); - StorageTraversal expectedFile3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile3)); - - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2, iFile3)); + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2, iFile3)); + Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of(uriSet(iFile3)); + + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2, iFile3)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile2, iFile3)); + StorageTraversal expectedFile3Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile3)); + + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - ExpectedResult expectedFile3Result = new ExpectedResult( - expectedFile3Graph, expectedFile3Traversal, + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Graph, expectedFile3Traversal, expectedFile3Traversal, expectedFile3Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(OUTGOING); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result, expectedFile3Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result, expectedFile3Result); } - + @Test public void test_case3_self() throws Exception { List<IFile> files = setUpCase3(); assertEquals(3, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2)); - Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of( - uriSet(iFile3)); - - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); - StorageTraversal expectedFile3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile3)); - - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1)); + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2)); + Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of(uriSet(iFile3)); + + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile1)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); + StorageTraversal expectedFile3Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile3)); + + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - ExpectedResult expectedFile3Result = new ExpectedResult( - expectedFile3Graph, expectedFile3Traversal, + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Graph, expectedFile3Traversal, expectedFile3Traversal, expectedFile3Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(SELF); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result, expectedFile3Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result, expectedFile3Result); } - + private List<IFile> setUpCase4() throws Exception { final IProject iProject = project.getProject(); final ResourceSet resourceSet = new ResourceSetImpl(); @@ -497,21 +434,19 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { resource2.getContents().add(createBasicModel(FILE2_SUFFIX)); resource3.getContents().add(createBasicModel(FILE3_SUFFIX)); resource4.getContents().add(createBasicModel(FILE4_SUFFIX)); - + makeCrossReference(resource2, resource3); save(resourceSet); - initialCommit = repository.addAllAndCommit("initial-commit").getId() - .getName(); - + initialCommit = repository.addAllAndCommit("initial-commit").getId().getName(); + makeCrossReference(resource1, resource2); makeCrossReference(resource3, resource4); save(resourceSet); // force a little diff in file2 and file4 so that git thinks they're not in sync. addWhiteLine(iFile2); addWhiteLine(iFile4); - targetCommit = repository.addAllAndCommit("first-commit").getId() - .getName(); + targetCommit = repository.addAllAndCommit("first-commit").getId().getName(); final Status status = repository.status(); assertFalse(status.hasUncommittedChanges()); @@ -520,158 +455,120 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { return Arrays.asList(iFile1, iFile2, iFile3, iFile4); } - + @Test public void test_case4_workspace_project_container() throws Exception { List<IFile> files = setUpCase4(); assertEquals(4, files.size()); - Set<? extends Set<URI>> expectedGraph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2, iFile3), uriSet(iFile4)); + Set<? extends Set<URI>> expectedGraph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2, iFile3), + uriSet(iFile4)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2, iFile3, iFile4)); - StorageTraversal expectedFile2Or3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2, iFile3, iFile4)); - StorageTraversal expectedFile4Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile4)); + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2, iFile3, iFile4)); + StorageTraversal expectedFile2Or3Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile2, iFile3, iFile4)); + StorageTraversal expectedFile4Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile4)); - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedGraph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedGraph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Or3Result = new ExpectedResult( - expectedGraph, expectedFile2Or3Traversal, + ExpectedResult expectedFile2Or3Result = new ExpectedResult(expectedGraph, expectedFile2Or3Traversal, expectedFile2Or3Traversal, expectedFile2Or3Traversal); - ExpectedResult expectedFile4Result = new ExpectedResult( - expectedGraph, expectedFile4Traversal, + ExpectedResult expectedFile4Result = new ExpectedResult(expectedGraph, expectedFile4Traversal, expectedFile4Traversal, expectedFile4Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); - for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, - PROJECT, CONTAINER)) { + for (CrossReferenceResolutionScope scope : Arrays.asList(WORKSPACE, PROJECT, CONTAINER)) { setResolutionScope(scope); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Or3Result, expectedFile2Or3Result, - expectedFile4Result); + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Or3Result, + expectedFile2Or3Result, expectedFile4Result); } } - + @Test public void test_case4_outgoing() throws Exception { List<IFile> files = setUpCase4(); assertEquals(4, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1), uriSet(iFile2, iFile3), uriSet(iFile4)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2, iFile3), uriSet(iFile4)); - Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of( - uriSet(iFile3), uriSet(iFile4)); - Set<? extends Set<URI>> expectedFile4Graph = ImmutableSet.of( + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1), uriSet(iFile2, iFile3), uriSet(iFile4)); - - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1, iFile2, iFile3, iFile4)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2, iFile3, iFile4)); - StorageTraversal expectedFile3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile3, iFile4)); - StorageTraversal expectedFile4Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile4)); - - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2, iFile3), uriSet(iFile4)); + Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of(uriSet(iFile3), uriSet(iFile4)); + Set<? extends Set<URI>> expectedFile4Graph = ImmutableSet.of(uriSet(iFile4)); + + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile1, iFile2, iFile3, iFile4)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile2, iFile3, iFile4)); + StorageTraversal expectedFile3Traversal = expectedTraversal(Diagnostic.OK, + storageSet(iFile3, iFile4)); + StorageTraversal expectedFile4Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile4)); + + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - ExpectedResult expectedFile3Result = new ExpectedResult( - expectedFile3Graph, expectedFile3Traversal, + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Graph, expectedFile3Traversal, expectedFile3Traversal, expectedFile3Traversal); - ExpectedResult expectedFile4Result = new ExpectedResult( - expectedFile4Graph, expectedFile4Traversal, + ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile4Graph, expectedFile4Traversal, expectedFile4Traversal, expectedFile4Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(OUTGOING); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result, expectedFile3Result, + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result, expectedFile3Result, expectedFile4Result); } - + @Test public void test_case4_self() throws Exception { List<IFile> files = setUpCase4(); assertEquals(4, files.size()); - Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of( - uriSet(iFile1)); - Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of( - uriSet(iFile2)); - Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of( - uriSet(iFile3)); - Set<? extends Set<URI>> expectedFile4Graph = ImmutableSet.of( - uriSet(iFile4)); + Set<? extends Set<URI>> expectedFile1Graph = ImmutableSet.of(uriSet(iFile1)); + Set<? extends Set<URI>> expectedFile2Graph = ImmutableSet.of(uriSet(iFile2)); + Set<? extends Set<URI>> expectedFile3Graph = ImmutableSet.of(uriSet(iFile3)); + Set<? extends Set<URI>> expectedFile4Graph = ImmutableSet.of(uriSet(iFile4)); + + StorageTraversal expectedFile1Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile1)); + StorageTraversal expectedFile2Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile2)); + StorageTraversal expectedFile3Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile3)); + StorageTraversal expectedFile4Traversal = expectedTraversal(Diagnostic.OK, storageSet(iFile4)); - StorageTraversal expectedFile1Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile1)); - StorageTraversal expectedFile2Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile2)); - StorageTraversal expectedFile3Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile3)); - StorageTraversal expectedFile4Traversal = expectedTraversal( - Diagnostic.OK, storageSet(iFile4)); - - ExpectedResult expectedFile1Result = new ExpectedResult( - expectedFile1Graph, expectedFile1Traversal, + ExpectedResult expectedFile1Result = new ExpectedResult(expectedFile1Graph, expectedFile1Traversal, expectedFile1Traversal, expectedFile1Traversal); - ExpectedResult expectedFile2Result = new ExpectedResult( - expectedFile2Graph, expectedFile2Traversal, + ExpectedResult expectedFile2Result = new ExpectedResult(expectedFile2Graph, expectedFile2Traversal, expectedFile2Traversal, expectedFile2Traversal); - ExpectedResult expectedFile3Result = new ExpectedResult( - expectedFile3Graph, expectedFile3Traversal, + ExpectedResult expectedFile3Result = new ExpectedResult(expectedFile3Graph, expectedFile3Traversal, expectedFile3Traversal, expectedFile3Traversal); - ExpectedResult expectedFile4Result = new ExpectedResult( - expectedFile4Graph, expectedFile4Traversal, + ExpectedResult expectedFile4Result = new ExpectedResult(expectedFile4Graph, expectedFile4Traversal, expectedFile4Traversal, expectedFile4Traversal); - IStorageProviderAccessor accessor = createAccessorForComparison( - initialCommit, targetCommit, true); + IStorageProviderAccessor accessor = createAccessorForComparison(initialCommit, targetCommit, true); setResolutionScope(SELF); - resolveAndCheckResult(accessor, files, expectedFile1Result, - expectedFile2Result, expectedFile3Result, + resolveAndCheckResult(accessor, files, expectedFile1Result, expectedFile2Result, expectedFile3Result, expectedFile4Result); } private void setResolutionScope(CrossReferenceResolutionScope scope) { - final IPreferenceStore store = EMFCompareIDEUIPlugin.getDefault() - .getPreferenceStore(); - store.setValue(EMFCompareUIPreferences.RESOLUTION_SCOPE_PREFERENCE, - scope.name()); + final IPreferenceStore store = EMFCompareIDEUIPlugin.getDefault().getPreferenceStore(); + store.setValue(EMFCompareUIPreferences.RESOLUTION_SCOPE_PREFERENCE, scope.name()); } - private void resolveAndCheckResult(IStorageProviderAccessor accessor, - List<IFile> files, ExpectedResult... expected) throws Exception { + private void resolveAndCheckResult(IStorageProviderAccessor accessor, List<IFile> files, + ExpectedResult... expected) throws Exception { for (int i = 0; i < files.size(); i++) { - ResolvingResult resolutionResult = resolveTraversalOf(accessor, - files.get(i)); + ResolvingResult resolutionResult = resolveTraversalOf(accessor, files.get(i)); assertResultMatches(expected[i], resolutionResult); } } - private void assertResultMatches(ExpectedResult expected, - ResolvingResult actual) { - assertTraversalsMatch(expected.getLeftTraversal(), actual - .getSyncModel().getLeftTraversal()); - assertTraversalsMatch(expected.getRightTraversal(), actual - .getSyncModel().getRightTraversal()); - assertTraversalsMatch(expected.getOriginTraversal(), actual - .getSyncModel().getOriginTraversal()); + private void assertResultMatches(ExpectedResult expected, ResolvingResult actual) { + assertTraversalsMatch(expected.getLeftTraversal(), actual.getSyncModel().getLeftTraversal()); + assertTraversalsMatch(expected.getRightTraversal(), actual.getSyncModel().getRightTraversal()); + assertTraversalsMatch(expected.getOriginTraversal(), actual.getSyncModel().getOriginTraversal()); Set<Set<URI>> actualGraph = actual.getSubGraphs(); Set<? extends Set<URI>> expectedGraph = expected.getSubGraphs(); @@ -679,10 +576,8 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { assertTrue(actualGraph.containsAll(expectedGraph)); } - private void assertTraversalsMatch(StorageTraversal expected, - StorageTraversal actual) { - assertEquals(expected.getDiagnostic().getSeverity(), actual - .getDiagnostic().getSeverity()); + private void assertTraversalsMatch(StorageTraversal expected, StorageTraversal actual) { + assertEquals(expected.getDiagnostic().getSeverity(), actual.getDiagnostic().getSeverity()); Set<? extends IStorage> actualStorages = actual.getStorages(); Set<? extends IStorage> expectedStorages = expected.getStorages(); assertEquals(expectedStorages.size(), actualStorages.size()); @@ -704,33 +599,27 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { } private Set<URI> uriSet(IStorage... storages) { - return ImmutableSet.copyOf(Iterables.transform(Arrays.asList(storages), - ResourceUtil.asURI())); + return ImmutableSet.copyOf(Iterables.transform(Arrays.asList(storages), ResourceUtil.asURI())); } private Set<IStorage> storageSet(IStorage... storages) { return Sets.<IStorage> newLinkedHashSet(Arrays.asList(storages)); } - private StorageTraversal expectedTraversal(int severity, - Set<IStorage> storages) { - return new StorageTraversal(storages, new BasicDiagnostic(severity, "", - 0, "", null)); + private StorageTraversal expectedTraversal(int severity, Set<IStorage> storages) { + return new StorageTraversal(storages, new BasicDiagnostic(severity, "", 0, "", null)); } - private ResolvingResult resolveTraversalOf( - IStorageProviderAccessor accessor, IFile file) throws Exception { + private ResolvingResult resolveTraversalOf(IStorageProviderAccessor accessor, IFile file) + throws Exception { ThreadedModelResolver resolver = new ThreadedModelResolver(); resolver.initialize(); IProgressMonitor nullMonitor = new NullProgressMonitor(); - IStorage leftStorage = accessor.getStorageProvider(file, - DiffSide.SOURCE).getStorage(nullMonitor); - IStorage rightStorage = accessor.getStorageProvider(file, - DiffSide.REMOTE).getStorage(nullMonitor); - IStorage originStorage = accessor.getStorageProvider(file, - DiffSide.ORIGIN).getStorage(nullMonitor); - SynchronizationModel syncModel = resolver.resolveModels(accessor, - leftStorage, rightStorage, originStorage, nullMonitor); + IStorage leftStorage = accessor.getStorageProvider(file, DiffSide.SOURCE).getStorage(nullMonitor); + IStorage rightStorage = accessor.getStorageProvider(file, DiffSide.REMOTE).getStorage(nullMonitor); + IStorage originStorage = accessor.getStorageProvider(file, DiffSide.ORIGIN).getStorage(nullMonitor); + SynchronizationModel syncModel = resolver.resolveModels(accessor, leftStorage, rightStorage, + originStorage, nullMonitor); Set<Set<URI>> subGraphs = getSubGraphs(resolver.getGraphView()); return new ResolvingResult(subGraphs, syncModel); } @@ -769,8 +658,7 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { fileContent += '\n'; outputSource = new ByteArrayInputStream(fileContent.getBytes()); - file.setContents(outputSource, IResource.KEEP_HISTORY, - new NullProgressMonitor()); + file.setContents(outputSource, IResource.KEEP_HISTORY, new NullProgressMonitor()); } finally { if (scanner != null) { scanner.close(); @@ -790,10 +678,8 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { private final StorageTraversal originTraversal; - public ExpectedResult(Set<? extends Set<URI>> subGraphs, - StorageTraversal leftTraversal, - StorageTraversal rightTraversal, - StorageTraversal originTraversal) { + public ExpectedResult(Set<? extends Set<URI>> subGraphs, StorageTraversal leftTraversal, + StorageTraversal rightTraversal, StorageTraversal originTraversal) { this.subGraphs = subGraphs; this.leftTraversal = leftTraversal; this.rightTraversal = rightTraversal; @@ -822,8 +708,7 @@ public class ModelResolverRemoteTest extends CompareGitTestCase { private final SynchronizationModel syncModel; - public ResolvingResult(Set<Set<URI>> subGraphs, - SynchronizationModel syncModel) { + public ResolvingResult(Set<Set<URI>> subGraphs, SynchronizationModel syncModel) { this.subGraphs = subGraphs; this.syncModel = syncModel; } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/MovedImplicitResourceAmongChangedResourcesTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/MovedImplicitResourceAmongChangedResourcesTest.java index 1bf14fb17..fd898ff03 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/MovedImplicitResourceAmongChangedResourcesTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/MovedImplicitResourceAmongChangedResourcesTest.java @@ -119,8 +119,8 @@ public class MovedImplicitResourceAmongChangedResourcesTest extends CompareGitTe public void testRebaseNoConflictMovedSubmodel() throws Exception { setUpMovedIdenticalResourceAndChangedResourceBranches(); - installMockModelDependencyProvider(ImmutableMap.of(submodelFile.getName(), ImmutableSet - .of(identicalFile.getName()))); + installMockModelDependencyProvider( + ImmutableMap.of(submodelFile.getName(), ImmutableSet.of(identicalFile.getName()))); repository.checkoutBranch(MOVED_MODEL_BRANCH); iProject.refreshLocal(IResource.DEPTH_INFINITE, null); @@ -190,10 +190,10 @@ public class MovedImplicitResourceAmongChangedResourcesTest extends CompareGitTe reload(rootResource, submodelResource, identicalResource); // create new files with "moved" path - IFile movedSubmodelFile = project.getIFile(iProject, project.getOrCreateFile(iProject, - SUBMODEL_FILE_MOVED_PATH)); - IFile movedIdenticalFile = project.getIFile(iProject, project.getOrCreateFile(iProject, - IMPLICIT_FILE_MOVED_PATH)); + IFile movedSubmodelFile = project.getIFile(iProject, + project.getOrCreateFile(iProject, SUBMODEL_FILE_MOVED_PATH)); + IFile movedIdenticalFile = project.getIFile(iProject, + project.getOrCreateFile(iProject, IMPLICIT_FILE_MOVED_PATH)); Resource movedSubRes = connectResource(movedSubmodelFile, resourceSet); Resource movedIdenticalRes = connectResource(movedIdenticalFile, resourceSet); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ResourceUtilPathTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ResourceUtilPathTest.java index 2290f8899..50ddb34b5 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ResourceUtilPathTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ResourceUtilPathTest.java @@ -25,15 +25,14 @@ public class ResourceUtilPathTest extends AbstractURITest { @Test public void testFixedPath_git_straightRepo() throws Exception { setupStraightRepo(); - + RevCommit masterTip = repository.findCommit(MASTER); RevCommit branchTip = repository.findCommit(BRANCH); RevCommit origin = masterTip.getParent(0); - - IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, - BRANCH, false); + + IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, BRANCH, false); final String workspaceRelativePath = iFile1.getFullPath().toOSString(); - + IStorageProvider provider = accessor.getStorageProvider(iFile1, DiffSide.ORIGIN); IStorage storage = provider.getStorage(new NullProgressMonitor()); String storagePath = storage.getFullPath().toOSString(); @@ -43,11 +42,11 @@ public class ResourceUtilPathTest extends AbstractURITest { assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); // And it contains the commit's id at the end assertTrue(storagePath.endsWith(origin.getId().abbreviate(6).name())); - + // while we want an actually useable path String fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); - + // Likewise for the remote side provider = accessor.getStorageProvider(iFile1, DiffSide.REMOTE); storage = provider.getStorage(new NullProgressMonitor()); @@ -55,10 +54,10 @@ public class ResourceUtilPathTest extends AbstractURITest { assertTrue(storagePath.contains(workspaceRelativePath)); assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); assertTrue(storagePath.endsWith(branchTip.getId().abbreviate(6).name())); - + fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); - + // and the source side provider = accessor.getStorageProvider(iFile1, DiffSide.SOURCE); storage = provider.getStorage(new NullProgressMonitor()); @@ -66,27 +65,26 @@ public class ResourceUtilPathTest extends AbstractURITest { assertTrue(storagePath.contains(workspaceRelativePath)); assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); assertTrue(storagePath.endsWith(masterTip.getId().abbreviate(6).name())); - + fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); } - + @Test public void testFixedPath_git_multipleCommitsRepo() throws Exception { String branch1Name = BRANCH + "1"; String branch2Name = BRANCH + "2"; setupMultipleCommitsRepo(branch1Name, branch2Name); - + RevCommit masterTip = repository.findCommit(MASTER); RevCommit branchTip = repository.findCommit(branch2Name); // #464792 : can't use "getParent(0).getParent(0)" without NPE RevCommit masterCommit2 = masterTip.getParent(0); RevCommit origin = repository.findCommit(masterCommit2.getId().getName()).getParent(0); - - IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, - branch2Name, false); + + IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, branch2Name, false); final String workspaceRelativePath = iFile1.getFullPath().toOSString(); - + IStorageProvider provider = accessor.getStorageProvider(iFile1, DiffSide.ORIGIN); IStorage storage = provider.getStorage(new NullProgressMonitor()); String storagePath = storage.getFullPath().toOSString(); @@ -96,11 +94,11 @@ public class ResourceUtilPathTest extends AbstractURITest { assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); // And it contains the commit's id at the end assertTrue(storagePath.endsWith(origin.getId().abbreviate(6).name())); - + // while we want an actually useable path String fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); - + // Likewise for the remote side provider = accessor.getStorageProvider(iFile1, DiffSide.REMOTE); storage = provider.getStorage(new NullProgressMonitor()); @@ -108,10 +106,10 @@ public class ResourceUtilPathTest extends AbstractURITest { assertTrue(storagePath.contains(workspaceRelativePath)); assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); assertTrue(storagePath.endsWith(branchTip.getId().abbreviate(6).name())); - + fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); - + // and the source side provider = accessor.getStorageProvider(iFile1, DiffSide.SOURCE); storage = provider.getStorage(new NullProgressMonitor()); @@ -119,7 +117,7 @@ public class ResourceUtilPathTest extends AbstractURITest { assertTrue(storagePath.contains(workspaceRelativePath)); assertFalse(storagePath.startsWith(iFile1.getFullPath().toOSString())); assertTrue(storagePath.endsWith(masterTip.getId().abbreviate(6).name())); - + fixedPath = ResourceUtil.getFixedPath(storage).toOSString(); assertEquals(workspaceRelativePath, fixedPath); } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/RevisionedURIConverterTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/RevisionedURIConverterTest.java index 44fc12f00..ed5b66185 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/RevisionedURIConverterTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/RevisionedURIConverterTest.java @@ -52,17 +52,14 @@ import org.mockito.stubbing.Answer; @SuppressWarnings("unchecked") public class RevisionedURIConverterTest extends AbstractURITest { /** - * using the "straight" repo from {@link #setupStraightRepo()}, we expect - * that the base will be that initial commit, the remote side will be the - * branch, and the source side will be master. - * + * using the "straight" repo from {@link #setupStraightRepo()}, we expect that the base will be that + * initial commit, the remote side will be the branch, and the source side will be master. */ @Test public void testStorageAccessorContents_straight() throws Exception { setupStraightRepo(); - IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, - BRANCH, false); + IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, BRANCH, false); URI file1URI = ResourceUtil.createURIFor(iFile1); // origin is the "initial-commit" state @@ -76,8 +73,7 @@ public class RevisionedURIConverterTest extends AbstractURITest { } /** - * If we compare "master" with "branch2", we expect the common ancestor to - * be "commit-master-1". + * If we compare "master" with "branch2", we expect the common ancestor to be "commit-master-1". */ @Test public void testStorageAccessorContents_multipleCommits() throws Exception { @@ -85,8 +81,7 @@ public class RevisionedURIConverterTest extends AbstractURITest { String branch2Name = BRANCH + "2"; setupMultipleCommitsRepo(branch1Name, branch2Name); - IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, - branch2Name, false); + IStorageProviderAccessor accessor = createAccessorForComparison(MASTER, branch2Name, false); URI file1URI = ResourceUtil.createURIFor(iFile1); // origin is the "commit-master-1" state, which we initialized to be the @@ -101,26 +96,21 @@ public class RevisionedURIConverterTest extends AbstractURITest { } /** - * This will create three files with the expected initial, master and branch - * content, then use a custom content accessor that will redirect - * {@link #file1}'s URI to these. + * This will create three files with the expected initial, master and branch content, then use a custom + * content accessor that will redirect {@link #file1}'s URI to these. */ @Test public void testRedirectingAccessor() throws Exception { /* - * setup has created a dummy file file1. we're gonna create the three - * sides in separate folders, and expect the storage accessor to do the - * redirection. + * setup has created a dummy file file1. we're gonna create the three sides in separate folders, and + * expect the storage accessor to do the redirection. */ final IProject iProject = project.getProject(); final ResourceSet resourceSet = new ResourceSetImpl(); - File originFile = project.getOrCreateFile(iProject, - DiffSide.ORIGIN.toString() + "/file1.ecore"); - File sourceFile = project.getOrCreateFile(iProject, - DiffSide.SOURCE.toString() + "/file1.ecore"); - File remoteFile = project.getOrCreateFile(iProject, - DiffSide.REMOTE.toString() + "/file1.ecore"); + File originFile = project.getOrCreateFile(iProject, DiffSide.ORIGIN.toString() + "/file1.ecore"); + File sourceFile = project.getOrCreateFile(iProject, DiffSide.SOURCE.toString() + "/file1.ecore"); + File remoteFile = project.getOrCreateFile(iProject, DiffSide.REMOTE.toString() + "/file1.ecore"); IFile originIFile = project.getIFile(iProject, originFile); IFile sourceIFile = project.getIFile(iProject, sourceFile); IFile remoteIFile = project.getIFile(iProject, remoteFile); @@ -152,10 +142,8 @@ public class RevisionedURIConverterTest extends AbstractURITest { assertFalse(status.hasUncommittedChanges()); IStorageProviderAccessor accessor = mock(IStorageProviderAccessor.class); - when( - accessor.getStorageProvider(any(IResource.class), - any(DiffSide.class))).then( - getPathRedirectingStorageProvider()); + when(accessor.getStorageProvider(any(IResource.class), any(DiffSide.class))) + .then(getPathRedirectingStorageProvider()); URI file1URI = ResourceUtil.createURIFor(iFile1); // origin is the "initial-commit" state @@ -169,9 +157,9 @@ public class RevisionedURIConverterTest extends AbstractURITest { } /** - * We'll be using a storage provider accessor that returns <code>null</code> - * IStorageProviders. We expect the uri converter not to throw exceptions, - * and not to fall back to the existing file pointed by the URI. + * We'll be using a storage provider accessor that returns <code>null</code> IStorageProviders. We expect + * the uri converter not to throw exceptions, and not to fall back to the existing file pointed by the + * URI. */ @Test public void testNullAccessor() throws Exception { @@ -179,39 +167,32 @@ public class RevisionedURIConverterTest extends AbstractURITest { URIConverter delegate = new ExtensibleURIConverterImpl(); URI fileURI = ResourceUtil.createURIFor(iFile1); - RevisionedURIConverter converter = new RevisionedURIConverter(delegate, - accessor, DiffSide.ORIGIN); - InputStream stream = converter.createInputStream(fileURI, - Collections.emptyMap()); + RevisionedURIConverter converter = new RevisionedURIConverter(delegate, accessor, DiffSide.ORIGIN); + InputStream stream = converter.createInputStream(fileURI, Collections.emptyMap()); assertNull(stream); - converter = new RevisionedURIConverter(delegate, accessor, - DiffSide.REMOTE); + converter = new RevisionedURIConverter(delegate, accessor, DiffSide.REMOTE); stream = converter.createInputStream(fileURI, Collections.emptyMap()); assertNull(stream); - converter = new RevisionedURIConverter(delegate, accessor, - DiffSide.SOURCE); + converter = new RevisionedURIConverter(delegate, accessor, DiffSide.SOURCE); stream = converter.createInputStream(fileURI, Collections.emptyMap()); assertNull(stream); } /** - * We'll be using a storage provide accessor that throws exception. We - * expect that exception to slip through and fail the test. + * We'll be using a storage provide accessor that throws exception. We expect that exception to slip + * through and fail the test. */ @Test public void testExceptionAccessor() throws Exception { IStorageProviderAccessor accessor = mock(IStorageProviderAccessor.class); - when( - accessor.getStorageProvider(any(IResource.class), - any(DiffSide.class))).thenThrow( - UnsupportedOperationException.class); + when(accessor.getStorageProvider(any(IResource.class), any(DiffSide.class))) + .thenThrow(UnsupportedOperationException.class); URIConverter delegate = new ExtensibleURIConverterImpl(); URI fileURI = ResourceUtil.createURIFor(iFile1); - RevisionedURIConverter converter = new RevisionedURIConverter(delegate, - accessor, DiffSide.ORIGIN); + RevisionedURIConverter converter = new RevisionedURIConverter(delegate, accessor, DiffSide.ORIGIN); try { converter.createInputStream(fileURI, Collections.emptyMap()); fail(); @@ -219,8 +200,7 @@ public class RevisionedURIConverterTest extends AbstractURITest { // expected this one to slip through } try { - converter = new RevisionedURIConverter(delegate, accessor, - DiffSide.REMOTE); + converter = new RevisionedURIConverter(delegate, accessor, DiffSide.REMOTE); converter.createInputStream(fileURI, Collections.emptyMap()); fail(); } catch (UnsupportedOperationException e) { @@ -228,8 +208,7 @@ public class RevisionedURIConverterTest extends AbstractURITest { } try { - converter = new RevisionedURIConverter(delegate, accessor, - DiffSide.SOURCE); + converter = new RevisionedURIConverter(delegate, accessor, DiffSide.SOURCE); converter.createInputStream(fileURI, Collections.emptyMap()); fail(); } catch (UnsupportedOperationException e) { @@ -239,21 +218,18 @@ public class RevisionedURIConverterTest extends AbstractURITest { private Answer<IStorageProvider> getPathRedirectingStorageProvider() { return new Answer<IStorageProvider>() { - public IStorageProvider answer(InvocationOnMock invocation) - throws Throwable { - IResource resource = (IResource) invocation.getArguments()[0]; - DiffSide side = (DiffSide) invocation.getArguments()[1]; + public IStorageProvider answer(InvocationOnMock invocation) throws Throwable { + IResource resource = (IResource)invocation.getArguments()[0]; + DiffSide side = (DiffSide)invocation.getArguments()[1]; assertTrue(resource instanceof IFile && resource.exists()); IPath originalPath = resource.getFullPath(); String fileName = originalPath.lastSegment(); - final IPath redirectedPath = originalPath.removeLastSegments(1) - .append(side.toString()).append(fileName); + final IPath redirectedPath = originalPath.removeLastSegments(1).append(side.toString()) + .append(fileName); return new IStorageProvider() { - public IStorage getStorage(IProgressMonitor monitor) - throws CoreException { - return ResourcesPlugin.getWorkspace().getRoot() - .getFile(redirectedPath); + public IStorage getStorage(IProgressMonitor monitor) throws CoreException { + return ResourcesPlugin.getWorkspace().getRoot().getFile(redirectedPath); } }; } diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java index 01067325d..fac0de2ea 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java @@ -66,8 +66,8 @@ public class ThreadedModelResolverResolutionTest extends AbstractGitLogicalModel IStorageProviderAccessor storageAccessor = createRemoteAccessorForComparison(MASTER, BRANCH, iFile3); - StreamAccessorStorage file3Storage = StreamAccessorStorage.fromTypedElement(new StorageTypedElement( - iFile3, iFile3.getFullPath().toOSString())); + StreamAccessorStorage file3Storage = StreamAccessorStorage + .fromTypedElement(new StorageTypedElement(iFile3, iFile3.getFullPath().toOSString())); SynchronizationModel synchronizationModel = resolver.resolveModels(storageAccessor, iFile3, file3Storage, null, monitor); diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingMultiEReferenceTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingMultiEReferenceTest.java index f30caaae9..624397c7f 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingMultiEReferenceTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingMultiEReferenceTest.java @@ -50,12 +50,15 @@ public class IncomingMultiEReferenceTest extends LocalResolutionTest { @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceOldSerializationTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceOldSerializationTest.java index 48784fd19..46bbcf99e 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceOldSerializationTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceOldSerializationTest.java @@ -48,12 +48,15 @@ public class IncomingSingleEReferenceOldSerializationTest extends LocalResolutio @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceTest.java index 88c556c7d..1c09e2ced 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/incoming/IncomingSingleEReferenceTest.java @@ -52,12 +52,15 @@ public class IncomingSingleEReferenceTest extends LocalResolutionTest { @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()))), of(file1()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingMultiEReferenceTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingMultiEReferenceTest.java index 5d1b03aa3..2e8d8419f 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingMultiEReferenceTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingMultiEReferenceTest.java @@ -50,12 +50,15 @@ public class OutgoingMultiEReferenceTest extends LocalResolutionTest { @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceOldSerializationTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceOldSerializationTest.java index c1e48786a..b9826e83b 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceOldSerializationTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceOldSerializationTest.java @@ -48,12 +48,15 @@ public class OutgoingSingleEReferenceOldSerializationTest extends LocalResolutio @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceTest.java index 6a439e6e0..73b2625cc 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/outgoing/OutgoingSingleEReferenceTest.java @@ -52,12 +52,15 @@ public class OutgoingSingleEReferenceTest extends LocalResolutionTest { @Parameters(name = "{index}: scope {0} -> graph {1}, traversal {2}") public static Iterable<Object[]> data1() { - return Arrays.asList(new Object[][] { - {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, - {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); + return Arrays + .asList(new Object[][] { + {WORKSPACE, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {PROJECT, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {CONTAINER, of(of(resourceURI(file1()), resourceURI(file2()))), + of(file1(), file2()) }, + {OUTGOING, of(of(resourceURI(file1()), resourceURI(file2()))), of(file1(), file2()) }, + {SELF, of(of(resourceURI(file1()))), of(file1()) }, }); } private static String file1() { |