Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.compare.uml2.tests')
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractTest.java26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java35
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java23
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java127
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java16
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java24
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java1036
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java962
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java901
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/ImplicationsInputData.java41
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/left.uml15
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/right.uml5
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/left.uml14
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/right.uml9
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/left.uml8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/right.uml5
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java6
18 files changed, 3159 insertions, 120 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractTest.java
index 2791e82ac..514d085b7 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractTest.java
@@ -33,6 +33,7 @@ import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.merge.BatchMerger;
import org.eclipse.emf.compare.merge.IBatchMerger;
import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.postprocessor.IPostProcessor;
import org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.scope.IComparisonScope;
@@ -54,7 +55,7 @@ public abstract class AbstractTest {
private EMFCompare emfCompare;
- private static final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+ private IMerger.Registry mergerRegistry;
@BeforeClass
public static void fillRegistries() {
@@ -63,19 +64,20 @@ public abstract class AbstractTest {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("uml", //$NON-NLS-1$
new UMLResourceFactoryImpl());
-
- final IMerger umlMerger = new UMLMerger();
- umlMerger.setRanking(11);
- mergerRegistry.add(umlMerger);
}
@Before
public void before() {
- PostProcessorDescriptorRegistryImpl<String> registry = new PostProcessorDescriptorRegistryImpl<String>();
- registry.put(UMLPostProcessor.class.getName(), new TestPostProcessor.TestPostProcessorDescriptor(
- Pattern.compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null, new UMLPostProcessor(),
- 20));
- emfCompare = EMFCompare.builder().setPostProcessorRegistry(registry).build();
+ final IPostProcessor.Descriptor.Registry<String> postProcessorRegistry = new PostProcessorDescriptorRegistryImpl<String>();
+ postProcessorRegistry.put(UMLPostProcessor.class.getName(),
+ new TestPostProcessor.TestPostProcessorDescriptor(Pattern
+ .compile("http://www.eclipse.org/uml2/\\d\\.0\\.0/UML"), null,
+ new UMLPostProcessor(), 20));
+ emfCompare = EMFCompare.builder().setPostProcessorRegistry(postProcessorRegistry).build();
+ mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+ final IMerger umlMerger = new UMLMerger();
+ umlMerger.setRanking(11);
+ mergerRegistry.add(umlMerger);
}
protected EMFCompare getCompare() {
@@ -91,6 +93,10 @@ public abstract class AbstractTest {
return getCompare().compare(scope);
}
+ protected IMerger.Registry getMergerRegistry() {
+ return mergerRegistry;
+ }
+
protected enum TestKind {
ADD, DELETE;
}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
index 48608cd3f..4dc748179 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
@@ -28,6 +28,7 @@ import org.eclipse.emf.compare.uml2.internal.AssociationChange;
import org.eclipse.emf.compare.uml2.tests.AbstractTest;
import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Ignore;
import org.junit.Test;
@SuppressWarnings("nls")
@@ -53,6 +54,8 @@ public class AddAssociation2Test extends AbstractTest {
}
@Test
+ @Ignore
+ // FIXME: See Bug 410737
public void testMergeLtRA30UseCase() throws IOException {
final Resource left = input.getA3Left();
final Resource right = input.getA3Right();
@@ -70,6 +73,8 @@ public class AddAssociation2Test extends AbstractTest {
}
@Test
+ @Ignore
+ // FIXME: See Bug 410737
public void testMergeRtLA31UseCase() throws IOException {
final Resource left = input.getA3Left();
final Resource right = input.getA3Right();
@@ -103,10 +108,11 @@ public class AddAssociation2Test extends AbstractTest {
}
@Test
+ @Ignore
+ // FIXME: See Bug 410737
public void testMergeLtRA30UseCase3way() throws IOException {
final Resource left = input.getA3Left();
final Resource right = input.getA3Right();
-
testMergeLeftToRight(left, right, right);
}
@@ -128,6 +134,8 @@ public class AddAssociation2Test extends AbstractTest {
}
@Test
+ @Ignore
+ // FIXME: See Bug 410737
public void testMergeLtRA31UseCase3way() throws IOException {
final Resource left = input.getA3Left();
final Resource right = input.getA3Right();
@@ -138,12 +146,13 @@ public class AddAssociation2Test extends AbstractTest {
private void testAB1(TestKind kind, final Comparison comparison) {
final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(13), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
Predicate<? super Diff> addAssociationDescription = null;
Predicate<? super Diff> addPropertyClass1Description = null;
Predicate<? super Diff> addPropertyClass0Description = null;
Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
+ Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
@@ -161,6 +170,8 @@ public class AddAssociation2Test extends AbstractTest {
"model.Class1.class0");
addPropertyClass0InAssociationDescription = removedFromReference("model.class1_class0_0",
"memberEnd", "model.Class1.class0");
+ addPropertyClass1InAssociationDescription = removedFromReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.class1");
addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
"association", "model.class1_class0_0", null);
addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
@@ -181,6 +192,8 @@ public class AddAssociation2Test extends AbstractTest {
"model.Class1.class0");
addPropertyClass0InAssociationDescription = addedToReference("model.class1_class0_0",
"memberEnd", "model.Class1.class0");
+ addPropertyClass1InAssociationDescription = addedToReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.class1");
addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
"association", null, "model.class1_class0_0");
addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
@@ -200,6 +213,8 @@ public class AddAssociation2Test extends AbstractTest {
final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
addPropertyClass0InAssociationDescription);
+ final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass1InAssociationDescription);
final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
addRefAssociationInPropertyClass1Description);
final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
@@ -216,12 +231,12 @@ public class AddAssociation2Test extends AbstractTest {
addLiteralIntegerInClass0Description);
final Diff addUnlimitedNaturalInClass0 = Iterators.find(differences.iterator(),
addUnlimitedNaturalInClass0Description);
- // duplicate diff: add Association.memberEnd to class1s
assertNotNull(addAssociation);
assertNotNull(addPropertyClass1);
assertNotNull(addPropertyClass0);
assertNotNull(addPropertyClass0InAssociation);
+ assertNotNull(addPropertyClass1InAssociation);
assertNotNull(addRefAssociationInPropertyClass1);
assertNotNull(addRefTypeInPropertyClass1);
assertNotNull(addRefAssociationInPropertyClass0);
@@ -242,12 +257,13 @@ public class AddAssociation2Test extends AbstractTest {
instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
}
assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(12), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0));
@@ -256,7 +272,6 @@ public class AddAssociation2Test extends AbstractTest {
assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0));
assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0));
- // duplicate diff: add Association.memberEnd to class1s
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
@@ -301,12 +316,12 @@ public class AddAssociation2Test extends AbstractTest {
assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
assertTrue(addUnlimitedNaturalInClass0.getRequires().contains(addPropertyClass0));
} else {
- assertSame(Integer.valueOf(4), Integer.valueOf(addPropertyClass1.getRequires().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass1.getRequires().size()));
assertTrue(addPropertyClass1.getRequires().contains(addLiteralIntegerInClass1));
assertTrue(addPropertyClass1.getRequires().contains(addUnlimitedNaturalInClass1));
assertTrue(addPropertyClass1.getRequires().contains(addRefAssociationInPropertyClass1));
assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
- // duplicate diff: add Association.memberEnd to class1s
+ assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
@@ -322,12 +337,12 @@ public class AddAssociation2Test extends AbstractTest {
.size()));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
- assertSame(Integer.valueOf(4), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
assertTrue(addAssociation.getRequires().contains(addPropertyClass1));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
- // duplicate diff: add Association.memberEnd to class1s
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
index 9bb96f65b..078f14e6d 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
@@ -138,13 +138,13 @@ public class AddAssociation3Test extends AbstractTest {
private void testAB1(TestKind kind, final Comparison comparison) {
final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(13), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
Predicate<? super Diff> addAssociationDescription = null;
Predicate<? super Diff> addPropertyClass1Description = null;
Predicate<? super Diff> addPropertyClass0Description = null;
Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
- // duplicate diff: Association.memberEnd to class0
+ Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
@@ -162,6 +162,8 @@ public class AddAssociation3Test extends AbstractTest {
"model.AssociationClass0.class0");
addPropertyClass1InAssociationDescription = removedFromReference("model.AssociationClass0",
"memberEnd", "model.Class0.class1");
+ addPropertyClass0InAssociationDescription = removedFromReference("model.AssociationClass0",
+ "memberEnd", "model.AssociationClass0.class0");
addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
"association", "model.AssociationClass0", null);
addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type",
@@ -182,6 +184,8 @@ public class AddAssociation3Test extends AbstractTest {
"model.AssociationClass0.class0");
addPropertyClass1InAssociationDescription = addedToReference("model.AssociationClass0",
"memberEnd", "model.Class0.class1");
+ addPropertyClass0InAssociationDescription = addedToReference("model.AssociationClass0",
+ "memberEnd", "model.AssociationClass0.class0");
addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
"association", null, "model.AssociationClass0");
addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type", null,
@@ -201,6 +205,8 @@ public class AddAssociation3Test extends AbstractTest {
final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
addPropertyClass1InAssociationDescription);
+ final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass0InAssociationDescription);
final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
addRefAssociationInPropertyClass1Description);
final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
@@ -231,6 +237,7 @@ public class AddAssociation3Test extends AbstractTest {
assertNotNull(addUnlimitedNaturalInClass1);
assertNotNull(addLiteralIntegerInClass0);
assertNotNull(addUnlimitedNaturalInClass0);
+ assertNotNull(addPropertyClass0InAssociation);
// CHECK EXTENSION
assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
@@ -243,7 +250,7 @@ public class AddAssociation3Test extends AbstractTest {
instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
}
assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(12), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
@@ -256,7 +263,7 @@ public class AddAssociation3Test extends AbstractTest {
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
- // duplicate diff: Association.memberEnd to class0
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
@@ -308,12 +315,12 @@ public class AddAssociation3Test extends AbstractTest {
assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
- assertSame(Integer.valueOf(4), Integer.valueOf(addPropertyClass0.getRequires().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
assertTrue(addPropertyClass0.getRequires().contains(addUnlimitedNaturalInClass0));
assertTrue(addPropertyClass0.getRequires().contains(addRefAssociationInPropertyClass0));
assertTrue(addPropertyClass0.getRequires().contains(addRefTypeInPropertyClass0));
- // duplicate diff: Association.memberEnd to class0
+ assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
.size()));
@@ -322,12 +329,12 @@ public class AddAssociation3Test extends AbstractTest {
.size()));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
- assertSame(Integer.valueOf(4), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
assertTrue(addAssociation.getRequires().contains(addPropertyClass0));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
- // duplicate diff: Association.memberEnd to class0
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
index 12b001d0b..5e2aa873e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
@@ -28,7 +28,6 @@ import org.eclipse.emf.compare.uml2.internal.AssociationChange;
import org.eclipse.emf.compare.uml2.tests.AbstractTest;
import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Ignore;
import org.junit.Test;
@SuppressWarnings("nls")
@@ -54,8 +53,6 @@ public class AddAssociationTest extends AbstractTest {
}
@Test
- @Ignore
- // See UMLPostProcessor#removeDuplicateDiffs(Comparison)
public void testMergeLtRA10UseCase() throws IOException {
final Resource left = input.getA1Left();
final Resource right = input.getA1Right();
@@ -73,8 +70,6 @@ public class AddAssociationTest extends AbstractTest {
}
@Test
- @Ignore
- // See UMLPostProcessor#removeDuplicateDiffs(Comparison)
public void testMergeRtLA11UseCase() throws IOException {
final Resource left = input.getA1Right();
final Resource right = input.getA1Left();
@@ -108,8 +103,6 @@ public class AddAssociationTest extends AbstractTest {
}
@Test
- @Ignore
- // See UMLPostProcessor#removeDuplicateDiffs(Comparison)
public void testMergeLtRA10UseCase3way() throws IOException {
final Resource left = input.getA1Left();
final Resource right = input.getA1Right();
@@ -135,8 +128,6 @@ public class AddAssociationTest extends AbstractTest {
}
@Test
- @Ignore
- // See UMLPostProcessor#removeDuplicateDiffs(Comparison)
public void testMergeLtRA11UseCase3way() throws IOException {
final Resource left = input.getA1Left();
final Resource right = input.getA1Right();
@@ -148,7 +139,7 @@ public class AddAssociationTest extends AbstractTest {
final List<Diff> differences = comparison.getDifferences();
// We should have no less and no more than 16 differences
- assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(16), Integer.valueOf(differences.size()));
Predicate<? super Diff> addAssociationDescription = null;
Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
@@ -161,11 +152,10 @@ public class AddAssociationTest extends AbstractTest {
Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
- // duplicate diffs: Add differences on (opposite and subset features):
- // - Association.memberEnd to class1s
- // - Association.memberEnd to class2s
- // - Association.ownedEnd to class1s
- // - Association.ownedEnd to class2s
+ Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addOwnedEndClass1Description = null;
+ Predicate<? super Diff> addOwnedEndClass2Description = null;
if (kind.equals(TestKind.DELETE)) {
addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
@@ -185,6 +175,14 @@ public class AddAssociationTest extends AbstractTest {
addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
} else {
addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
@@ -203,6 +201,14 @@ public class AddAssociationTest extends AbstractTest {
addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
}
final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
@@ -226,6 +232,14 @@ public class AddAssociationTest extends AbstractTest {
addLiteralIntegerInClass2Description);
final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
addUnlimitedNaturalInClass2Description);
+ final Diff addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass1InAssociationDescription);
+ final Diff addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass2InAssociationDescription);
+ final Diff addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass1Description);
+ final Diff addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass2Description);
assertNotNull(addNavigableOwnedEndClass1InAssociation);
assertNotNull(addNavigableOwnedEndClass2InAssociation);
@@ -238,6 +252,10 @@ public class AddAssociationTest extends AbstractTest {
assertNotNull(addUnlimitedNaturalInClass1);
assertNotNull(addLiteralIntegerInClass2);
assertNotNull(addUnlimitedNaturalInClass2);
+ assertNotNull(addMemberEndClass1InAssociation);
+ assertNotNull(addMemberEndClass2InAssociation);
+ assertNotNull(addOwnedEndClass1InAssociation);
+ assertNotNull(addOwnedEndClass2InAssociation);
// CHECK EXTENSION
assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
@@ -250,7 +268,7 @@ public class AddAssociationTest extends AbstractTest {
instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
}
assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(11), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+ assertSame(Integer.valueOf(15), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass1InAssociation));
assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass2InAssociation));
@@ -262,89 +280,63 @@ public class AddAssociationTest extends AbstractTest {
assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2));
assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass2InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass2InAssociation));
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
.size()));
assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(
- addNavigableOwnedEndClass1InAssociation));
- // duplicate diff: requires Association.ownedEnd to class1s
+ addOwnedEndClass1InAssociation));
assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass1.getRequires().contains(
- addNavigableOwnedEndClass1InAssociation));
- // duplicate diff: requires Association.ownedEnd to class1s
+ assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addOwnedEndClass1InAssociation));
assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
.size()));
assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(
- addNavigableOwnedEndClass2InAssociation));
- // duplicate diff: requires Association.ownedEnd to class2s
+ addOwnedEndClass2InAssociation));
assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(addAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass2.getRequires().contains(
- addNavigableOwnedEndClass2InAssociation));
- // duplicate diff: requires Association.ownedEnd to class2s
+ assertTrue(addRefTypeInPropertyClass2.getRequires().contains(addOwnedEndClass2InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
+ assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
.getRequires().size()));
assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(addAssociation));
- // duplicate diff: requires Association.ownedEnd to class1s
+ assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
+ addOwnedEndClass1InAssociation));
- assertSame(Integer.valueOf(1), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
+ assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
.getRequires().size()));
assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(addAssociation));
- // duplicate diff: requires Association.ownedEnd to class2s
+ assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
+ addOwnedEndClass2InAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertTrue(addLiteralIntegerInClass1.getRequires().contains(
- addNavigableOwnedEndClass1InAssociation));
- // duplicate diff: requires Association.ownedEnd to class1s
+ assertTrue(addLiteralIntegerInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(
- addNavigableOwnedEndClass1InAssociation));
- // duplicate diff: requires Association.ownedEnd to class1s
+ assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
- assertTrue(addLiteralIntegerInClass2.getRequires().contains(
- addNavigableOwnedEndClass2InAssociation));
- // duplicate diff: requires Association.ownedEnd to class2s
+ assertTrue(addLiteralIntegerInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(
- addNavigableOwnedEndClass2InAssociation));
- // duplicate diff: requires Association.ownedEnd to class2s
+ assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
} else {
- assertSame(Integer.valueOf(4), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
+ assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
.getRequires().size()));
- // duplicate diff
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
- addLiteralIntegerInClass1));
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
- addUnlimitedNaturalInClass1));
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
- addRefAssociationInPropertyClass1));
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
- addRefTypeInPropertyClass1));
- assertSame(Integer.valueOf(4), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
+ assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
.getRequires().size()));
- // duplicate diff
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
- addLiteralIntegerInClass2));
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
- addUnlimitedNaturalInClass2));
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
- addRefAssociationInPropertyClass2));
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
- addRefTypeInPropertyClass2));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
.size()));
@@ -353,16 +345,15 @@ public class AddAssociationTest extends AbstractTest {
.size()));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
- assertSame(Integer.valueOf(4), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(8), Integer.valueOf(addAssociation.getRequires().size()));
assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass1InAssociation));
assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass2InAssociation));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass2));
- // duplicate diff: requires:
- // - Association.memberEnd to class1s
- // - Association.memberEnd to class2s
- // - Association.ownedEnd to class1s
- // - Association.ownedEnd to class2s
+ assertTrue(addAssociation.getRequires().contains(addOwnedEndClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addOwnedEndClass2InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addMemberEndClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addMemberEndClass2InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
index 45b1e1bc0..c608a1d58 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
@@ -138,14 +138,14 @@ public class ChangeAssociationTest extends AbstractTest {
final List<Diff> differences = comparison.getDifferences();
// We should have no less and no more than 5 differences
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
Predicate<? super Diff> addPropertyClass2Description = null;
Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
- // duplicate diff: Association.memberEnd to Class2
+ Predicate<? super Diff> addPropertyClass2InAssociationDescription = null;
if (kind.equals(TestKind.DELETE)) {
addPropertyClass2Description = removedFromReference("model.class1_class0_0", "ownedEnd",
@@ -156,6 +156,8 @@ public class ChangeAssociationTest extends AbstractTest {
"model.Class2", null);
addLiteralIntegerInClass2Description = removedLowerValueIn("model.class1_class0_0.Class2");
addUnlimitedNaturalInClass2Description = removedUpperValueIn("model.class1_class0_0.Class2");
+ addPropertyClass2InAssociationDescription = removedFromReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.Class2");
} else {
addPropertyClass2Description = addedToReference("model.class1_class0_0", "ownedEnd",
"model.class1_class0_0.Class2");
@@ -165,6 +167,8 @@ public class ChangeAssociationTest extends AbstractTest {
null, "model.Class2");
addLiteralIntegerInClass2Description = addedLowerValueIn("model.class1_class0_0.Class2");
addUnlimitedNaturalInClass2Description = addedUpperValueIn("model.class1_class0_0.Class2");
+ addPropertyClass2InAssociationDescription = addedToReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.Class2");
}
final Diff addPropertyClass2 = Iterators.find(differences.iterator(), addPropertyClass2Description);
@@ -176,12 +180,15 @@ public class ChangeAssociationTest extends AbstractTest {
addLiteralIntegerInClass2Description);
final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
addUnlimitedNaturalInClass2Description);
+ final Diff addPropertyClass2InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass2InAssociationDescription);
assertNotNull(addPropertyClass2);
assertNotNull(addRefAssociationInPropertyClass2);
assertNotNull(addRefTypeInPropertyClass2);
assertNotNull(addLiteralIntegerInClass2);
assertNotNull(addUnlimitedNaturalInClass2);
+ assertNotNull(addPropertyClass2InAssociation);
// CHECK EXTENSION
// No extension anymore
@@ -196,7 +203,6 @@ public class ChangeAssociationTest extends AbstractTest {
// assertTrue(changeUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
// assertTrue(changeUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2));
// assertTrue(changeUMLAssociation.getRefinedBy().contains(addPropertyClass2));
- // duplicate diff: Association.memberEnd to Class2
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
@@ -217,12 +223,12 @@ public class ChangeAssociationTest extends AbstractTest {
assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addPropertyClass2));
} else {
- assertSame(Integer.valueOf(4), Integer.valueOf(addPropertyClass2.getRequires().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass2.getRequires().size()));
assertTrue(addPropertyClass2.getRequires().contains(addLiteralIntegerInClass2));
assertTrue(addPropertyClass2.getRequires().contains(addUnlimitedNaturalInClass2));
assertTrue(addPropertyClass2.getRequires().contains(addRefAssociationInPropertyClass2));
assertTrue(addPropertyClass2.getRequires().contains(addRefTypeInPropertyClass2));
- // duplicate diff: Association.memberEnd to Class2
+ assertTrue(addPropertyClass2.getRequires().contains(addPropertyClass2InAssociation));
assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
.size()));
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
index d017da1ee..c00f08ce4 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
@@ -83,12 +83,13 @@ public class AddInterfaceRealizationTest extends AbstractTest {
final List<Diff> differences = comparison.getDifferences();
// We should have no less and no more than 6 differences
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
Predicate<? super Diff> addInterfaceRealizationDescription = null;
Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
if (kind.equals(TestKind.DELETE)) {
//addInterfaceRealizationDescription = removed("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
@@ -100,6 +101,8 @@ public class AddInterfaceRealizationTest extends AbstractTest {
"model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
addContractInInterfaceRealizationDescription = changedReference(
"model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
} else {
//addInterfaceRealizationDescription = added("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
addInterfaceRealizationDescription = addedToReference(
@@ -110,6 +113,8 @@ public class AddInterfaceRealizationTest extends AbstractTest {
"model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
addContractInInterfaceRealizationDescription = changedReference(
"model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
}
final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
@@ -120,12 +125,14 @@ public class AddInterfaceRealizationTest extends AbstractTest {
addSupplierInInterfaceRealizationDescription);
final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
addContractInInterfaceRealizationDescription);
- // duplicate diff: NamedElement.clientDependency to InterfaceRealization0
+ final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description);
assertNotNull(addInterfaceRealization);
assertNotNull(addClientInInterfaceRealization);
assertNotNull(addSupplierInInterfaceRealization);
assertNotNull(addContractInInterfaceRealization);
+ assertNotNull(addClientDependencyInClass0);
// CHECK EXTENSION
assertSame(Integer.valueOf(1), count(differences, instanceOf(InterfaceRealizationChange.class)));
@@ -138,12 +145,12 @@ public class AddInterfaceRealizationTest extends AbstractTest {
instanceOf(InterfaceRealizationChange.class), ofKind(DifferenceKind.DELETE)));
}
assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
- // duplicate diff: NamedElement.clientDependency to InterfaceRealization0
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
@@ -167,11 +174,11 @@ public class AddInterfaceRealizationTest extends AbstractTest {
assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
.size()));
- assertSame(Integer.valueOf(3), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
- // duplicate diff: NamedElement.clientDependency to InterfaceRealization0
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
}
@@ -183,8 +190,9 @@ public class AddInterfaceRealizationTest extends AbstractTest {
assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
.getDifferences().size()));
assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addInterfaceRealization));
- // duplicate diff: NamedElement.clientDependency to InterfaceRealization0
+ addClientInInterfaceRealization));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientDependencyInClass0));
testIntersections(comparison);
}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
index 72ef88bdf..ef78100d5 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
@@ -85,15 +85,15 @@ public class AddSubstitutionTest extends AbstractTest {
final List<Diff> differences = comparison.getDifferences();
// We should have no less and no more than 6 differences
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
Predicate<? super Diff> addInterfaceRealizationDescription = null;
Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
if (kind.equals(TestKind.DELETE)) {
- //addInterfaceRealizationDescription = removed("model.Class0.Substitution0"); //$NON-NLS-1$
addInterfaceRealizationDescription = removedFromReference("model.Class0", "substitution",
"model.Class0.Substitution0");
addClientInInterfaceRealizationDescription = removedFromReference("model.Class0.Substitution0",
@@ -102,8 +102,9 @@ public class AddSubstitutionTest extends AbstractTest {
"supplier", "model.Class1");
addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
"contract", "model.Class1", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.Substitution0");
} else {
- //addInterfaceRealizationDescription = added("model.Class0.Substitution0"); //$NON-NLS-1$
addInterfaceRealizationDescription = addedToReference(
"model.Class0", "substitution", "model.Class0.Substitution0"); //$NON-NLS-1$
addClientInInterfaceRealizationDescription = addedToReference("model.Class0.Substitution0",
@@ -112,6 +113,8 @@ public class AddSubstitutionTest extends AbstractTest {
"supplier", "model.Class1");
addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
"contract", null, "model.Class1");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.Substitution0");
}
final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
@@ -122,12 +125,14 @@ public class AddSubstitutionTest extends AbstractTest {
addSupplierInInterfaceRealizationDescription);
final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
addContractInInterfaceRealizationDescription);
- // duplicate diff NamedElement.clientDependency to Substitution0
+ final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description);
assertNotNull(addInterfaceRealization);
assertNotNull(addClientInInterfaceRealization);
assertNotNull(addSupplierInInterfaceRealization);
assertNotNull(addContractInInterfaceRealization);
+ assertNotNull(addClientDependencyInClass0);
// CHECK EXTENSION
assertSame(Integer.valueOf(1), count(differences, instanceOf(SubstitutionChange.class)));
@@ -140,12 +145,12 @@ public class AddSubstitutionTest extends AbstractTest {
instanceOf(SubstitutionChange.class), ofKind(DifferenceKind.DELETE)));
}
assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
- // duplicate diff NamedElement.clientDependency to Substitution0
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
// CHECK REQUIREMENT
if (kind.equals(TestKind.ADD)) {
@@ -169,11 +174,11 @@ public class AddSubstitutionTest extends AbstractTest {
assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
.size()));
- assertSame(Integer.valueOf(3), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
- // duplicate diff NamedElement.clientDependency to Substitution0
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
}
@@ -185,8 +190,9 @@ public class AddSubstitutionTest extends AbstractTest {
assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
.getDifferences().size()));
assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addInterfaceRealization));
- // duplicate diff NamedElement.clientDependency to Substitution0
+ addClientInInterfaceRealization));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientDependencyInClass0));
testIntersections(comparison);
}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java
new file mode 100644
index 000000000..d92cf52e6
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java
@@ -0,0 +1,1036 @@
+package org.eclipse.emf.compare.uml2.tests.implications;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractTest;
+import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ImplicationsAssociationTest extends AbstractTest {
+
+ private static final int NB_DIFFS = 16;
+
+ private ImplicationsInputData input = new ImplicationsInputData();
+
+ private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
+ final List<Diff> differences = comparison.getDifferences();
+ Predicate<? super Diff> addAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
+ Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addOwnedEndClass1Description = null;
+ Predicate<? super Diff> addOwnedEndClass2Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", "myModel.Class1", null);
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", "myModel.Class2", null);
+ addLiteralIntegerInClass1Description = removedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ } else {
+ addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", null, "myModel.Class1");
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", null, "myModel.Class2");
+ addLiteralIntegerInClass1Description = addedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ }
+
+ DiffsOfInterest diffs = new DiffsOfInterest();
+ diffs.addAssociation = Iterators.find(differences.iterator(), addAssociationDescription, null);
+ diffs.addNavigableOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass1InAssociationDescription, null);
+ diffs.addNavigableOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass2InAssociationDescription, null);
+ diffs.addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass1InAssociationDescription, null);
+ diffs.addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass2InAssociationDescription, null);
+ diffs.addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass1Description, null);
+ diffs.addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass2Description, null);
+ diffs.addUMLAssociation = Iterators.find(differences.iterator(), instanceOf(AssociationChange.class),
+ null);
+ diffs.addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass1Description, null);
+ diffs.addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass1Description, null);
+ diffs.addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass2Description, null);
+ diffs.addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass2Description, null);
+ diffs.addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass1Description, null);
+ diffs.addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass1Description, null);
+ diffs.addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass2Description, null);
+ diffs.addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass2Description, null);
+
+ return diffs;
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // local ADD
+ public void testA10UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // remote ADD
+ public void testA10UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeDeleteNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 1, comparison.getDifferences().size());
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeDeleteOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 7, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ assertNull(diffs.addLiteralIntegerInClass1);
+ assertNull(diffs.addUnlimitedNaturalInClass1);
+ assertNull(diffs.addRefTypeInPropertyClass1);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddMemberEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // local DELETE
+ public void testA11UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // remote DELETE
+ public void testA11UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 16 differences
+ assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
+
+ DiffsOfInterest diffs = getDiffs(comparison, kind);
+
+ if (kind.equals(TestKind.DELETE)) {
+ assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
+ assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addOwnedEndClass1InAssociation));
+
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addNavigableOwnedEndClass1InAssociation));
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addMemberEndClass1InAssociation));
+
+ assertEquals(1, diffs.addMemberEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addMemberEndClass1InAssociation.getImplies().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ assertEquals(0, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
+ } else {
+ assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
+
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addMemberEndClass1InAssociation));
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addNavigableOwnedEndClass1InAssociation));
+
+ assertEquals(0, diffs.addMemberEndClass1InAssociation.getImplies().size());
+ assertEquals(1, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addMemberEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ }
+
+ }
+
+ @Override
+ protected AbstractInputData getInput() {
+ return input;
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private class DiffsOfInterest {
+ public Diff addAssociation;
+
+ public Diff addNavigableOwnedEndClass1InAssociation;
+
+ public Diff addNavigableOwnedEndClass2InAssociation;
+
+ public Diff addMemberEndClass1InAssociation;
+
+ public Diff addMemberEndClass2InAssociation;
+
+ public Diff addOwnedEndClass1InAssociation;
+
+ public Diff addOwnedEndClass2InAssociation;
+
+ public Diff addRefAssociationInPropertyClass1;
+
+ public Diff addRefTypeInPropertyClass1;
+
+ public Diff addRefAssociationInPropertyClass2;
+
+ public Diff addRefTypeInPropertyClass2;
+
+ public Diff addLiteralIntegerInClass1;
+
+ public Diff addUnlimitedNaturalInClass1;
+
+ public Diff addLiteralIntegerInClass2;
+
+ public Diff addUnlimitedNaturalInClass2;
+
+ public Diff addUMLAssociation;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java
new file mode 100644
index 000000000..ae93da81f
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java
@@ -0,0 +1,962 @@
+package org.eclipse.emf.compare.uml2.tests.implications;
+
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.compare.uml2.internal.InterfaceRealizationChange;
+import org.eclipse.emf.compare.uml2.internal.SubstitutionChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractTest;
+import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ImplicationsInterfaceRealizationTest extends AbstractTest {
+
+ private static final int NB_DIFFS = 11;
+
+ private ImplicationsInputData input = new ImplicationsInputData();
+
+ private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ Predicate<? super Diff> addInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
+ Predicate<? super Diff> addSubstitutionDescription = null;
+ Predicate<? super Diff> addClientInSubstitutionDescription = null;
+ Predicate<? super Diff> addSupplierInSubstitutionDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description2 = null;
+ Predicate<? super Diff> addUMLInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addUMLSubstitutionDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addInterfaceRealizationDescription = removedFromReference("model.Class0", "interfaceRealization",
+ "model.Class0.InterfaceRealization0");
+ addClientInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ addSubstitutionDescription = removedFromReference("model.Class0", "substitution",
+ "model.Class0.substitution1");
+ addClientInSubstitutionDescription = removedFromReference("model.Class0.substitution1", "client",
+ "model.Class0");
+ addSupplierInSubstitutionDescription = removedFromReference("model.Class0.substitution1",
+ "supplier", "model.Interface0");
+ addClientDependencyInClass0Description2 = removedFromReference("model.Class0",
+ "clientDependency", "model.Class0.substitution1");
+ } else {
+ addInterfaceRealizationDescription = addedToReference(
+ "model.Class0", "interfaceRealization", "model.Class0.InterfaceRealization0"); //$NON-NLS-1$
+ addClientInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ addSubstitutionDescription = addedToReference("model.Class0", "substitution",
+ "model.Class0.substitution1");
+ addClientInSubstitutionDescription = addedToReference("model.Class0.substitution1", "client",
+ "model.Class0");
+ addSupplierInSubstitutionDescription = addedToReference("model.Class0.substitution1", "supplier",
+ "model.Interface0");
+ addClientDependencyInClass0Description2 = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.substitution1");
+ }
+
+ DiffsOfInterest diffs = new DiffsOfInterest();
+ diffs.addInterfaceRealization = Iterators.find(differences.iterator(),
+ addInterfaceRealizationDescription, null);
+ diffs.addClientInInterfaceRealization = Iterators.find(differences.iterator(),
+ addClientInInterfaceRealizationDescription, null);
+ diffs.addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
+ addSupplierInInterfaceRealizationDescription, null);
+ diffs.addContractInInterfaceRealization = Iterators.find(differences.iterator(),
+ addContractInInterfaceRealizationDescription, null);
+ diffs.addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description, null);
+ diffs.addSubstitution = Iterators.find(differences.iterator(), addSubstitutionDescription, null);
+ diffs.addClientInSubstitution = Iterators.find(differences.iterator(),
+ addClientInSubstitutionDescription, null);
+ diffs.addSupplierInSubstitution = Iterators.find(differences.iterator(),
+ addSupplierInSubstitutionDescription, null);
+ diffs.addClientDependencyInClass02 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description2, null);
+ diffs.addUMLInterfaceRealization = Iterators.find(differences.iterator(),
+ instanceOf(InterfaceRealizationChange.class), null);
+ diffs.addUMLSubstitution = Iterators.find(differences.iterator(),
+ instanceOf(SubstitutionChange.class), null);
+ return diffs;
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // local ADD
+ public void testA10UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // remote ADD
+ public void testA10UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeAddClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeDeleteClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ private void checkMergeAddClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ private void checkMergeDeleteClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeAddInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeDeleteInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // local DELETE
+ public void testA11UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // remote DELETE
+ public void testA11UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
+
+ DiffsOfInterest diffs = getDiffs(comparison, kind);
+
+ if (kind.equals(TestKind.DELETE)) {
+ assertEquals(1, diffs.addClientDependencyInClass0.getImplies().size());
+ assertTrue(diffs.addClientDependencyInClass0.getImplies().contains(diffs.addInterfaceRealization));
+
+ assertEquals(1, diffs.addClientDependencyInClass02.getImplies().size());
+ assertTrue(diffs.addClientDependencyInClass02.getImplies().contains(diffs.addSubstitution));
+ } else {
+ assertEquals(1, diffs.addInterfaceRealization.getImplies().size());
+ assertTrue(diffs.addInterfaceRealization.getImplies().contains(diffs.addClientDependencyInClass0));
+
+ assertEquals(1, diffs.addSubstitution.getImplies().size());
+ assertTrue(diffs.addSubstitution.getImplies().contains(diffs.addClientDependencyInClass02));
+ }
+ assertEquals(0, diffs.addClientInInterfaceRealization.getImplies().size());
+ assertEquals(0, diffs.addClientInSubstitution.getImplies().size());
+
+ }
+
+ @Override
+ protected AbstractInputData getInput() {
+ return input;
+ }
+
+ private class DiffsOfInterest {
+ public Diff addInterfaceRealization;
+
+ public Diff addClientInInterfaceRealization;
+
+ public Diff addSupplierInInterfaceRealization;
+
+ public Diff addContractInInterfaceRealization;
+
+ public Diff addClientDependencyInClass0;
+
+ public Diff addSubstitution;
+
+ public Diff addClientInSubstitution;
+
+ public Diff addSupplierInSubstitution;
+
+ public Diff addClientDependencyInClass02;
+
+ public Diff addUMLInterfaceRealization;
+
+ public Diff addUMLSubstitution;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java
new file mode 100644
index 000000000..df677a5bd
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java
@@ -0,0 +1,901 @@
+package org.eclipse.emf.compare.uml2.tests.implications;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.compare.uml2.tests.AbstractTest;
+import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ImplicationsTransitionTest extends AbstractTest {
+
+ private static final int NB_DIFFS = 6;
+
+ private ImplicationsInputData input = new ImplicationsInputData();
+
+ private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
+ final List<Diff> differences = comparison.getDifferences();
+ Predicate<? super Diff> addTransitionDescription = null;
+ Predicate<? super Diff> addPreConditionDescription = null;
+ Predicate<? super Diff> addOwnedRuleDescription = null;
+ Predicate<? super Diff> addGuardDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addTransitionDescription = removed("model.StateMachine0.Region0.transition1"); //$NON-NLS-1$
+ addPreConditionDescription = changedReference("model.StateMachine0.Region0.transition1",
+ "preCondition", "model.StateMachine0.Region0.transition1.rule1", null);
+ addOwnedRuleDescription = removedFromReference("model.StateMachine0.Region0.transition1",
+ "ownedRule", "model.StateMachine0.Region0.transition1.rule1");
+ addGuardDescription = changedReference("model.StateMachine0.Region0.transition1", "guard",
+ "model.StateMachine0.Region0.transition1.rule1", null);
+ } else {
+ addTransitionDescription = added("model.StateMachine0.Region0.transition1"); //$NON-NLS-1$
+ addPreConditionDescription = changedReference("model.StateMachine0.Region0.transition1",
+ "preCondition", null, "model.StateMachine0.Region0.transition1.rule1");
+ addOwnedRuleDescription = addedToReference("model.StateMachine0.Region0.transition1",
+ "ownedRule", "model.StateMachine0.Region0.transition1.rule1");
+ addGuardDescription = changedReference("model.StateMachine0.Region0.transition1", "guard", null,
+ "model.StateMachine0.Region0.transition1.rule1");
+ }
+
+ DiffsOfInterest diffs = new DiffsOfInterest();
+ diffs.addTransition = Iterators.find(differences.iterator(), addTransitionDescription, null);
+ diffs.addPrecondition = Iterators.find(differences.iterator(), addPreConditionDescription, null);
+ diffs.addOwnedRule = Iterators.find(differences.iterator(), addOwnedRuleDescription, null);
+ diffs.addGuard = Iterators.find(differences.iterator(), addGuardDescription, null);
+
+ return diffs;
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // local ADD
+ public void testA10UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // remote ADD
+ public void testA10UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ private void checkMergeAddPrecondition(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
+ assertNull(diffs.addPrecondition);
+ assertNull(diffs.addGuard);
+ assertNull(diffs.addOwnedRule);
+ assertNull(diffs.addTransition);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ private void checkMergeDeletePrecondition(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 1, comparison.getDifferences().size());
+ assertNull(diffs.addPrecondition);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ private void checkMergeAddGuard(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
+ assertNull(diffs.addGuard);
+ assertNull(diffs.addOwnedRule);
+ assertNull(diffs.addTransition);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ private void checkMergeDeleteGuard(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 2, comparison.getDifferences().size());
+ assertNull(diffs.addGuard);
+ assertNull(diffs.addPrecondition);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ private void checkMergeAddOwnedRule(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 2, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedRule);
+ assertNull(diffs.addTransition);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ private void checkMergeDeleteOwnedRule(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedRule);
+ assertNull(diffs.addGuard);
+ assertNull(diffs.addPrecondition);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // local DELETE
+ public void testA11UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // remote DELETE
+ public void testA11UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddPrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
+ diffs.addPrecondition, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeletePrecondition(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteGuard(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA2Right();
+ final Resource right = input.getA2Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedRule(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyRightToLeft(diffs.addOwnedRule,
+ new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedRule(comparison, diffs);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
+
+ DiffsOfInterest diffs = getDiffs(comparison, kind);
+
+ if (kind.equals(TestKind.DELETE)) {
+ assertEquals(0, diffs.addPrecondition.getImplies().size());
+ assertEquals(1, diffs.addPrecondition.getImpliedBy().size());
+ assertTrue(diffs.addPrecondition.getImpliedBy().contains(diffs.addGuard));
+
+ assertEquals(1, diffs.addGuard.getImplies().size());
+ assertTrue(diffs.addGuard.getImplies().contains(diffs.addPrecondition));
+ assertEquals(1, diffs.addGuard.getImpliedBy().size());
+ assertTrue(diffs.addGuard.getImpliedBy().contains(diffs.addOwnedRule));
+
+ assertEquals(1, diffs.addOwnedRule.getImplies().size());
+ assertTrue(diffs.addOwnedRule.getImplies().contains(diffs.addGuard));
+ assertEquals(0, diffs.addOwnedRule.getImpliedBy().size());
+ } else {
+ assertEquals(1, diffs.addPrecondition.getImplies().size());
+ assertTrue(diffs.addPrecondition.getImplies().contains(diffs.addGuard));
+ assertEquals(0, diffs.addPrecondition.getImpliedBy().size());
+
+ assertEquals(1, diffs.addGuard.getImplies().size());
+ assertTrue(diffs.addGuard.getImplies().contains(diffs.addOwnedRule));
+ assertEquals(1, diffs.addGuard.getImpliedBy().size());
+ assertTrue(diffs.addGuard.getImpliedBy().contains(diffs.addPrecondition));
+
+ assertEquals(0, diffs.addOwnedRule.getImplies().size());
+ assertEquals(1, diffs.addOwnedRule.getImpliedBy().size());
+ assertTrue(diffs.addOwnedRule.getImpliedBy().contains(diffs.addGuard));
+ }
+
+ }
+
+ @Override
+ protected AbstractInputData getInput() {
+ return input;
+ }
+
+ private class DiffsOfInterest {
+ public Diff addTransition;
+
+ public Diff addPrecondition;
+
+ public Diff addOwnedRule;
+
+ public Diff addGuard;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/ImplicationsInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/ImplicationsInputData.java
new file mode 100644
index 000000000..05471387f
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/ImplicationsInputData.java
@@ -0,0 +1,41 @@
+package org.eclipse.emf.compare.uml2.tests.implications.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;
+
+public class ImplicationsInputData extends AbstractInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ public Resource getA3Left() throws IOException {
+ return loadFromClassLoader("a3/left.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ public Resource getA3Right() throws IOException {
+ return loadFromClassLoader("a3/right.uml", createResourceSet()); //$NON-NLS-1$
+ }
+
+ private ResourceSet createResourceSet() {
+ final ResourceSet resourceSet = new ResourceSetImpl();
+ UMLResourcesUtil.init(resourceSet);
+ return resourceSet;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/left.uml
new file mode 100644
index 000000000..f3673bd07
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/left.uml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+ <packagedElement xmi:type="uml:Association" xmi:id="_n8aCMF9kEeC2jdN7B1dxQw" name="class1sToClass2s" memberEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw" navigableOwnedEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw">
+ <ownedEnd xmi:id="_n8bQUF9kEeC2jdN7B1dxQw" name="class1s" type="_eOr_sF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8dskF9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8eToF9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ <ownedEnd xmi:id="_n8e6sF9kEeC2jdN7B1dxQw" name="class2s" type="_epJuIF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8gv4F9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8hW8F9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/right.uml
new file mode 100644
index 000000000..ccc31d41c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/right.uml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/left.uml
new file mode 100644
index 000000000..e75d3ce82
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/left.uml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_gJeW8NfvEeKprMYB98qQlQ" name="model">
+ <packagedElement xmi:type="uml:StateMachine" xmi:id="_gM6FcNfvEeKprMYB98qQlQ" name="StateMachine0">
+ <region xmi:id="_gM6FcdfvEeKprMYB98qQlQ" name="Region0">
+ <transition xmi:type="uml:ProtocolTransition" xmi:id="_LphrgNfwEeKprMYB98qQlQ" name="transition1" guard="_aigAANfyEeKprMYB98qQlQ" preCondition="_aigAANfyEeKprMYB98qQlQ">
+ <ownedRule xmi:id="_aigAANfyEeKprMYB98qQlQ" name="rule1"/>
+ <ownedRule xmi:id="_fWcQINfyEeKprMYB98qQlQ" name="rule2"/>
+ <ownedRule xmi:id="_g76ZINfyEeKprMYB98qQlQ" name="guard1"/>
+ </transition>
+ <subvertex xmi:type="uml:State" xmi:id="_jgDRMNfvEeKprMYB98qQlQ" name="State0"/>
+ <subvertex xmi:type="uml:State" xmi:id="_lFPGUNfvEeKprMYB98qQlQ" name="State1"/>
+ </region>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/right.uml
new file mode 100644
index 000000000..573b4533a
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/right.uml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_gJeW8NfvEeKprMYB98qQlQ" name="model">
+ <packagedElement xmi:type="uml:StateMachine" xmi:id="_gM6FcNfvEeKprMYB98qQlQ" name="StateMachine0">
+ <region xmi:id="_gM6FcdfvEeKprMYB98qQlQ" name="Region0">
+ <subvertex xmi:type="uml:State" xmi:id="_jgDRMNfvEeKprMYB98qQlQ" name="State0"/>
+ <subvertex xmi:type="uml:State" xmi:id="_lFPGUNfvEeKprMYB98qQlQ" name="State1"/>
+ </region>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/left.uml
new file mode 100644
index 000000000..f93c9a32b
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/left.uml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_SSnEIIYEEeC_LdOTKS1r7g" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_WNoqEYYWEeCV1bmJqi-tSQ" clientDependency="_epYHUIYWEeCV1bmJqi-tSQ _I1OzkNgfEeKUpal9fab9XA" name="Class0">
+ <substitution xmi:id="_I1OzkNgfEeKUpal9fab9XA" name="substitution1" client="_WNoqEYYWEeCV1bmJqi-tSQ" supplier="_XMJgwIYWEeCV1bmJqi-tSQ"/>
+ <interfaceRealization xmi:id="_epYHUIYWEeCV1bmJqi-tSQ" name="InterfaceRealization0" client="_WNoqEYYWEeCV1bmJqi-tSQ" supplier="_XMJgwIYWEeCV1bmJqi-tSQ" contract="_XMJgwIYWEeCV1bmJqi-tSQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_XMJgwIYWEeCV1bmJqi-tSQ" name="Interface0"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/right.uml
new file mode 100644
index 000000000..d2b1a2ecc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a3/right.uml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_SSnEIIYEEeC_LdOTKS1r7g" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_WNoqEYYWEeCV1bmJqi-tSQ" name="Class0"/>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_XMJgwIYWEeCV1bmJqi-tSQ" name="Interface0"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
index e2a648b22..35b5666b2 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
@@ -31,6 +31,9 @@ import org.eclipse.emf.compare.uml2.tests.executionSpecification.AddActionExecut
import org.eclipse.emf.compare.uml2.tests.executionSpecification.AddBehaviorExecutionSpecificationTest;
import org.eclipse.emf.compare.uml2.tests.extend.AddExtendTest;
import org.eclipse.emf.compare.uml2.tests.generalizationSet.AddGeneralizationSetTest;
+import org.eclipse.emf.compare.uml2.tests.implications.ImplicationsAssociationTest;
+import org.eclipse.emf.compare.uml2.tests.implications.ImplicationsInterfaceRealizationTest;
+import org.eclipse.emf.compare.uml2.tests.implications.ImplicationsTransitionTest;
import org.eclipse.emf.compare.uml2.tests.include.AddIncludeTest;
import org.eclipse.emf.compare.uml2.tests.merge.ExtensionMergeTest;
import org.eclipse.emf.compare.uml2.tests.message.AddMessageTest;
@@ -55,7 +58,8 @@ import org.junit.runners.Suite.SuiteClasses;
AddSubstitutionTest.class, AddUsageTest.class, AddMessageTest.class,
AddActionExecutionSpecificationTest.class, AddBehaviorExecutionSpecificationTest.class,
AddIncludeTest.class, AddTimeConstraintTest.class, ProfileTest.class, DynamicStereotypeTest.class,
- StaticStereotypeTest.class })
+ StaticStereotypeTest.class, ImplicationsAssociationTest.class, ImplicationsTransitionTest.class,
+ ImplicationsInterfaceRealizationTest.class })
public class AllTests {
/**

Back to the top