Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Delaigue2015-09-15 07:13:30 +0000
committerAxel RICHARD2015-09-24 14:54:59 +0000
commit1f021b1e220ef4191c5bb94a1fa2783aba116837 (patch)
tree7776807cb96b6ab9609836afe488296e94f93a7e /plugins/org.eclipse.emf.compare.diagram.papyrus.tests
parent4aabb3f2af33e48109b9d30c7daedd328389f423 (diff)
downloadorg.eclipse.emf.compare-1f021b1e220ef4191c5bb94a1fa2783aba116837.tar.gz
org.eclipse.emf.compare-1f021b1e220ef4191c5bb94a1fa2783aba116837.tar.xz
org.eclipse.emf.compare-1f021b1e220ef4191c5bb94a1fa2783aba116837.zip
Remove MergeRenamingPostProcessors
They are no longer useful since ResourceLocationChanges are no longer used. Change-Id: I39375123e70fe16715117245c291eb72180d5a00 Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.emf.compare.diagram.papyrus.tests')
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/AbstractMatchResourceTest.java146
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource2WayTest.java150
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource3WayTest.java436
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/suite/AllTests.java8
4 files changed, 2 insertions, 738 deletions
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/AbstractMatchResourceTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/AbstractMatchResourceTest.java
deleted file mode 100644
index fcae1a447..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/AbstractMatchResourceTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.papyrus.tests.renaming;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.CompareFactory;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.MatchResource;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.AbstractMergeRenamingMatchResources;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources2Ways;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources3Ways;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
-import org.junit.Before;
-
-/**
- * Tests the {@link MergeRenamingMatchResources2Ways} and
- * {@link MergeRenamingMatchResources3Ways} classes. Can be run in standalone
- * mode, no need to be run as eclipse plug-in test.
- *
- * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
- */
-public abstract class AbstractMatchResourceTest {
-
- protected Comparison comparison;
-
- protected AbstractMergeRenamingMatchResources trt;
-
- protected Resource newResource(String uri) {
- return new ResourceImpl(URI.createPlatformResourceURI(uri, false));
- }
-
- protected MatchResource addMatchResource(Resource origin, Resource left,
- Resource right) {
- MatchResource result = CompareFactory.eINSTANCE.createMatchResource();
- if (left != null) {
- result.setLeft(left);
- result.setLeftURI(left.getURI().toString());
- }
- if (origin != null) {
- result.setOrigin(origin);
- result.setOriginURI(origin.getURI().toString());
- }
- if (right != null) {
- result.setRight(right);
- result.setRightURI(right.getURI().toString());
- }
- result.setComparison(comparison);
- return result;
- }
-
- protected void checkComparisonContainsMatchResource(String leftURI,
- String rightURI) {
- if (leftURI != null) {
- URI uri = URI.createPlatformResourceURI(leftURI, false);
- String originURIToCheck = uri.toString();
- for (MatchResource mr : comparison.getMatchedResources()) {
- if (originURIToCheck.equals(mr.getLeftURI())) {
- checkURI(rightURI, mr.getRightURI());
- return;
- }
- }
- } else if (rightURI != null) {
- for (MatchResource mr : comparison.getMatchedResources()) {
- if (equalURIs(rightURI, mr.getRightURI())) {
- checkURI(leftURI, mr.getLeftURI());
- return;
- }
- }
- } else {
- throw new IllegalStateException(
- "Invalid test set-up: at least one provided URI must be non-null.");
- }
- fail("No MatchResource found provided URIs " + leftURI + ", "
- + rightURI);
- }
-
- protected void checkComparisonContainsMatchResource(String originURI,
- String leftURI, String rightURI) {
- if (originURI != null) {
- for (MatchResource mr : comparison.getMatchedResources()) {
- if (equalURIs(originURI, mr.getOriginURI())) {
- checkURI(leftURI, mr.getLeftURI());
- checkURI(rightURI, mr.getRightURI());
- return;
- }
- }
- } else if (leftURI != null) {
- for (MatchResource mr : comparison.getMatchedResources()) {
- if (equalURIs(leftURI, mr.getLeftURI())) {
- checkURI(originURI, mr.getOriginURI());
- checkURI(rightURI, mr.getRightURI());
- return;
- }
- }
- } else if (rightURI != null) {
- for (MatchResource mr : comparison.getMatchedResources()) {
- if (equalURIs(rightURI, mr.getRightURI())) {
- checkURI(originURI, mr.getOriginURI());
- checkURI(leftURI, mr.getLeftURI());
- return;
- }
- }
- } else {
- throw new IllegalStateException(
- "Invalid test set-up: at least one provided URI must be non-null.");
- }
- fail("No MatchResource found provided URIs " + originURI + ", "
- + leftURI + ", " + rightURI);
- }
-
- protected void checkURI(String expected, String actual) {
- assertTrue(equalURIs(expected, actual));
- }
-
- protected boolean equalURIs(String expected, String actual) {
- if (expected == null) {
- return actual == null;
- }
- return URI.createPlatformResourceURI(expected, false).toString()
- .equals(actual);
- }
-
- @Before
- public void setUp() {
- createComparison();
- createMergeRenamingMatchResourceTreatment();
- }
-
- protected abstract void createMergeRenamingMatchResourceTreatment();
-
- protected void createComparison() {
- comparison = CompareFactory.eINSTANCE.createComparison();
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource2WayTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource2WayTest.java
deleted file mode 100644
index c3fa15942..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource2WayTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.papyrus.tests.renaming;
-
-import static org.junit.Assert.assertEquals;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.CompareFactory;
-import org.eclipse.emf.compare.MatchResource;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources2Ways;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources3Ways;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
-import org.junit.Test;
-
-/**
- * Tests the {@link MergeRenamingMatchResources2Ways} and
- * {@link MergeRenamingMatchResources3Ways} classes. Can be run in standalone
- * mode, no need to be run as eclipse plug-in test.
- *
- * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
- */
-public class MergeRenamingMatchResource2WayTest extends
- AbstractMatchResourceTest {
-
- @Test
- public void testSimpleCase2Ways() {
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
-
- addMatchResource(null, leftuml, rightuml);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation");
-
- }
-
- @Test
- public void testSimpleCase2WaysWithSashAndNonPapyrus() {
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource leftsash = newResource("/prj1/a.sash");
- Resource lefttxt = newResource("/prj1/a.txt");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
- Resource rightsash = newResource("/prj1/b.sash");
- Resource righttxt = newResource("/prj1/b.txt");
-
- addMatchResource(null, leftuml, rightuml);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
- addMatchResource(null, leftsash, null);
- addMatchResource(null, lefttxt, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
- addMatchResource(null, null, rightsash);
- addMatchResource(null, null, righttxt);
-
- trt.run();
-
- assertEquals(6, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation");
- checkComparisonContainsMatchResource("/prj1/a.sash", "/prj1/b.sash");
- checkComparisonContainsMatchResource("/prj1/a.txt", null);
- checkComparisonContainsMatchResource(null, "/prj1/b.txt");
-
- }
-
- @Test(expected = IllegalStateException.class)
- public void testMRMR2WaysInstantiationRejects3WayComparison() {
- comparison.setThreeWay(true);
- new MergeRenamingMatchResources2Ways(comparison, new BasicMonitor());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testMRMR2WaysRunRejects3WayComparison() {
- // We change the type of comparison after having instantiated the
- // treatment
- comparison.setThreeWay(true);
- trt.run();
- }
-
- @Test(expected = NullPointerException.class)
- public void testMRMR2WaysRejectsNullComparison() {
- new MergeRenamingMatchResources2Ways(null, new BasicMonitor());
- }
-
- @Test(expected = NullPointerException.class)
- public void testMRMR2WaysRejectsNullMonitor() {
- new MergeRenamingMatchResources2Ways(comparison, null);
- }
-
- @Override
- protected Resource newResource(String uri) {
- return new ResourceImpl(URI.createPlatformResourceURI(uri, false));
- }
-
- @Override
- protected MatchResource addMatchResource(Resource origin, Resource left,
- Resource right) {
- MatchResource result = CompareFactory.eINSTANCE.createMatchResource();
- if (left != null) {
- result.setLeft(left);
- result.setLeftURI(left.getURI().toString());
- }
- if (origin != null) {
- result.setOrigin(origin);
- result.setOriginURI(origin.getURI().toString());
- }
- if (right != null) {
- result.setRight(right);
- result.setRightURI(right.getURI().toString());
- }
- result.setComparison(comparison);
- return result;
- }
-
- @Override
- protected void createMergeRenamingMatchResourceTreatment() {
- trt = new MergeRenamingMatchResources2Ways(comparison,
- new BasicMonitor());
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource3WayTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource3WayTest.java
deleted file mode 100644
index 10c5acd95..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/renaming/MergeRenamingMatchResource3WayTest.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.papyrus.tests.renaming;
-
-import static org.junit.Assert.assertEquals;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources2Ways;
-import org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.postprocessor.MergeRenamingMatchResources3Ways;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-/**
- * Tests the {@link MergeRenamingMatchResources2Ways} and
- * {@link MergeRenamingMatchResources3Ways} classes. Can be run in standalone
- * mode, no need to be run as eclipse plug-in test.
- *
- * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
- */
-public class MergeRenamingMatchResource3WayTest extends
- AbstractMatchResourceTest {
-
- @Test
- public void testRenamedRight() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basedi, leftdi, null);
- addMatchResource(basenot, leftnot, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/a.uml",
- "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/a.di",
- "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/a.notation", "/prj1/b.notation");
- }
-
- @Test
- public void testRenamedRightWithAdditionalFiles() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource basesash = newResource("/prj1/a.sash");
- Resource basetxt = newResource("/prj1/a.txt");
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource leftsash = newResource("/prj1/a.sash");
- Resource lefttxt = newResource("/prj1/a.txt");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
- Resource rightsash = newResource("/prj1/b.sash");
- Resource righttxt = newResource("/prj1/a.txt");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basedi, leftdi, null);
- addMatchResource(basenot, leftnot, null);
- addMatchResource(basesash, leftsash, null);
- addMatchResource(basetxt, lefttxt, righttxt);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
- addMatchResource(null, null, rightsash);
-
- trt.run();
-
- assertEquals(5, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/a.uml",
- "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/a.di",
- "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/a.notation", "/prj1/b.notation");
- checkComparisonContainsMatchResource("/prj1/a.sash", "/prj1/a.sash",
- "/prj1/b.sash");
- checkComparisonContainsMatchResource("/prj1/a.txt", "/prj1/a.txt",
- "/prj1/a.txt");
- }
-
- @Test
- public void testRenamedLeft() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource leftuml = newResource("/prj1/b.uml");
- Resource leftnot = newResource("/prj1/b.notation");
- Resource leftdi = newResource("/prj1/b.di");
- Resource rightuml = newResource("/prj1/a.uml");
- Resource rightnot = newResource("/prj1/a.notation");
- Resource rightdi = newResource("/prj1/a.di");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
- addMatchResource(basedi, null, rightdi);
- addMatchResource(basenot, null, rightnot);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml",
- "/prj1/a.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di",
- "/prj1/a.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation", "/prj1/a.notation");
- }
-
- @Test
- public void testRenamedBothSides() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource leftuml = newResource("/prj1/b.uml");
- Resource leftnot = newResource("/prj1/b.notation");
- Resource leftdi = newResource("/prj1/b.di");
- Resource rightuml = newResource("/prj1/c.uml");
- Resource rightnot = newResource("/prj1/c.notation");
- Resource rightdi = newResource("/prj1/c.di");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml",
- "/prj1/c.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di",
- "/prj1/c.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation", "/prj1/c.notation");
- }
-
- @Test
- public void testRenamedBothSidesWithAdditionalFiles() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource basetxt = newResource("/prj1/a.txt");
- Resource leftuml = newResource("/prj1/b.uml");
- Resource leftnot = newResource("/prj1/b.notation");
- Resource leftdi = newResource("/prj1/b.di");
- Resource lefttxt = newResource("/prj1/b.txt");
- Resource rightuml = newResource("/prj1/c.uml");
- Resource rightnot = newResource("/prj1/c.notation");
- Resource rightdi = newResource("/prj1/c.di");
- Resource righttxt = newResource("/prj1/c.txt");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(basetxt, null, null);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
- addMatchResource(null, lefttxt, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
- addMatchResource(null, null, righttxt);
-
- trt.run();
-
- assertEquals(6, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml",
- "/prj1/c.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di",
- "/prj1/c.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation", "/prj1/c.notation");
- checkComparisonContainsMatchResource("/prj1/a.txt", null, null);
- checkComparisonContainsMatchResource(null, "/prj1/b.txt", null);
- checkComparisonContainsMatchResource(null, null, "/prj1/c.txt");
- }
-
- @Test
- public void testRenamedLeftDeletedRight() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource leftuml = newResource("/prj1/b.uml");
- Resource leftnot = newResource("/prj1/b.notation");
- Resource leftdi = newResource("/prj1/b.di");
-
- addMatchResource(baseuml, leftuml, null);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(null, leftdi, null);
- addMatchResource(null, leftnot, null);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml", null);
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/b.di", null);
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/b.notation", null);
- }
-
- @Test
- public void testRenamedRightDeletedLeft() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
-
- addMatchResource(baseuml, null, rightuml);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", null, "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", null, "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation", null,
- "/prj1/b.notation");
- }
-
- @Test
- public void testRenameWithUmlAndNotationKnown() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basenot, leftnot, rightnot);
- addMatchResource(basedi, leftdi, null);
- addMatchResource(null, null, rightdi);
-
- trt.run();
-
- assertEquals(3, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/a.uml",
- "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/a.di",
- "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/a.notation", "/prj1/b.notation");
- }
-
- @Test
- public void testRenameWithUmlAndNotationKnownPlusNoise() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource basesash = newResource("/prj1/a.sash");
- Resource leftuml = newResource("/prj1/a.uml");
- Resource leftnot = newResource("/prj1/a.notation");
- Resource leftdi = newResource("/prj1/a.di");
- Resource leftsash = newResource("/prj1/a.sash");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
- Resource rightsash = newResource("/prj1/b.sash");
- Resource arightdi = newResource("/prj1/a.di");
- Resource crightdi = newResource("/prj1/c.di");
-
- addMatchResource(baseuml, leftuml, rightuml);
- addMatchResource(basenot, leftnot, rightnot);
- addMatchResource(basedi, leftdi, null);
- addMatchResource(basesash, leftsash, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightsash);
- addMatchResource(null, null, arightdi);
- addMatchResource(null, null, crightdi);
-
- trt.run();
-
- assertEquals(6, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/a.uml",
- "/prj1/b.uml");
- checkComparisonContainsMatchResource("/prj1/a.di", "/prj1/a.di",
- "/prj1/b.di");
- checkComparisonContainsMatchResource("/prj1/a.notation",
- "/prj1/a.notation", "/prj1/b.notation");
- checkComparisonContainsMatchResource("/prj1/a.sash", "/prj1/a.sash",
- "/prj1/b.sash");
- checkComparisonContainsMatchResource(null, null, "/prj1/a.di");
- checkComparisonContainsMatchResource(null, null, "/prj1/c.di");
- }
-
- @Test
- public void testIncoherentRenameWithApparitionOfRenamedFile() {
- Resource auml = newResource("/prj1/a.uml");
- Resource cnot = newResource("/prj1/c.notation");
- Resource cdi = newResource("/prj1/c.di");
- Resource buml_l = newResource("/prj1/b.uml");
- Resource anot_l = newResource("/prj1/a.notation");
- Resource adi_l = newResource("/prj1/a.di");
- Resource bnot_r = newResource("/prj1/b.notation");
- Resource adi_r = newResource("/prj1/a.di");
-
- addMatchResource(auml, buml_l, null);
- addMatchResource(cdi, null, null);
- addMatchResource(cnot, null, null);
- addMatchResource(null, adi_l, adi_r);
- addMatchResource(null, anot_l, bnot_r);
-
- trt.run();
-
- assertEquals(5, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml", null);
- checkComparisonContainsMatchResource("/prj1/c.di", null, null);
- checkComparisonContainsMatchResource("/prj1/c.notation", null, null);
- checkComparisonContainsMatchResource(null, "/prj1/a.di", "/prj1/a.di");
- checkComparisonContainsMatchResource(null, "/prj1/a.notation",
- "/prj1/b.notation");
- }
-
- @Test
- public void testIncoherentRenames() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
- Resource rightdi = newResource("/prj1/b.di");
-
- // a.uml renamed to b.uml on the left but no matching rename for di and
- // notation
- // And vice-versa on the right
- addMatchResource(baseuml, rightuml, null);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(null, null, rightdi);
- addMatchResource(null, null, rightnot);
-
- trt.run();
-
- assertEquals(5, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml", null);
- checkComparisonContainsMatchResource("/prj1/a.di", null, null);
- checkComparisonContainsMatchResource("/prj1/a.notation", null, null);
- checkComparisonContainsMatchResource(null, null, "/prj1/b.di");
- checkComparisonContainsMatchResource(null, null, "/prj1/b.notation");
- }
-
- @Test
- public void testExtremeCaseWithInvalidData() {
- Resource baseuml = newResource("/prj1/a.uml");
- Resource basenot = newResource("/prj1/a.notation");
- Resource basedi = newResource("/prj1/a.di");
- Resource rightuml = newResource("/prj1/b.uml");
- Resource rightnot = newResource("/prj1/b.notation");
-
- // a.uml renamed to b.uml on the left but no matching rename for di and
- // notation
- // And vice-versa on the right
- addMatchResource(baseuml, rightuml, null);
- addMatchResource(basedi, null, null);
- addMatchResource(basenot, null, null);
- addMatchResource(null, null, rightnot);
- addMatchResource(null, null, null);
-
- trt.run();
-
- assertEquals(5, comparison.getMatchedResources().size());
- checkComparisonContainsMatchResource("/prj1/a.uml", "/prj1/b.uml", null);
- checkComparisonContainsMatchResource("/prj1/a.di", null, null);
- checkComparisonContainsMatchResource("/prj1/a.notation", null, null);
- checkComparisonContainsMatchResource(null, null, "/prj1/b.notation");
- }
-
- @Test(expected = IllegalStateException.class)
- public void testMRMR3WaysInstantiationRejects2WayComparison() {
- comparison.setThreeWay(false);
- new MergeRenamingMatchResources3Ways(comparison, new BasicMonitor());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testMRMR3WaysRunRejects2WayComparison() {
- // We change the type of comparison after having instantiated the
- // treatment
- comparison.setThreeWay(false);
- trt.run();
- }
-
- @Test(expected = NullPointerException.class)
- public void testMRMR3WaysRejectsNullComparison() {
- new MergeRenamingMatchResources3Ways(null, new BasicMonitor());
- }
-
- @Test(expected = NullPointerException.class)
- public void testMRMR3WaysRejectsNullMonitor() {
- new MergeRenamingMatchResources3Ways(comparison, null);
- }
-
- @Override
- protected void createComparison() {
- super.createComparison();
- comparison.setThreeWay(true);
- }
-
- @Override
- protected void createMergeRenamingMatchResourceTreatment() {
- trt = new MergeRenamingMatchResources3Ways(comparison,
- new BasicMonitor());
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/suite/AllTests.java
index bfbb87a91..5cee1cb1c 100644
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/suite/AllTests.java
@@ -21,8 +21,6 @@ import org.eclipse.emf.compare.diagram.papyrus.tests.merge.AssocMergeTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.merge.EdgeMergeTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.merge.NodeMergeTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.modelextension.ModelExtensionUtilTest;
-import org.eclipse.emf.compare.diagram.papyrus.tests.renaming.MergeRenamingMatchResource2WayTest;
-import org.eclipse.emf.compare.diagram.papyrus.tests.renaming.MergeRenamingMatchResource3WayTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.saveparameter.SaveParameterHookIntegrationTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.saveparameter.SaveParameterHookTest;
import org.eclipse.emf.compare.diagram.papyrus.tests.uriattachment.URIAttachmentTest;
@@ -47,11 +45,9 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@SuppressWarnings("restriction")
@RunWith(Suite.class)
-@SuiteClasses({AssocMergeTest.class, EdgeMergeTest.class, NodeMergeTest.class,
+@SuiteClasses({ AssocMergeTest.class, EdgeMergeTest.class, NodeMergeTest.class,
ModelExtensionUtilTest.class, SaveParameterHookTest.class,
- SaveParameterHookIntegrationTest.class, URIAttachmentTest.class,
- MergeRenamingMatchResource2WayTest.class,
- MergeRenamingMatchResource3WayTest.class })
+ SaveParameterHookIntegrationTest.class, URIAttachmentTest.class, })
public class AllTests {
/**

Back to the top