Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2014-03-13 12:04:17 +0000
committerLaurent Goubet2014-03-13 12:05:08 +0000
commit286c8af9cd4992a33779149fef0c455e655af690 (patch)
treeba4097c147b47b00a6224780620e8aad39bbba54
parent8538ce3ddd29ad2248400e18734649e84e8da7f6 (diff)
downloadorg.eclipse.emf.compare-286c8af9cd4992a33779149fef0c455e655af690.tar.gz
org.eclipse.emf.compare-286c8af9cd4992a33779149fef0c455e655af690.tar.xz
org.eclipse.emf.compare-286c8af9cd4992a33779149fef0c455e655af690.zip
normalize EOLs in the core (first pass)
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomMediaWikiLanguage.java106
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomTableOfContentsBlock.java202
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/PrimaryTOCWriter.java220
-rw-r--r--packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java1284
-rw-r--r--plugins/org.eclipse.emf.compare.doc/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.jdt.ui.prefs120
-rw-r--r--plugins/org.eclipse.emf.compare.edit/build.properties42
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/AttributeChangeItemProvider.java342
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/CompareItemProviderAdapterFactory.java628
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java368
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/DiffItemProvider.java682
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/EquivalenceItemProvider.java302
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchItemProvider.java476
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchResourceItemProvider.java528
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ReferenceChangeItemProvider.java322
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ResourceAttachmentChangeItemProvider.java304
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/DelegatingCommandStack.java268
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCommandStack.java92
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCopyCommand.java56
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/AbstractCopyCommand.java182
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/CompareCommandStack.java744
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/DualCompareCommandStack.java574
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/MergeCommand.java134
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/domain/IMergeRunnable.java78
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedAdapterFactoryItemDelegator.java168
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedItemProviderDecorator.java226
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ForwardingItemProvider.java822
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java94
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/ComposedStyledString.java316
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/IStyledString.java846
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/.project56
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.jdt.ui.prefs120
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/build.properties14
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/pom.xml84
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/Activator.java80
-rw-r--r--plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/suite/AllTests.java84
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/.project56
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.jdt.ui.prefs120
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/build.properties14
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/pom.xml84
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/Activator.java80
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/CompareTestCase.java478
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java86
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java414
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/workspace/TestProject.java306
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/org.eclipse.emf.compare.tests/.project56
-rw-r--r--plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.jdt.ui.prefs120
-rw-r--r--plugins/org.eclipse.emf.compare.tests/build.properties40
-rw-r--r--plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel94
-rw-r--r--plugins/org.eclipse.emf.compare.tests/plugin.xml88
-rw-r--r--plugins/org.eclipse.emf.compare.tests/pom.xml100
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/Node.java168
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValueReference.java110
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValuedAttribute.java110
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultipleContainment.java144
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefManyToMany.java152
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToMany.java172
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToOne.java190
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueAttribute.java128
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueContainment.java128
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueReference.java128
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java276
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java2160
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeImpl.java472
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValueReferenceImpl.java298
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValuedAttributeImpl.java328
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultipleContainmentImpl.java406
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefManyToManyImpl.java438
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToManyImpl.java544
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToOneImpl.java626
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueAttributeImpl.java358
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueContainmentImpl.java432
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueReferenceImpl.java346
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java418
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java994
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java594
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceFactoryImpl.java112
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceImpl.java108
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java682
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/EMFCompareTestsPlugin.java80
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/AbstractTestCompareCommandStack.java1112
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/CommandStackTestSuite.java50
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/MockCompareCommand.java268
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareCommandStack.java64
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareSideCommandStack.java380
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestDualCompareCommandStack.java64
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java4336
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java1224
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/ComparisonUtilTest.java240
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/LCSPerformanceTest.java322
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/URIDistanceTest.java316
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/AllEditTests.java50
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestAttributeChangeItemProviderSpec.java88
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ResourceScopeProvider.java54
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryLeft.ecore218
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryOrigin.ecore222
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryRight.ecore224
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/EquiComputingTest.java2226
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/data/EquiInputData.java676
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/FragmentationTest.java2530
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/data/FragmentationInputData.java162
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractInputData.java202
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractMatchValidator.java112
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareAssert.java588
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareTestBase.java92
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/IdentifierMatchValidator.java202
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/NotifierTuple.java148
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/EMFCompareTestRunner.java152
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/BeforeMatch.java80
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/ConflictTest.java130
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/DiffTest.java130
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/MatchTest.java112
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/UseCase.java64
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ConflictStatement.java374
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/DiffStatement.java360
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/MatchStatement.java318
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ResultStatement.java60
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseRunner.java254
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseStatement.java144
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/DynamicInstanceComparisonTest.java202
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/IdentifierComparisonTest.java758
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/MatchPerformanceComparisonTest.java190
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-ancestor.ecore10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-left.ecore16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-right.ecore10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-left.ecore10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-right.ecore22
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-left.ecore46
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-right.ecore46
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/DistanceMatchInputData.java218
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norename.ecore14
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norenamev2.ecore16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-delete.ecore16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-deletev2.ecore22
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-delete.ecore14
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-deletev2.ecore12
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/dynamic/DynamicInstancesInputData.java180
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/IdentifierMatchInputData.java72
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryLeft.ecore218
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryOrigin.ecore222
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryRight.ecore224
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ExtensionMergeTest.java190
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeOutOfScopeValuesTest.java4372
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeTest.java4776
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/MultipleMergeTest.java2254
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java672
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/postprocess/data/PostProcessInputData.java52
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/ReqComputingTest.java3334
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/data/ReqInputData.java836
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/scope/DefaultComparisonScopeTest.java538
166 files changed, 31090 insertions, 31076 deletions
diff --git a/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.resources.prefs b/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.resources.prefs
index 4824b8026..99f26c020 100644
--- a/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.resources.prefs
+++ b/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.runtime.prefs b/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/packaging/org.eclipse.emf.compare.gendoc/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomMediaWikiLanguage.java b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomMediaWikiLanguage.java
index ed3ea1870..9fccd12dd 100644
--- a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomMediaWikiLanguage.java
+++ b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomMediaWikiLanguage.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.doc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.mylyn.internal.wikitext.mediawiki.core.block.TableOfContentsBlock;
-import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
-import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
-import org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- *
- */
-public class CustomMediaWikiLanguage extends MediaWikiLanguage {
-
- public CustomMediaWikiLanguage() {
- super();
- setName("CustomMediaWikiLanguage");
- }
-
- @Override
- protected void addStandardBlocks(List<Block> blocks,
- List<Block> paragraphBreakingBlocks) {
- super.addStandardBlocks(blocks, paragraphBreakingBlocks);
- CustomTableOfContentsBlock customTOCBlock = new CustomTableOfContentsBlock();
- replaceTOCBlock(blocks, customTOCBlock);
- replaceTOCBlock(paragraphBreakingBlocks, customTOCBlock);
- }
-
- private void replaceTOCBlock(List<Block> blocksList, CustomTableOfContentsBlock customTOCBlock) {
- for (Block block : new ArrayList<>(blocksList)) {
- if (block instanceof TableOfContentsBlock) {
-
- blocksList.set(blocksList.indexOf(block), customTOCBlock);
- }
- }
- }
-
- @Override
- public MarkupLanguage clone() {
- return (CustomMediaWikiLanguage) super.clone();
- }
+/*******************************************************************************
+ * Copyright (c) 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.doc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.mylyn.internal.wikitext.mediawiki.core.block.TableOfContentsBlock;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
+import org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ *
+ */
+public class CustomMediaWikiLanguage extends MediaWikiLanguage {
+
+ public CustomMediaWikiLanguage() {
+ super();
+ setName("CustomMediaWikiLanguage");
+ }
+
+ @Override
+ protected void addStandardBlocks(List<Block> blocks,
+ List<Block> paragraphBreakingBlocks) {
+ super.addStandardBlocks(blocks, paragraphBreakingBlocks);
+ CustomTableOfContentsBlock customTOCBlock = new CustomTableOfContentsBlock();
+ replaceTOCBlock(blocks, customTOCBlock);
+ replaceTOCBlock(paragraphBreakingBlocks, customTOCBlock);
+ }
+
+ private void replaceTOCBlock(List<Block> blocksList, CustomTableOfContentsBlock customTOCBlock) {
+ for (Block block : new ArrayList<>(blocksList)) {
+ if (block instanceof TableOfContentsBlock) {
+
+ blocksList.set(blocksList.indexOf(block), customTOCBlock);
+ }
+ }
+ }
+
+ @Override
+ public MarkupLanguage clone() {
+ return (CustomMediaWikiLanguage) super.clone();
+ }
} \ No newline at end of file
diff --git a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomTableOfContentsBlock.java b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomTableOfContentsBlock.java
index a4b3017d9..ce369edaf 100644
--- a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomTableOfContentsBlock.java
+++ b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/CustomTableOfContentsBlock.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.doc;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.mylyn.internal.wikitext.mediawiki.core.block.TableOfContentsBlock;
-import org.eclipse.mylyn.wikitext.core.parser.Attributes;
-import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;
-import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
-import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineParser;
-import org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- *
- */
-public class CustomTableOfContentsBlock extends TableOfContentsBlock {
-
- static final Pattern startPattern = Pattern.compile("\\s*__TOC__\\s*(.*?)"); //$NON-NLS-1$
-
- private int blockLineNumber = 0;
-
- private Matcher matcher;
-
- protected void emitToc(OutlineItem item) {
- if (item.getChildren().isEmpty()) {
- return;
- }
- if ((item.getLevel() + 1) > maxLevel) {
- return;
- }
- Attributes nullAttributes = new Attributes();
-
- builder.beginBlock(BlockType.NUMERIC_LIST, new Attributes(null, null, "list-style: none", null)); //$NON-NLS-1$ //$NON-NLS-2$
- for (OutlineItem child : item.getChildren()) {
- builder.beginBlock(BlockType.LIST_ITEM, nullAttributes);
- builder.link('#' + child.getId(), child.getLabel());
- emitToc(child);
- builder.endBlock();
- }
- builder.endBlock();
- }
-
- @Override
- public int processLineContent(String line, int offset) {
- if (blockLineNumber++ > 0) {
- setClosed(true);
- return 0;
- }
-
- if (!getMarkupLanguage().isFilterGenerativeContents()) {
- OutlineParser outlineParser = new OutlineParser(new MediaWikiLanguage());
- OutlineItem rootItem = outlineParser.parse(state.getMarkupContent());
-
- builder.beginBlock(BlockType.DIV, new Attributes(null, "toc", null, null));
- builder.beginHeading(3, new Attributes(null, "toc-title", null, null));
- builder.characters("Table of Contents");
- builder.endHeading();
-
- if (rootItem.getChildren().size() == 1 && rootItem.getChildren().get(0).getLevel() == 1) {
- emitToc(rootItem.getChildren().get(0));
- } else {
- emitToc(rootItem);
- }
-
- builder.endBlock();
- }
- int start = matcher.start(1);
- if (start > 0) {
- setClosed(true);
- }
- return start;
- }
-
- @Override
- public boolean canStart(String line, int lineOffset) {
- if (lineOffset == 0 && !getMarkupLanguage().isFilterGenerativeContents()) {
- matcher = startPattern.matcher(line);
- blockLineNumber = 0;
- return matcher.matches();
- } else {
- matcher = null;
- return false;
- }
- }
-
- @Override
- public CustomTableOfContentsBlock clone() {
- return (CustomTableOfContentsBlock) super.clone();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.doc;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.internal.wikitext.mediawiki.core.block.TableOfContentsBlock;
+import org.eclipse.mylyn.wikitext.core.parser.Attributes;
+import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;
+import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
+import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineParser;
+import org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ *
+ */
+public class CustomTableOfContentsBlock extends TableOfContentsBlock {
+
+ static final Pattern startPattern = Pattern.compile("\\s*__TOC__\\s*(.*?)"); //$NON-NLS-1$
+
+ private int blockLineNumber = 0;
+
+ private Matcher matcher;
+
+ protected void emitToc(OutlineItem item) {
+ if (item.getChildren().isEmpty()) {
+ return;
+ }
+ if ((item.getLevel() + 1) > maxLevel) {
+ return;
+ }
+ Attributes nullAttributes = new Attributes();
+
+ builder.beginBlock(BlockType.NUMERIC_LIST, new Attributes(null, null, "list-style: none", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ for (OutlineItem child : item.getChildren()) {
+ builder.beginBlock(BlockType.LIST_ITEM, nullAttributes);
+ builder.link('#' + child.getId(), child.getLabel());
+ emitToc(child);
+ builder.endBlock();
+ }
+ builder.endBlock();
+ }
+
+ @Override
+ public int processLineContent(String line, int offset) {
+ if (blockLineNumber++ > 0) {
+ setClosed(true);
+ return 0;
+ }
+
+ if (!getMarkupLanguage().isFilterGenerativeContents()) {
+ OutlineParser outlineParser = new OutlineParser(new MediaWikiLanguage());
+ OutlineItem rootItem = outlineParser.parse(state.getMarkupContent());
+
+ builder.beginBlock(BlockType.DIV, new Attributes(null, "toc", null, null));
+ builder.beginHeading(3, new Attributes(null, "toc-title", null, null));
+ builder.characters("Table of Contents");
+ builder.endHeading();
+
+ if (rootItem.getChildren().size() == 1 && rootItem.getChildren().get(0).getLevel() == 1) {
+ emitToc(rootItem.getChildren().get(0));
+ } else {
+ emitToc(rootItem);
+ }
+
+ builder.endBlock();
+ }
+ int start = matcher.start(1);
+ if (start > 0) {
+ setClosed(true);
+ }
+ return start;
+ }
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ if (lineOffset == 0 && !getMarkupLanguage().isFilterGenerativeContents()) {
+ matcher = startPattern.matcher(line);
+ blockLineNumber = 0;
+ return matcher.matches();
+ } else {
+ matcher = null;
+ return false;
+ }
+ }
+
+ @Override
+ public CustomTableOfContentsBlock clone() {
+ return (CustomTableOfContentsBlock) super.clone();
+ }
+}
diff --git a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/PrimaryTOCWriter.java b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/PrimaryTOCWriter.java
index 2c6c09faa..83d5afc5b 100644
--- a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/PrimaryTOCWriter.java
+++ b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/PrimaryTOCWriter.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.doc;
-
-import java.io.StringWriter;
-import java.io.Writer;
-import java.nio.file.Path;
-
-import org.eclipse.mylyn.wikitext.core.util.DefaultXmlStreamWriter;
-import org.eclipse.mylyn.wikitext.core.util.FormattingXMLStreamWriter;
-import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- *
- */
-public class PrimaryTOCWriter {
-
- private StringWriter primaryTOCOut;
- private XmlStreamWriter primaryTOCWriter;
-
- private StringWriter pluginOut;
- private XmlStreamWriter pluginWriter;
- private Path baseDir;
-
- void startPrimaryTOC(Path indexHTMLFile, String title) {
- baseDir = indexHTMLFile.getParent();
- primaryTOCOut = new StringWriter(8096);
- primaryTOCWriter = createXmlStreamWriter(primaryTOCOut);
-
- pluginOut = new StringWriter(8096);
- pluginWriter = createXmlStreamWriter(pluginOut);
-
- primaryTOCWriter.writeStartDocument("UTF-8", "1.0");
- primaryTOCWriter.writeStartElement("toc");
- primaryTOCWriter.writeAttribute("topic", indexHTMLFile.toString());
- primaryTOCWriter.writeAttribute("label", title);
-
- pluginWriter.writeStartDocument("UTF-8", "1.0");
- pluginWriter.writeLiteral("\n<?eclipse version=\"3.2\"?>\n");
- pluginWriter.writeStartElement("plugin");
-
- pluginWriter.writeStartElement("extension");
- pluginWriter.writeAttribute("point", "org.eclipse.help.toc");
-
- pluginWriter.writeEmptyElement("toc");
- pluginWriter.writeAttribute("file", "help/toc.xml");
- pluginWriter.writeAttribute("primary", "true");
-
- pluginWriter.writeEndElement();
-
- pluginWriter.writeStartElement("extension");
- pluginWriter.writeAttribute("point", "org.eclipse.help.toc");
-
- }
-
- void endPrimaryTOC() {
- primaryTOCWriter.writeEndElement();
- primaryTOCWriter.writeEndDocument();
- primaryTOCWriter.close();
-
- pluginWriter.writeEndElement();
- pluginWriter.writeEndElement();
- pluginWriter.writeEndDocument();
- pluginWriter.close();
- }
-
- void startTopic(String label, Path href) {
- primaryTOCWriter.writeStartElement("topic");
- primaryTOCWriter.writeAttribute("label", label);
-
- if (href != null) {
- primaryTOCWriter.writeAttribute("href", href.toString());
- }
- }
-
- void createLink(Path linkedTOC) {
- primaryTOCWriter.writeStartElement("link");
- primaryTOCWriter.writeAttribute("toc", baseDir.resolve(linkedTOC).toString());
- primaryTOCWriter.writeEndElement();
-
- pluginWriter.writeEmptyElement("toc");
- pluginWriter.writeAttribute("file", baseDir.resolve(linkedTOC).toString());
- }
-
- void endTopic() {
- primaryTOCWriter.writeEndElement();
- }
-
- String getPrimaryTOCContent() {
- return primaryTOCOut.toString();
- }
-
- String getPluginContent() {
- return pluginOut.toString();
- }
-
- protected XmlStreamWriter createXmlStreamWriter(Writer out) {
- XmlStreamWriter writer = new DefaultXmlStreamWriter(out);
- return new FormattingXMLStreamWriter(writer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.doc;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import java.nio.file.Path;
+
+import org.eclipse.mylyn.wikitext.core.util.DefaultXmlStreamWriter;
+import org.eclipse.mylyn.wikitext.core.util.FormattingXMLStreamWriter;
+import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ *
+ */
+public class PrimaryTOCWriter {
+
+ private StringWriter primaryTOCOut;
+ private XmlStreamWriter primaryTOCWriter;
+
+ private StringWriter pluginOut;
+ private XmlStreamWriter pluginWriter;
+ private Path baseDir;
+
+ void startPrimaryTOC(Path indexHTMLFile, String title) {
+ baseDir = indexHTMLFile.getParent();
+ primaryTOCOut = new StringWriter(8096);
+ primaryTOCWriter = createXmlStreamWriter(primaryTOCOut);
+
+ pluginOut = new StringWriter(8096);
+ pluginWriter = createXmlStreamWriter(pluginOut);
+
+ primaryTOCWriter.writeStartDocument("UTF-8", "1.0");
+ primaryTOCWriter.writeStartElement("toc");
+ primaryTOCWriter.writeAttribute("topic", indexHTMLFile.toString());
+ primaryTOCWriter.writeAttribute("label", title);
+
+ pluginWriter.writeStartDocument("UTF-8", "1.0");
+ pluginWriter.writeLiteral("\n<?eclipse version=\"3.2\"?>\n");
+ pluginWriter.writeStartElement("plugin");
+
+ pluginWriter.writeStartElement("extension");
+ pluginWriter.writeAttribute("point", "org.eclipse.help.toc");
+
+ pluginWriter.writeEmptyElement("toc");
+ pluginWriter.writeAttribute("file", "help/toc.xml");
+ pluginWriter.writeAttribute("primary", "true");
+
+ pluginWriter.writeEndElement();
+
+ pluginWriter.writeStartElement("extension");
+ pluginWriter.writeAttribute("point", "org.eclipse.help.toc");
+
+ }
+
+ void endPrimaryTOC() {
+ primaryTOCWriter.writeEndElement();
+ primaryTOCWriter.writeEndDocument();
+ primaryTOCWriter.close();
+
+ pluginWriter.writeEndElement();
+ pluginWriter.writeEndElement();
+ pluginWriter.writeEndDocument();
+ pluginWriter.close();
+ }
+
+ void startTopic(String label, Path href) {
+ primaryTOCWriter.writeStartElement("topic");
+ primaryTOCWriter.writeAttribute("label", label);
+
+ if (href != null) {
+ primaryTOCWriter.writeAttribute("href", href.toString());
+ }
+ }
+
+ void createLink(Path linkedTOC) {
+ primaryTOCWriter.writeStartElement("link");
+ primaryTOCWriter.writeAttribute("toc", baseDir.resolve(linkedTOC).toString());
+ primaryTOCWriter.writeEndElement();
+
+ pluginWriter.writeEmptyElement("toc");
+ pluginWriter.writeAttribute("file", baseDir.resolve(linkedTOC).toString());
+ }
+
+ void endTopic() {
+ primaryTOCWriter.writeEndElement();
+ }
+
+ String getPrimaryTOCContent() {
+ return primaryTOCOut.toString();
+ }
+
+ String getPluginContent() {
+ return pluginOut.toString();
+ }
+
+ protected XmlStreamWriter createXmlStreamWriter(Writer out) {
+ XmlStreamWriter writer = new DefaultXmlStreamWriter(out);
+ return new FormattingXMLStreamWriter(writer);
+ }
+}
diff --git a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java
index 607f5f69a..419c3e348 100644
--- a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java
+++ b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java
@@ -1,642 +1,642 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.doc;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.charset.Charset;
-import java.nio.file.FileSystem;
-import java.nio.file.FileSystems;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.PathMatcher;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jgit.api.DescribeCommand;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.DefaultSplittingStrategy;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.NoSplittingStrategy;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplitOutlineItem;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingHtmlDocumentBuilder;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingOutlineParser;
-import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingStrategy;
-import org.eclipse.mylyn.internal.wikitext.core.validation.StandaloneMarkupValidator;
-import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
-import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder;
-import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
-import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
-import org.eclipse.mylyn.wikitext.core.parser.util.MarkupToEclipseToc;
-import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;
-import org.eclipse.mylyn.wikitext.core.validation.ValidationProblem;
-import org.eclipse.mylyn.wikitext.core.validation.ValidationProblem.Severity;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class WikiTextToHTML {
-
- private static final FileSystem DEFAULT_FS = FileSystems.getDefault();
-
- private static final boolean FORMAT_OUTPUT = true;
-
- private static final Charset UTF_8 = Charset.forName("UTF-8");
-
- private static final String MEDIA_WIKI = "MediaWiki";
-
- private MarkupLanguage markupLanguage;
-
- private boolean navigationImages = false;
-
- private String title;
-
- private boolean emitDoctype = false;
-
- private boolean multipleOutputFiles;
-
- private String copyrightNotice;
-
- private boolean xhtmlStrict;
-
- private String prependImagePrefix;
-
- private String defaultAbsoluteLinkTarget;
-
- private String linkRel;
-
- private boolean suppressBuiltInCssStyles;
-
- private boolean useInlineCssStyles;
-
- private String htmlDoctype;
-
- private List<Stylesheet> stylesheets;
- private List<Stylesheet> helpStylesheets = new ArrayList<>();
- private List<Stylesheet> websiteStylesheets = new ArrayList<>();
-
- private PrimaryTOCWriter primaryTOCWriter = new PrimaryTOCWriter();
-
- private Path sourceFolder;
-
- private List<Path> foldersToCopy;
-
- private Path targetRootFolder;
-
- private Path targetWebsiteFolder;
-
- private Path targetHelpFolder;
-
- private boolean genEclipseHelp;
-
- private boolean genWebsite;
-
- private static java.util.Date NOW = Calendar.getInstance().getTime();
-
- public static void main(String[] args) throws Exception {
- WikiTextToHTML wikiTextToHTML = new WikiTextToHTML();
- wikiTextToHTML.run(args);
- }
-
- public void run(String[] args) throws Exception {
- processCommandLineArgs(args);
-
- if (targetRootFolder == null) {
- System.err.println("Error: unable to find -location argument");
- usage();
- System.exit(1);
- }
- if (!genEclipseHelp && !genWebsite) {
- System.err.println("Error: you must at least provide a -eclipsehelp or a -website option");
- usage();
- System.exit(1);
- }
-
- markupLanguage = new CustomMediaWikiLanguage();
- markupLanguage.setInternalLinkPattern("{0}");
-
- Stylesheet ss1 = new Stylesheet();
- ss1.setUrl("/help/topic/org.eclipse.emf.compare.doc/help/resources/bootstrap.css");
- helpStylesheets.add(ss1);
- Stylesheet ss2 = new Stylesheet();
- ss2.setUrl("/help/topic/org.eclipse.emf.compare.doc/help/resources/custom.css");
- helpStylesheets.add(ss2);
-
- ss1 = new Stylesheet();
- ss1.setUrl("resources/bootstrap.css");
- websiteStylesheets.add(ss1);
- ss2 = new Stylesheet();
- ss2.setUrl("resources/custom.css");
- websiteStylesheets.add(ss2);
-
- sourceFolder = DEFAULT_FS.getPath("src");
- foldersToCopy = new ArrayList<>();
- foldersToCopy.add(targetRootFolder.resolve(sourceFolder).resolve("images"));
- foldersToCopy.add(targetRootFolder.resolve(sourceFolder).resolve("resources"));
-
- targetWebsiteFolder = DEFAULT_FS.getPath("target", "website").resolve(gitDescribe());
- targetHelpFolder = DEFAULT_FS.getPath("help");
- final Path resolvedTargetHelpFolder = targetRootFolder.resolve(targetHelpFolder);
-
- if (genEclipseHelp) {
- if (Files.exists(resolvedTargetHelpFolder)) {
- System.out.println("Deleting "+ resolvedTargetHelpFolder + " before regenerating Eclipse help");
- removeRecursiveContent(resolvedTargetHelpFolder);
- }
- primaryTOCWriter.startPrimaryTOC(targetHelpFolder.resolve("index.html"), "EMF Compare Documentation");
- }
-
- final PathMatcher mediawikiPattern = DEFAULT_FS.getPathMatcher("glob:**/*.mediawiki");
-
- Files.walkFileTree(targetRootFolder.resolve(sourceFolder), new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path markupPath, BasicFileAttributes attrs) throws IOException {
- if (mediawikiPattern.matches(markupPath)) {
- processFile(sourceFolder, targetWebsiteFolder, targetHelpFolder, markupPath);
- }
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
- System.err.println("Failed to visit " + file);
- exc.printStackTrace();
- return FileVisitResult.CONTINUE;
- }
-
- /**
- * {@inheritDoc}
- * @see java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object, java.nio.file.attribute.BasicFileAttributes)
- */
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
- if (genEclipseHelp && !dir.equals(targetRootFolder.resolve(sourceFolder)) && !foldersToCopy.contains(dir)) {
- if (dir.resolve("index.mediawiki").toFile().exists()) {
- primaryTOCWriter.startTopic(getTitle(dir), dir.resolve("index.html"));
- } else {
- primaryTOCWriter.startTopic(getTitle(dir), null);
- }
- }
- return FileVisitResult.CONTINUE;
- }
-
- /**
- * {@inheritDoc}
- * @see java.nio.file.SimpleFileVisitor#postVisitDirectory(java.lang.Object, java.io.IOException)
- */
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
- if (genEclipseHelp && !dir.equals(targetRootFolder.resolve(sourceFolder)) && !foldersToCopy.contains(dir)) {
- primaryTOCWriter.endTopic();
- }
- return FileVisitResult.CONTINUE;
- }
- });
-
- if (genEclipseHelp) {
- primaryTOCWriter.endPrimaryTOC();
- writeStringToFile(primaryTOCWriter.getPrimaryTOCContent(), resolvedTargetHelpFolder.resolve("toc.xml"));
- writeStringToFile(primaryTOCWriter.getPluginContent(), targetRootFolder.resolve("plugin.xml"));
- }
-
- for (Path folder : foldersToCopy) {
- if (genWebsite)
- copy(folder, targetRootFolder.resolve(targetWebsiteFolder).resolve(folder.getFileName()), "glob:**/*");
- if (genEclipseHelp)
- copy(folder, resolvedTargetHelpFolder.resolve(folder.getFileName()), "glob:**/*");
- }
- }
-
- /**
- *
- */
- private void usage() {
- System.out.println("Usage: wikiTextToHTML -location path [-eclipsehelp] [-website]");
- }
-
- private void processCommandLineArgs(String[] args) throws Exception {
- if (args == null)
- throw new Exception("No argument provided");
- for (int i = 0; i < args.length; i++) {
- String option = args[i];
- String arg = "";
- if (i == args.length - 1 || args[i + 1].startsWith("-")) {//$NON-NLS-1$
- // do nothgin
- } else {
- arg = args[++i];
- }
-
- if (option.equalsIgnoreCase("-location")) { //$NON-NLS-1$
- targetRootFolder = DEFAULT_FS.getPath(arg);
- }
-
- if (option.equalsIgnoreCase("-eclipsehelp")) { //$NON-NLS-1$
- genEclipseHelp = true;
- }
-
- if (option.equalsIgnoreCase("-website")) { //$NON-NLS-1$
- genWebsite = true;
- }
- }
- }
-
- private String getTitle(Path path) {
- String filename = path.getFileName().toString();
- int lastIndexOf = filename.lastIndexOf('.');
- if (lastIndexOf >= 0) {
- filename = filename.substring(0, lastIndexOf);
- }
- String[] split = filename.split("-");
-
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < split.length; i++) {
- String str = split[i].trim();
- if (str.length() > 0) {
- if (i == 0) {
- char firstChar = str.charAt(0);
- sb.append(Character.toUpperCase(firstChar));
- sb.append(str.substring(1));
- } else {
- sb.append(str);
- }
- sb.append(' ');
- }
- }
- return sb.toString().trim();
- }
-
- private void processFile(final Path sourceFolder,
- final Path targetWebsiteFolder,
- final Path targetHelpFolder, Path markupPath)
- throws IOException, FileNotFoundException,
- UnsupportedEncodingException {
- System.out.println("Processing " + markupPath);
-
- Path relativeMarkupPath = targetRootFolder.resolve(sourceFolder).relativize(markupPath);
-
- Path targetHTML = targetWebsiteFolder.resolve(changeFilename(relativeMarkupPath, ".html"));
-
- Path relativeTOCPath = changeFilename(relativeMarkupPath, "toc-", ".xml");
- Path targetTOC = targetHelpFolder.resolve(relativeTOCPath);
- Path targetHelp = targetHelpFolder.resolve(changeFilename(relativeMarkupPath, ".html"));
-
- if (genWebsite) {
- mkdirs(targetRootFolder.resolve(targetHTML));
- }
- if (genEclipseHelp) {
- mkdirs(targetRootFolder.resolve(targetTOC));
- mkdirs(targetRootFolder.resolve(targetHelp));
- }
-
- String markupContent = new String(Files.readAllBytes(markupPath), UTF_8);
-
- final String markupContentWithTOC;
- if ("index.mediawiki".equals(markupPath.getFileName().toString())) {
- markupContentWithTOC = markupContent.replaceFirst("=(.*)=", "=EMF Compare — $1=\n\nVersion " + gitDescribe() +"\n\n") +
- "\n\nVersion " + gitDescribe() +
- "\n\nLast updated " + NOW;
- } else {
- Path relativeToRoot = targetHTML.getParent().relativize(targetWebsiteFolder.resolve("index.html"));
- markupContentWithTOC = markupContent.replaceFirst("=(.*)=", "=EMF Compare — $1=\n\nVersion " + gitDescribe() +"\n\n__TOC__\n\n") +
- "\n\nPart of ["+relativeToRoot+" EMF Compare Documentation]" +
- "\n\nVersion " + gitDescribe() +
- "\n\nLast updated " + NOW;
- }
-
- if (performValidation(markupPath, markupContent)) {
- // for website
- if (genWebsite) {
- stylesheets = websiteStylesheets;
- genHTML(getTitle(targetHTML), markupContentWithTOC, targetRootFolder.resolve(targetHTML));
- }
-
- // for eclipse help
- if (genEclipseHelp) {
- stylesheets = helpStylesheets;
- genHTML(getTitle(targetHTML), markupContent, targetRootFolder.resolve(targetHelp));
-
-
- final PathMatcher indexPattern = DEFAULT_FS.getPathMatcher("glob:**/index.mediawiki");
- if (!indexPattern.matches(markupPath)) {
- genTOC(getTitle(targetHelp), markupContent, targetRootFolder.resolve(targetTOC), targetHelp);
- primaryTOCWriter.startTopic(getTitle(targetHelp), targetHelp);
- primaryTOCWriter.createLink(relativeTOCPath);
- primaryTOCWriter.endTopic();
- }
- }
- }
- }
-
-
- private void mkdirs(Path file) {
- File parentFile = file.getParent().toFile();
- if (!parentFile.exists()) {
- file.getParent().toFile().mkdirs();
- }
- }
-
- private static void removeRecursiveContent(final Path path) throws IOException {
- Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
- Files.delete(file);
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult visitFileFailed(Path file, IOException exc)
- throws IOException {
- // try to delete the file anyway, even if its attributes
- // could not be read, since delete-only access is
- // theoretically possible
- Files.delete(file);
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException exc)
- throws IOException {
- if (exc == null) {
- if (!dir.equals(path)) {
- Files.delete(dir);
- }
- return FileVisitResult.CONTINUE;
- } else {
- // directory iteration failed; propagate exception
- throw exc;
- }
- }
- });
- }
-
- private Path changeFilename(Path source, String newFileExtension) {
- return changeFilename(source, "", newFileExtension);
- }
-
- private Path changeFilename(Path source, String prefix, String newFileExtension) {
- String filename = source.getFileName().toString();
- int lastIndexOf = filename.lastIndexOf(".");
- String newFileName = prefix + filename.substring(0, lastIndexOf) + newFileExtension;
- return source.resolveSibling(newFileName);
- }
-
- private void genTOC(String name, String markupContent, Path targetToc, Path targetHTML) throws IOException, UnsupportedEncodingException, FileNotFoundException {
- MarkupToEclipseToc toEclipseToc = new MarkupToEclipseToc() {
- public String createToc(OutlineItem root) {
- StringWriter out = new StringWriter(8096);
-
- XmlStreamWriter writer = createXmlStreamWriter(out);
-
- writer.writeStartDocument("utf-8", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (copyrightNotice != null) {
- writer.writeComment(copyrightNotice);
- }
-
- Method method = null;
- try {
- method = MarkupToEclipseToc.class.getDeclaredMethod("emitToc", XmlStreamWriter.class, List.class);
- method.setAccessible(true);
- } catch (NoSuchMethodException | SecurityException | IllegalArgumentException e) {
- throw new RuntimeException(e);
- }
-
- if (root.getChildren().size() == 1 && root.getChildren().get(0).getLevel() == 1) {
- OutlineItem innerRoot = root.getChildren().get(0);
- writer.writeStartElement("toc"); //$NON-NLS-1$
- writer.writeAttribute("topic", getHtmlFile() + "#" + innerRoot.getId()); //$NON-NLS-1$
- writer.writeAttribute("label", innerRoot.getLabel()); //$NON-NLS-1$
- try {
- method.invoke(this, writer, innerRoot.getChildren());
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- } else {
- writer.writeStartElement("toc"); //$NON-NLS-1$
- writer.writeAttribute("topic", getHtmlFile()); //$NON-NLS-1$
- writer.writeAttribute("label", root.getLabel()); //$NON-NLS-1$
- try {
- method.invoke(this, writer, root.getChildren());
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-
- writer.writeEndElement(); // toc
-
- writer.writeEndDocument();
- writer.close();
-
- return out.toString();
- }
- };
- toEclipseToc.setMarkupLanguage(markupLanguage.clone());
- toEclipseToc.setHtmlFile(targetHTML.toString());
- toEclipseToc.setBookTitle(name);
- String tocContents = toEclipseToc.parse(markupContent);
-
- writeStringToFile(tocContents, targetToc);
- }
-
- private void writeStringToFile(String content, Path path) throws UnsupportedEncodingException, FileNotFoundException, IOException {
- try(Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(path.toFile())), "UTF-8")) {
- writer.write(content);
- }
- }
-
- private void genHTML(String name, String markupContent, Path htmlOutputFile) throws IOException, FileNotFoundException {
- try (Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile.toFile())), UTF_8)) {
- HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer, FORMAT_OUTPUT);
- for (Stylesheet stylesheet : stylesheets) {
- HtmlDocumentBuilder.Stylesheet builderStylesheet;
-
- if (stylesheet.url != null) {
- if (stylesheets == websiteStylesheets) {
- Path stylesheetPath = DEFAULT_FS.getPath(stylesheet.url);
- Path targetStylesheetPath = targetRootFolder.resolve(targetWebsiteFolder.resolve(stylesheetPath));
- Path relativeStylesheetPath = htmlOutputFile.getParent().relativize(targetStylesheetPath);
- builderStylesheet = new HtmlDocumentBuilder.Stylesheet(relativeStylesheetPath.toString());
- } else {
- builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.url);
- }
- } else {
- builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.file);
- }
- builder.addCssStylesheet(builderStylesheet);
-
- if (!stylesheet.attributes.isEmpty()) {
- for (Map.Entry<String, String> attr : stylesheet.attributes.entrySet()) {
- builderStylesheet.getAttributes().put(attr.getKey(), attr.getValue());
- }
- }
- }
-
- builder.setTitle(title == null ? name.toString() : title);
- builder.setEmitDtd(emitDoctype);
- if (emitDoctype && htmlDoctype != null) {
- builder.setHtmlDtd(htmlDoctype);
- }
- builder.setUseInlineStyles(useInlineCssStyles);
- builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
- builder.setLinkRel(linkRel);
- builder.setDefaultAbsoluteLinkTarget(defaultAbsoluteLinkTarget);
- builder.setPrependImagePrefix(prependImagePrefix);
- builder.setXhtmlStrict(xhtmlStrict);
- builder.setCopyrightNotice(copyrightNotice);
-
- SplittingStrategy splittingStrategy = multipleOutputFiles
- ? new DefaultSplittingStrategy()
- : new NoSplittingStrategy();
- SplittingOutlineParser outlineParser = new SplittingOutlineParser();
- outlineParser.setMarkupLanguage(markupLanguage.clone());
- outlineParser.setSplittingStrategy(splittingStrategy);
- SplitOutlineItem item = outlineParser.parse(markupContent);
- item.setSplitTarget(htmlOutputFile.toFile().getName());
- SplittingHtmlDocumentBuilder splittingBuilder = new SplittingHtmlDocumentBuilder();
- splittingBuilder.setRootBuilder(builder);
- splittingBuilder.setOutline(item);
- splittingBuilder.setRootFile(htmlOutputFile.toFile());
- splittingBuilder.setNavigationImages(navigationImages);
- splittingBuilder.setFormatting(FORMAT_OUTPUT);
-
- MarkupParser parser = new MarkupParser();
- parser.setMarkupLanguage(markupLanguage);
- parser.setBuilder(splittingBuilder);
- parser.parse(markupContent);
- }
- }
-
- private String gitDescribe() {
- FileRepositoryBuilder builder = new FileRepositoryBuilder();
- try {
- Repository repo = builder.setWorkTree(new File("."))
- .readEnvironment() // scan environment GIT_* variables
- .findGitDir() // scan up the file system tree
- .build();
- Git git = new Git(repo);
- DescribeCommand command = git.describe();
- return command.call();
- } catch (IOException e) {
- new RuntimeException(e);
- } catch (GitAPIException e) {
- new RuntimeException(e);
- }
- return "";
- }
-
- private void copy(final Path sourceFolder,
- final Path targetFolder, String pattern) throws IOException {
- final PathMatcher imageMatcher = DEFAULT_FS.getPathMatcher(pattern);
- Files.walkFileTree(sourceFolder, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path sourcePath, BasicFileAttributes attrs) throws IOException {
- if (imageMatcher.matches(sourcePath)) {
- String targetFile = sourcePath.toString().replace(sourceFolder.toString(), targetFolder.toString());
- Path targetPath = DEFAULT_FS.getPath(targetFile);
- targetPath.getParent().toFile().mkdirs();
- Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
- }
- return FileVisitResult.CONTINUE;
- }
- });
- }
-
- /**
- * Returns true if valid (may have warning).
- * @param source
- * @param markupContent
- * @return
- */
- private boolean performValidation(Path source, String markupContent) {
- StandaloneMarkupValidator markupValidator = StandaloneMarkupValidator.getValidator(MEDIA_WIKI);
-
- List<ValidationProblem> problems = markupValidator.validate(markupContent);
-
- int errorCount = 0;
- for (ValidationProblem problem : problems) {
- String messageLevel = problem.getSeverity().name();
- if (problem.getSeverity() == Severity.ERROR) {
- errorCount++;
- }
- System.out.println(String.format("%s: %s:%s %s", messageLevel, source.toString(), problem.getOffset(), problem.getMessage())); //$NON-NLS-1$
- }
-
- return errorCount == 0;
- }
-
- public static class Stylesheet {
- private File file;
-
- private String url;
-
- private final Map<String, String> attributes = new HashMap<>();
-
- public File getFile() {
- return file;
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public void addConfiguredAttribute(Attribute attribute) {
- attributes.put(attribute.getName(), attribute.getValue());
- }
- }
-
- public static class Attribute {
- private String name;
-
- private String value;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.doc;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.charset.Charset;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jgit.api.DescribeCommand;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.DefaultSplittingStrategy;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.NoSplittingStrategy;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplitOutlineItem;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingHtmlDocumentBuilder;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingOutlineParser;
+import org.eclipse.mylyn.internal.wikitext.core.parser.builder.SplittingStrategy;
+import org.eclipse.mylyn.internal.wikitext.core.validation.StandaloneMarkupValidator;
+import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
+import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder;
+import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
+import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
+import org.eclipse.mylyn.wikitext.core.parser.util.MarkupToEclipseToc;
+import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;
+import org.eclipse.mylyn.wikitext.core.validation.ValidationProblem;
+import org.eclipse.mylyn.wikitext.core.validation.ValidationProblem.Severity;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class WikiTextToHTML {
+
+ private static final FileSystem DEFAULT_FS = FileSystems.getDefault();
+
+ private static final boolean FORMAT_OUTPUT = true;
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ private static final String MEDIA_WIKI = "MediaWiki";
+
+ private MarkupLanguage markupLanguage;
+
+ private boolean navigationImages = false;
+
+ private String title;
+
+ private boolean emitDoctype = false;
+
+ private boolean multipleOutputFiles;
+
+ private String copyrightNotice;
+
+ private boolean xhtmlStrict;
+
+ private String prependImagePrefix;
+
+ private String defaultAbsoluteLinkTarget;
+
+ private String linkRel;
+
+ private boolean suppressBuiltInCssStyles;
+
+ private boolean useInlineCssStyles;
+
+ private String htmlDoctype;
+
+ private List<Stylesheet> stylesheets;
+ private List<Stylesheet> helpStylesheets = new ArrayList<>();
+ private List<Stylesheet> websiteStylesheets = new ArrayList<>();
+
+ private PrimaryTOCWriter primaryTOCWriter = new PrimaryTOCWriter();
+
+ private Path sourceFolder;
+
+ private List<Path> foldersToCopy;
+
+ private Path targetRootFolder;
+
+ private Path targetWebsiteFolder;
+
+ private Path targetHelpFolder;
+
+ private boolean genEclipseHelp;
+
+ private boolean genWebsite;
+
+ private static java.util.Date NOW = Calendar.getInstance().getTime();
+
+ public static void main(String[] args) throws Exception {
+ WikiTextToHTML wikiTextToHTML = new WikiTextToHTML();
+ wikiTextToHTML.run(args);
+ }
+
+ public void run(String[] args) throws Exception {
+ processCommandLineArgs(args);
+
+ if (targetRootFolder == null) {
+ System.err.println("Error: unable to find -location argument");
+ usage();
+ System.exit(1);
+ }
+ if (!genEclipseHelp && !genWebsite) {
+ System.err.println("Error: you must at least provide a -eclipsehelp or a -website option");
+ usage();
+ System.exit(1);
+ }
+
+ markupLanguage = new CustomMediaWikiLanguage();
+ markupLanguage.setInternalLinkPattern("{0}");
+
+ Stylesheet ss1 = new Stylesheet();
+ ss1.setUrl("/help/topic/org.eclipse.emf.compare.doc/help/resources/bootstrap.css");
+ helpStylesheets.add(ss1);
+ Stylesheet ss2 = new Stylesheet();
+ ss2.setUrl("/help/topic/org.eclipse.emf.compare.doc/help/resources/custom.css");
+ helpStylesheets.add(ss2);
+
+ ss1 = new Stylesheet();
+ ss1.setUrl("resources/bootstrap.css");
+ websiteStylesheets.add(ss1);
+ ss2 = new Stylesheet();
+ ss2.setUrl("resources/custom.css");
+ websiteStylesheets.add(ss2);
+
+ sourceFolder = DEFAULT_FS.getPath("src");
+ foldersToCopy = new ArrayList<>();
+ foldersToCopy.add(targetRootFolder.resolve(sourceFolder).resolve("images"));
+ foldersToCopy.add(targetRootFolder.resolve(sourceFolder).resolve("resources"));
+
+ targetWebsiteFolder = DEFAULT_FS.getPath("target", "website").resolve(gitDescribe());
+ targetHelpFolder = DEFAULT_FS.getPath("help");
+ final Path resolvedTargetHelpFolder = targetRootFolder.resolve(targetHelpFolder);
+
+ if (genEclipseHelp) {
+ if (Files.exists(resolvedTargetHelpFolder)) {
+ System.out.println("Deleting "+ resolvedTargetHelpFolder + " before regenerating Eclipse help");
+ removeRecursiveContent(resolvedTargetHelpFolder);
+ }
+ primaryTOCWriter.startPrimaryTOC(targetHelpFolder.resolve("index.html"), "EMF Compare Documentation");
+ }
+
+ final PathMatcher mediawikiPattern = DEFAULT_FS.getPathMatcher("glob:**/*.mediawiki");
+
+ Files.walkFileTree(targetRootFolder.resolve(sourceFolder), new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path markupPath, BasicFileAttributes attrs) throws IOException {
+ if (mediawikiPattern.matches(markupPath)) {
+ processFile(sourceFolder, targetWebsiteFolder, targetHelpFolder, markupPath);
+ }
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
+ System.err.println("Failed to visit " + file);
+ exc.printStackTrace();
+ return FileVisitResult.CONTINUE;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object, java.nio.file.attribute.BasicFileAttributes)
+ */
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+ if (genEclipseHelp && !dir.equals(targetRootFolder.resolve(sourceFolder)) && !foldersToCopy.contains(dir)) {
+ if (dir.resolve("index.mediawiki").toFile().exists()) {
+ primaryTOCWriter.startTopic(getTitle(dir), dir.resolve("index.html"));
+ } else {
+ primaryTOCWriter.startTopic(getTitle(dir), null);
+ }
+ }
+ return FileVisitResult.CONTINUE;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see java.nio.file.SimpleFileVisitor#postVisitDirectory(java.lang.Object, java.io.IOException)
+ */
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+ if (genEclipseHelp && !dir.equals(targetRootFolder.resolve(sourceFolder)) && !foldersToCopy.contains(dir)) {
+ primaryTOCWriter.endTopic();
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+
+ if (genEclipseHelp) {
+ primaryTOCWriter.endPrimaryTOC();
+ writeStringToFile(primaryTOCWriter.getPrimaryTOCContent(), resolvedTargetHelpFolder.resolve("toc.xml"));
+ writeStringToFile(primaryTOCWriter.getPluginContent(), targetRootFolder.resolve("plugin.xml"));
+ }
+
+ for (Path folder : foldersToCopy) {
+ if (genWebsite)
+ copy(folder, targetRootFolder.resolve(targetWebsiteFolder).resolve(folder.getFileName()), "glob:**/*");
+ if (genEclipseHelp)
+ copy(folder, resolvedTargetHelpFolder.resolve(folder.getFileName()), "glob:**/*");
+ }
+ }
+
+ /**
+ *
+ */
+ private void usage() {
+ System.out.println("Usage: wikiTextToHTML -location path [-eclipsehelp] [-website]");
+ }
+
+ private void processCommandLineArgs(String[] args) throws Exception {
+ if (args == null)
+ throw new Exception("No argument provided");
+ for (int i = 0; i < args.length; i++) {
+ String option = args[i];
+ String arg = "";
+ if (i == args.length - 1 || args[i + 1].startsWith("-")) {//$NON-NLS-1$
+ // do nothgin
+ } else {
+ arg = args[++i];
+ }
+
+ if (option.equalsIgnoreCase("-location")) { //$NON-NLS-1$
+ targetRootFolder = DEFAULT_FS.getPath(arg);
+ }
+
+ if (option.equalsIgnoreCase("-eclipsehelp")) { //$NON-NLS-1$
+ genEclipseHelp = true;
+ }
+
+ if (option.equalsIgnoreCase("-website")) { //$NON-NLS-1$
+ genWebsite = true;
+ }
+ }
+ }
+
+ private String getTitle(Path path) {
+ String filename = path.getFileName().toString();
+ int lastIndexOf = filename.lastIndexOf('.');
+ if (lastIndexOf >= 0) {
+ filename = filename.substring(0, lastIndexOf);
+ }
+ String[] split = filename.split("-");
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < split.length; i++) {
+ String str = split[i].trim();
+ if (str.length() > 0) {
+ if (i == 0) {
+ char firstChar = str.charAt(0);
+ sb.append(Character.toUpperCase(firstChar));
+ sb.append(str.substring(1));
+ } else {
+ sb.append(str);
+ }
+ sb.append(' ');
+ }
+ }
+ return sb.toString().trim();
+ }
+
+ private void processFile(final Path sourceFolder,
+ final Path targetWebsiteFolder,
+ final Path targetHelpFolder, Path markupPath)
+ throws IOException, FileNotFoundException,
+ UnsupportedEncodingException {
+ System.out.println("Processing " + markupPath);
+
+ Path relativeMarkupPath = targetRootFolder.resolve(sourceFolder).relativize(markupPath);
+
+ Path targetHTML = targetWebsiteFolder.resolve(changeFilename(relativeMarkupPath, ".html"));
+
+ Path relativeTOCPath = changeFilename(relativeMarkupPath, "toc-", ".xml");
+ Path targetTOC = targetHelpFolder.resolve(relativeTOCPath);
+ Path targetHelp = targetHelpFolder.resolve(changeFilename(relativeMarkupPath, ".html"));
+
+ if (genWebsite) {
+ mkdirs(targetRootFolder.resolve(targetHTML));
+ }
+ if (genEclipseHelp) {
+ mkdirs(targetRootFolder.resolve(targetTOC));
+ mkdirs(targetRootFolder.resolve(targetHelp));
+ }
+
+ String markupContent = new String(Files.readAllBytes(markupPath), UTF_8);
+
+ final String markupContentWithTOC;
+ if ("index.mediawiki".equals(markupPath.getFileName().toString())) {
+ markupContentWithTOC = markupContent.replaceFirst("=(.*)=", "=EMF Compare — $1=\n\nVersion " + gitDescribe() +"\n\n") +
+ "\n\nVersion " + gitDescribe() +
+ "\n\nLast updated " + NOW;
+ } else {
+ Path relativeToRoot = targetHTML.getParent().relativize(targetWebsiteFolder.resolve("index.html"));
+ markupContentWithTOC = markupContent.replaceFirst("=(.*)=", "=EMF Compare — $1=\n\nVersion " + gitDescribe() +"\n\n__TOC__\n\n") +
+ "\n\nPart of ["+relativeToRoot+" EMF Compare Documentation]" +
+ "\n\nVersion " + gitDescribe() +
+ "\n\nLast updated " + NOW;
+ }
+
+ if (performValidation(markupPath, markupContent)) {
+ // for website
+ if (genWebsite) {
+ stylesheets = websiteStylesheets;
+ genHTML(getTitle(targetHTML), markupContentWithTOC, targetRootFolder.resolve(targetHTML));
+ }
+
+ // for eclipse help
+ if (genEclipseHelp) {
+ stylesheets = helpStylesheets;
+ genHTML(getTitle(targetHTML), markupContent, targetRootFolder.resolve(targetHelp));
+
+
+ final PathMatcher indexPattern = DEFAULT_FS.getPathMatcher("glob:**/index.mediawiki");
+ if (!indexPattern.matches(markupPath)) {
+ genTOC(getTitle(targetHelp), markupContent, targetRootFolder.resolve(targetTOC), targetHelp);
+ primaryTOCWriter.startTopic(getTitle(targetHelp), targetHelp);
+ primaryTOCWriter.createLink(relativeTOCPath);
+ primaryTOCWriter.endTopic();
+ }
+ }
+ }
+ }
+
+
+ private void mkdirs(Path file) {
+ File parentFile = file.getParent().toFile();
+ if (!parentFile.exists()) {
+ file.getParent().toFile().mkdirs();
+ }
+ }
+
+ private static void removeRecursiveContent(final Path path) throws IOException {
+ Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc)
+ throws IOException {
+ // try to delete the file anyway, even if its attributes
+ // could not be read, since delete-only access is
+ // theoretically possible
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc)
+ throws IOException {
+ if (exc == null) {
+ if (!dir.equals(path)) {
+ Files.delete(dir);
+ }
+ return FileVisitResult.CONTINUE;
+ } else {
+ // directory iteration failed; propagate exception
+ throw exc;
+ }
+ }
+ });
+ }
+
+ private Path changeFilename(Path source, String newFileExtension) {
+ return changeFilename(source, "", newFileExtension);
+ }
+
+ private Path changeFilename(Path source, String prefix, String newFileExtension) {
+ String filename = source.getFileName().toString();
+ int lastIndexOf = filename.lastIndexOf(".");
+ String newFileName = prefix + filename.substring(0, lastIndexOf) + newFileExtension;
+ return source.resolveSibling(newFileName);
+ }
+
+ private void genTOC(String name, String markupContent, Path targetToc, Path targetHTML) throws IOException, UnsupportedEncodingException, FileNotFoundException {
+ MarkupToEclipseToc toEclipseToc = new MarkupToEclipseToc() {
+ public String createToc(OutlineItem root) {
+ StringWriter out = new StringWriter(8096);
+
+ XmlStreamWriter writer = createXmlStreamWriter(out);
+
+ writer.writeStartDocument("utf-8", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (copyrightNotice != null) {
+ writer.writeComment(copyrightNotice);
+ }
+
+ Method method = null;
+ try {
+ method = MarkupToEclipseToc.class.getDeclaredMethod("emitToc", XmlStreamWriter.class, List.class);
+ method.setAccessible(true);
+ } catch (NoSuchMethodException | SecurityException | IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ }
+
+ if (root.getChildren().size() == 1 && root.getChildren().get(0).getLevel() == 1) {
+ OutlineItem innerRoot = root.getChildren().get(0);
+ writer.writeStartElement("toc"); //$NON-NLS-1$
+ writer.writeAttribute("topic", getHtmlFile() + "#" + innerRoot.getId()); //$NON-NLS-1$
+ writer.writeAttribute("label", innerRoot.getLabel()); //$NON-NLS-1$
+ try {
+ method.invoke(this, writer, innerRoot.getChildren());
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ writer.writeStartElement("toc"); //$NON-NLS-1$
+ writer.writeAttribute("topic", getHtmlFile()); //$NON-NLS-1$
+ writer.writeAttribute("label", root.getLabel()); //$NON-NLS-1$
+ try {
+ method.invoke(this, writer, root.getChildren());
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ writer.writeEndElement(); // toc
+
+ writer.writeEndDocument();
+ writer.close();
+
+ return out.toString();
+ }
+ };
+ toEclipseToc.setMarkupLanguage(markupLanguage.clone());
+ toEclipseToc.setHtmlFile(targetHTML.toString());
+ toEclipseToc.setBookTitle(name);
+ String tocContents = toEclipseToc.parse(markupContent);
+
+ writeStringToFile(tocContents, targetToc);
+ }
+
+ private void writeStringToFile(String content, Path path) throws UnsupportedEncodingException, FileNotFoundException, IOException {
+ try(Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(path.toFile())), "UTF-8")) {
+ writer.write(content);
+ }
+ }
+
+ private void genHTML(String name, String markupContent, Path htmlOutputFile) throws IOException, FileNotFoundException {
+ try (Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile.toFile())), UTF_8)) {
+ HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer, FORMAT_OUTPUT);
+ for (Stylesheet stylesheet : stylesheets) {
+ HtmlDocumentBuilder.Stylesheet builderStylesheet;
+
+ if (stylesheet.url != null) {
+ if (stylesheets == websiteStylesheets) {
+ Path stylesheetPath = DEFAULT_FS.getPath(stylesheet.url);
+ Path targetStylesheetPath = targetRootFolder.resolve(targetWebsiteFolder.resolve(stylesheetPath));
+ Path relativeStylesheetPath = htmlOutputFile.getParent().relativize(targetStylesheetPath);
+ builderStylesheet = new HtmlDocumentBuilder.Stylesheet(relativeStylesheetPath.toString());
+ } else {
+ builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.url);
+ }
+ } else {
+ builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.file);
+ }
+ builder.addCssStylesheet(builderStylesheet);
+
+ if (!stylesheet.attributes.isEmpty()) {
+ for (Map.Entry<String, String> attr : stylesheet.attributes.entrySet()) {
+ builderStylesheet.getAttributes().put(attr.getKey(), attr.getValue());
+ }
+ }
+ }
+
+ builder.setTitle(title == null ? name.toString() : title);
+ builder.setEmitDtd(emitDoctype);
+ if (emitDoctype && htmlDoctype != null) {
+ builder.setHtmlDtd(htmlDoctype);
+ }
+ builder.setUseInlineStyles(useInlineCssStyles);
+ builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
+ builder.setLinkRel(linkRel);
+ builder.setDefaultAbsoluteLinkTarget(defaultAbsoluteLinkTarget);
+ builder.setPrependImagePrefix(prependImagePrefix);
+ builder.setXhtmlStrict(xhtmlStrict);
+ builder.setCopyrightNotice(copyrightNotice);
+
+ SplittingStrategy splittingStrategy = multipleOutputFiles
+ ? new DefaultSplittingStrategy()
+ : new NoSplittingStrategy();
+ SplittingOutlineParser outlineParser = new SplittingOutlineParser();
+ outlineParser.setMarkupLanguage(markupLanguage.clone());
+ outlineParser.setSplittingStrategy(splittingStrategy);
+ SplitOutlineItem item = outlineParser.parse(markupContent);
+ item.setSplitTarget(htmlOutputFile.toFile().getName());
+ SplittingHtmlDocumentBuilder splittingBuilder = new SplittingHtmlDocumentBuilder();
+ splittingBuilder.setRootBuilder(builder);
+ splittingBuilder.setOutline(item);
+ splittingBuilder.setRootFile(htmlOutputFile.toFile());
+ splittingBuilder.setNavigationImages(navigationImages);
+ splittingBuilder.setFormatting(FORMAT_OUTPUT);
+
+ MarkupParser parser = new MarkupParser();
+ parser.setMarkupLanguage(markupLanguage);
+ parser.setBuilder(splittingBuilder);
+ parser.parse(markupContent);
+ }
+ }
+
+ private String gitDescribe() {
+ FileRepositoryBuilder builder = new FileRepositoryBuilder();
+ try {
+ Repository repo = builder.setWorkTree(new File("."))
+ .readEnvironment() // scan environment GIT_* variables
+ .findGitDir() // scan up the file system tree
+ .build();
+ Git git = new Git(repo);
+ DescribeCommand command = git.describe();
+ return command.call();
+ } catch (IOException e) {
+ new RuntimeException(e);
+ } catch (GitAPIException e) {
+ new RuntimeException(e);
+ }
+ return "";
+ }
+
+ private void copy(final Path sourceFolder,
+ final Path targetFolder, String pattern) throws IOException {
+ final PathMatcher imageMatcher = DEFAULT_FS.getPathMatcher(pattern);
+ Files.walkFileTree(sourceFolder, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path sourcePath, BasicFileAttributes attrs) throws IOException {
+ if (imageMatcher.matches(sourcePath)) {
+ String targetFile = sourcePath.toString().replace(sourceFolder.toString(), targetFolder.toString());
+ Path targetPath = DEFAULT_FS.getPath(targetFile);
+ targetPath.getParent().toFile().mkdirs();
+ Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+
+ /**
+ * Returns true if valid (may have warning).
+ * @param source
+ * @param markupContent
+ * @return
+ */
+ private boolean performValidation(Path source, String markupContent) {
+ StandaloneMarkupValidator markupValidator = StandaloneMarkupValidator.getValidator(MEDIA_WIKI);
+
+ List<ValidationProblem> problems = markupValidator.validate(markupContent);
+
+ int errorCount = 0;
+ for (ValidationProblem problem : problems) {
+ String messageLevel = problem.getSeverity().name();
+ if (problem.getSeverity() == Severity.ERROR) {
+ errorCount++;
+ }
+ System.out.println(String.format("%s: %s:%s %s", messageLevel, source.toString(), problem.getOffset(), problem.getMessage())); //$NON-NLS-1$
+ }
+
+ return errorCount == 0;
+ }
+
+ public static class Stylesheet {
+ private File file;
+
+ private String url;
+
+ private final Map<String, String> attributes = new HashMap<>();
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public void addConfiguredAttribute(Attribute attribute) {
+ attributes.put(attribute.getName(), attribute.getValue());
+ }
+ }
+
+ public static class Attribute {
+ private String name;
+
+ private String value;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.doc/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.doc/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.doc/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.doc/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\r\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.resources.prefs
index 4824b8026..99f26c020 100644
--- a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\r\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.jdt.ui.prefs
index 4517c0f23..4e1442ee9 100644
--- a/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.compare.edit/.settings/org.eclipse.jdt.ui.prefs
@@ -1,60 +1,60 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_EMF Compare
-formatter_settings_version=12
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMF Compare
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.compare.edit/build.properties b/plugins/org.eclipse.emf.compare.edit/build.properties
index 3ff2c7288..eef98df95 100644
--- a/plugins/org.eclipse.emf.compare.edit/build.properties
+++ b/plugins/org.eclipse.emf.compare.edit/build.properties
@@ -1,21 +1,21 @@
-# Copyright (c) 2012 Obeo.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Obeo - initial API and implementation
-
-bin.includes = .,\
- icons/,\
- META-INF/,\
- plugin.xml,\
- plugin.properties,\
- about.html
-jars.compile.order = .
-source.. = src-gen/,\
- src/
-output.. = bin/
-src.includes = about.html,\
- icons/
+# Copyright (c) 2012 Obeo.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src-gen/,\
+ src/
+output.. = bin/
+src.includes = about.html,\
+ icons/
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/AttributeChangeItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/AttributeChangeItemProvider.java
index 90ab50c76..9730d71d0 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/AttributeChangeItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/AttributeChangeItemProvider.java
@@ -1,171 +1,171 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.compare.AttributeChange;
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.DifferenceKind;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.AttributeChange} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class AttributeChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public AttributeChangeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addAttributePropertyDescriptor(object);
- addValuePropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addAttributePropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AttributeChange_attribute_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_AttributeChange_attribute_feature", "_UI_AttributeChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.ATTRIBUTE_CHANGE__ATTRIBUTE, true, false, true, null, null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Value feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addValuePropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AttributeChange_value_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_AttributeChange_value_feature", "_UI_AttributeChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.ATTRIBUTE_CHANGE__VALUE, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This returns AttributeChange.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/AttributeChange")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- DifferenceKind labelValue = ((AttributeChange)object).getKind();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_AttributeChange_type") : //$NON-NLS-1$
- getString("_UI_AttributeChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(AttributeChange.class)) {
- case ComparePackage.ATTRIBUTE_CHANGE__VALUE:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
- true));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.compare.AttributeChange;
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.DifferenceKind;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.AttributeChange} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class AttributeChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AttributeChangeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addAttributePropertyDescriptor(object);
+ addValuePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addAttributePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AttributeChange_attribute_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_AttributeChange_attribute_feature", "_UI_AttributeChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.ATTRIBUTE_CHANGE__ATTRIBUTE, true, false, true, null, null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AttributeChange_value_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_AttributeChange_value_feature", "_UI_AttributeChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.ATTRIBUTE_CHANGE__VALUE, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This returns AttributeChange.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/AttributeChange")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ DifferenceKind labelValue = ((AttributeChange)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_AttributeChange_type") : //$NON-NLS-1$
+ getString("_UI_AttributeChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(AttributeChange.class)) {
+ case ComparePackage.ATTRIBUTE_CHANGE__VALUE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/CompareItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/CompareItemProviderAdapterFactory.java
index 78db1b4d0..f05a54694 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/CompareItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/CompareItemProviderAdapterFactory.java
@@ -1,314 +1,314 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.util.CompareAdapterFactory;
-import org.eclipse.emf.edit.provider.ChangeNotifier;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.Disposable;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IDisposable;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers. The adapters
- * generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged
- * fireNotifyChanged}. The adapters also support Eclipse property sheets. Note that most of the adapters are
- * shared among multiple instances. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
-public class CompareItemProviderAdapterFactory extends CompareAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @SuppressWarnings("hiding")
- // generated code : suppressing warnings
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- begin-user-doc
- * --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
- /**
- * This keeps track of all the item providers created, so that they can be {@link #dispose disposed}. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @since 4.0
- */
- protected Disposable disposable = new Disposable();
-
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<Object> supportedTypes = new ArrayList<Object>();
-
- /**
- * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public CompareItemProviderAdapterFactory() {
- supportedTypes.add(IEditingDomainItemProvider.class);
- supportedTypes.add(IStructuredItemContentProvider.class);
- supportedTypes.add(ITreeItemContentProvider.class);
- supportedTypes.add(IItemLabelProvider.class);
- supportedTypes.add(IItemPropertySource.class);
- supportedTypes.add(IItemColorProvider.class);
- supportedTypes.add(IItemFontProvider.class);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.Comparison}. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createComparisonAdapter() {
- return new ComparisonItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.MatchResource}. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createMatchResourceAdapter() {
- return new MatchResourceItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.Match}. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createMatchAdapter() {
- return new MatchItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.Diff}. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createDiffAdapter() {
- return new DiffItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.ResourceAttachmentChange}. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createResourceAttachmentChangeAdapter() {
- return new ResourceAttachmentChangeItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.ReferenceChange}. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createReferenceChangeAdapter() {
- return new ReferenceChangeItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.AttributeChange}. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createAttributeChangeAdapter() {
- return new AttributeChangeItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.Conflict}. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createConflictAdapter() {
- return new ConflictItemProvider(this);
- }
-
- /**
- * This creates an adapter for a {@link org.eclipse.emf.compare.Equivalence}. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter createEquivalenceAdapter() {
- return new EquivalenceItemProvider(this);
- }
-
- /**
- * This returns the root adapter factory that contains this factory. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public ComposeableAdapterFactory getRootAdapterFactory() {
- return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object type) {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Adapter adapt(Notifier notifier, Object type) {
- return super.adapt(notifier, this);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object adapt(Object object, Object type) {
- if (isFactoryForType(type)) {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
- return adapter;
- }
- }
-
- return null;
- }
-
- /**
- * Associates an adapter with a notifier via the base implementation, then records it to ensure it will be
- * disposed. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- protected void associate(Adapter adapter, Notifier target) {
- super.associate(adapter, target);
- if (adapter != null) {
- disposable.add(adapter);
- }
- }
-
- /**
- * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public void fireNotifyChanged(Notification notification) {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null) {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
- /**
- * This disposes all of the item providers created by this factory. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public void dispose() {
- disposable.dispose();
- }
-
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.util.CompareAdapterFactory;
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.Disposable;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers. The adapters
+ * generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged
+ * fireNotifyChanged}. The adapters also support Eclipse property sheets. Note that most of the adapters are
+ * shared among multiple instances. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class CompareItemProviderAdapterFactory extends CompareAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("hiding")
+ // generated code : suppressing warnings
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the item providers created, so that they can be {@link #dispose disposed}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @since 4.0
+ */
+ protected Disposable disposable = new Disposable();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public CompareItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ supportedTypes.add(IItemColorProvider.class);
+ supportedTypes.add(IItemFontProvider.class);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.Comparison}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createComparisonAdapter() {
+ return new ComparisonItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.MatchResource}. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createMatchResourceAdapter() {
+ return new MatchResourceItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.Match}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createMatchAdapter() {
+ return new MatchItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.Diff}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createDiffAdapter() {
+ return new DiffItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.ResourceAttachmentChange}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createResourceAttachmentChangeAdapter() {
+ return new ResourceAttachmentChangeItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.ReferenceChange}. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createReferenceChangeAdapter() {
+ return new ReferenceChangeItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.AttributeChange}. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createAttributeChangeAdapter() {
+ return new AttributeChangeItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.Conflict}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createConflictAdapter() {
+ return new ConflictItemProvider(this);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.compare.Equivalence}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createEquivalenceAdapter() {
+ return new EquivalenceItemProvider(this);
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Associates an adapter with a notifier via the base implementation, then records it to ensure it will be
+ * disposed. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void associate(Adapter adapter, Notifier target) {
+ super.associate(adapter, target);
+ if (adapter != null) {
+ disposable.add(adapter);
+ }
+ }
+
+ /**
+ * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void dispose() {
+ disposable.dispose();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
index cc412af61..1d5ea7559 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
@@ -1,184 +1,184 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.common.util.ResourceLocator;
-
-import org.eclipse.emf.compare.ComparePackage;
-
-import org.eclipse.emf.compare.Conflict;
-import org.eclipse.emf.compare.ConflictKind;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.Conflict} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class ConflictItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConflictItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addKindPropertyDescriptor(object);
- addDifferencesPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Kind feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addKindPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Conflict_kind_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Conflict_kind_feature", "_UI_Conflict_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.CONFLICT__KIND, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Differences feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addDifferencesPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Conflict_differences_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Conflict_differences_feature", "_UI_Conflict_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.CONFLICT__DIFFERENCES, true, false, true, null, null, null));
- }
-
- /**
- * This returns Conflict.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/Conflict")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- ConflictKind labelValue = ((Conflict)object).getKind();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_Conflict_type") : //$NON-NLS-1$
- getString("_UI_Conflict_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(Conflict.class)) {
- case ComparePackage.CONFLICT__KIND:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
- true));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return EMFCompareEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.compare.ComparePackage;
+
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.Conflict} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class ConflictItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ConflictItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addKindPropertyDescriptor(object);
+ addDifferencesPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Kind feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Conflict_kind_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Conflict_kind_feature", "_UI_Conflict_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.CONFLICT__KIND, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Differences feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDifferencesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Conflict_differences_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Conflict_differences_feature", "_UI_Conflict_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.CONFLICT__DIFFERENCES, true, false, true, null, null, null));
+ }
+
+ /**
+ * This returns Conflict.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Conflict")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ ConflictKind labelValue = ((Conflict)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_Conflict_type") : //$NON-NLS-1$
+ getString("_UI_Conflict_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Conflict.class)) {
+ case ComparePackage.CONFLICT__KIND:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return EMFCompareEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/DiffItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/DiffItemProvider.java
index d6c9dce8a..121e5a5b6 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/DiffItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/DiffItemProvider.java
@@ -1,341 +1,341 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.Diff} object. <!-- begin-user-doc
- * --> <!-- end-user-doc -->
- *
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class DiffItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- public DiffItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addRequiresPropertyDescriptor(object);
- addRequiredByPropertyDescriptor(object);
- addImpliesPropertyDescriptor(object);
- addImpliedByPropertyDescriptor(object);
- addRefinesPropertyDescriptor(object);
- addRefinedByPropertyDescriptor(object);
- addPrimeRefiningPropertyDescriptor(object);
- addKindPropertyDescriptor(object);
- addSourcePropertyDescriptor(object);
- addStatePropertyDescriptor(object);
- addEquivalencePropertyDescriptor(object);
- addConflictPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Requires feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addRequiresPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_requires_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_requires_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__REQUIRES, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Required By feature. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected void addRequiredByPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_requiredBy_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_requiredBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__REQUIRED_BY, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Implies feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @since 4.0
- */
- protected void addImpliesPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Diff_implies_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Diff_implies_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__IMPLIES, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Implied By feature. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- * @since 4.0
- */
- protected void addImpliedByPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_impliedBy_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_impliedBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__IMPLIED_BY, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Refines feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addRefinesPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Diff_refines_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Diff_refines_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__REFINES, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Refined By feature. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected void addRefinedByPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_refinedBy_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_refinedBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__REFINED_BY, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Prime Refining feature. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- * @since 4.0
- */
- protected void addPrimeRefiningPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_primeRefining_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_primeRefining_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__PRIME_REFINING, false, false, false, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Kind feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addKindPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(),
- getString("_UI_Diff_kind_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Diff_kind_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__KIND, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Source feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addSourcePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(),
- getString("_UI_Diff_source_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Diff_source_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__SOURCE, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the State feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addStatePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(),
- getString("_UI_Diff_state_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Diff_state_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__STATE, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Equivalence feature. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected void addEquivalencePropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_equivalence_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_equivalence_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__EQUIVALENCE, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Conflict feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addConflictPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Diff_conflict_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Diff_conflict_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.DIFF__CONFLICT, true, false, true, null, null, null));
- }
-
- /**
- * This returns Diff.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/Diff")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public String getText(Object object) {
- DifferenceKind labelValue = ((Diff)object).getKind();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_Diff_type") : //$NON-NLS-1$
- getString("_UI_Diff_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached children and
- * by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc
- * --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(Diff.class)) {
- case ComparePackage.DIFF__KIND:
- case ComparePackage.DIFF__SOURCE:
- case ComparePackage.DIFF__STATE:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
- true));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be
- * created under this object. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
- /**
- * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return EMFCompareEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.Diff} object. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class DiffItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ public DiffItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addRequiresPropertyDescriptor(object);
+ addRequiredByPropertyDescriptor(object);
+ addImpliesPropertyDescriptor(object);
+ addImpliedByPropertyDescriptor(object);
+ addRefinesPropertyDescriptor(object);
+ addRefinedByPropertyDescriptor(object);
+ addPrimeRefiningPropertyDescriptor(object);
+ addKindPropertyDescriptor(object);
+ addSourcePropertyDescriptor(object);
+ addStatePropertyDescriptor(object);
+ addEquivalencePropertyDescriptor(object);
+ addConflictPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Requires feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addRequiresPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_requires_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_requires_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__REQUIRES, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Required By feature. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected void addRequiredByPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_requiredBy_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_requiredBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__REQUIRED_BY, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Implies feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @since 4.0
+ */
+ protected void addImpliesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Diff_implies_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Diff_implies_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__IMPLIES, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Implied By feature. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @since 4.0
+ */
+ protected void addImpliedByPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_impliedBy_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_impliedBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__IMPLIED_BY, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Refines feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addRefinesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Diff_refines_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Diff_refines_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__REFINES, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Refined By feature. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected void addRefinedByPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_refinedBy_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_refinedBy_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__REFINED_BY, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Prime Refining feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @since 4.0
+ */
+ protected void addPrimeRefiningPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_primeRefining_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_primeRefining_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__PRIME_REFINING, false, false, false, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Kind feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(),
+ getString("_UI_Diff_kind_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Diff_kind_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__KIND, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Source feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addSourcePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(),
+ getString("_UI_Diff_source_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Diff_source_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__SOURCE, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the State feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addStatePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(),
+ getString("_UI_Diff_state_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Diff_state_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__STATE, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Equivalence feature. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected void addEquivalencePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_equivalence_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_equivalence_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__EQUIVALENCE, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Conflict feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addConflictPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Diff_conflict_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Diff_conflict_feature", "_UI_Diff_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.DIFF__CONFLICT, true, false, true, null, null, null));
+ }
+
+ /**
+ * This returns Diff.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Diff")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ DifferenceKind labelValue = ((Diff)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_Diff_type") : //$NON-NLS-1$
+ getString("_UI_Diff_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached children and
+ * by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Diff.class)) {
+ case ComparePackage.DIFF__KIND:
+ case ComparePackage.DIFF__SOURCE:
+ case ComparePackage.DIFF__STATE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be
+ * created under this object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return EMFCompareEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/EquivalenceItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/EquivalenceItemProvider.java
index 9749859a8..c56d150e8 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/EquivalenceItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/EquivalenceItemProvider.java
@@ -1,151 +1,151 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.common.util.ResourceLocator;
-
-import org.eclipse.emf.compare.ComparePackage;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.Equivalence} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class EquivalenceItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EquivalenceItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addDifferencesPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Differences feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addDifferencesPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Equivalence_differences_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Equivalence_differences_feature", "_UI_Equivalence_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.EQUIVALENCE__DIFFERENCES, true, false, true, null, null, null));
- }
-
- /**
- * This returns Equivalence.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/Equivalence")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- return getString("_UI_Equivalence_type"); //$NON-NLS-1$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return EMFCompareEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.compare.ComparePackage;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.Equivalence} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class EquivalenceItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EquivalenceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addDifferencesPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Differences feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDifferencesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Equivalence_differences_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Equivalence_differences_feature", "_UI_Equivalence_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.EQUIVALENCE__DIFFERENCES, true, false, true, null, null, null));
+ }
+
+ /**
+ * This returns Equivalence.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Equivalence")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_Equivalence_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return EMFCompareEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchItemProvider.java
index 3620710ad..17af1c397 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchItemProvider.java
@@ -1,238 +1,238 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.common.util.ResourceLocator;
-
-import org.eclipse.emf.compare.CompareFactory;
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.Match;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.Match} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class MatchItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public MatchItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addLeftPropertyDescriptor(object);
- addRightPropertyDescriptor(object);
- addOriginPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Left feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addLeftPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Match_left_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Match_left_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH__LEFT, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Right feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addRightPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Match_right_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Match_right_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH__RIGHT, true, false, true, null, null, null));
- }
-
- /**
- * This adds a property descriptor for the Origin feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addOriginPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Match_origin_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_Match_origin_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH__ORIGIN, true, false, true, null, null, null));
- }
-
- /**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
- * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(ComparePackage.Literals.MATCH__SUBMATCHES);
- childrenFeatures.add(ComparePackage.Literals.MATCH__DIFFERENCES);
- }
- return childrenFeatures;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EStructuralFeature getChildFeature(Object object, Object child) {
- // Check the type of the specified child object and return the proper feature to use for
- // adding (see {@link AddCommand}) it as a child.
-
- return super.getChildFeature(object, child);
- }
-
- /**
- * This returns Match.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/Match")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- return getString("_UI_Match_type"); //$NON-NLS-1$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(Match.class)) {
- case ComparePackage.MATCH__SUBMATCHES:
- case ComparePackage.MATCH__DIFFERENCES:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true,
- false));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
-
- newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__SUBMATCHES,
- CompareFactory.eINSTANCE.createMatch()));
-
- newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
- CompareFactory.eINSTANCE.createDiff()));
-
- newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
- CompareFactory.eINSTANCE.createResourceAttachmentChange()));
-
- newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
- CompareFactory.eINSTANCE.createReferenceChange()));
-
- newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
- CompareFactory.eINSTANCE.createAttributeChange()));
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return EMFCompareEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.compare.CompareFactory;
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.Match;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.Match} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class MatchItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MatchItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addLeftPropertyDescriptor(object);
+ addRightPropertyDescriptor(object);
+ addOriginPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Left feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLeftPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Match_left_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Match_left_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH__LEFT, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Right feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addRightPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Match_right_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Match_right_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH__RIGHT, true, false, true, null, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Origin feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOriginPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Match_origin_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Match_origin_feature", "_UI_Match_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH__ORIGIN, true, false, true, null, null, null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(ComparePackage.Literals.MATCH__SUBMATCHES);
+ childrenFeatures.add(ComparePackage.Literals.MATCH__DIFFERENCES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns Match.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Match")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_Match_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Match.class)) {
+ case ComparePackage.MATCH__SUBMATCHES:
+ case ComparePackage.MATCH__DIFFERENCES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true,
+ false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__SUBMATCHES,
+ CompareFactory.eINSTANCE.createMatch()));
+
+ newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
+ CompareFactory.eINSTANCE.createDiff()));
+
+ newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
+ CompareFactory.eINSTANCE.createResourceAttachmentChange()));
+
+ newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
+ CompareFactory.eINSTANCE.createReferenceChange()));
+
+ newChildDescriptors.add(createChildParameter(ComparePackage.Literals.MATCH__DIFFERENCES,
+ CompareFactory.eINSTANCE.createAttributeChange()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return EMFCompareEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchResourceItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchResourceItemProvider.java
index bb83b40a9..dca8aba39 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchResourceItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/MatchResourceItemProvider.java
@@ -1,264 +1,264 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.common.util.ResourceLocator;
-
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.MatchResource;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.MatchResource} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class MatchResourceItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public MatchResourceItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addLeftURIPropertyDescriptor(object);
- addRightURIPropertyDescriptor(object);
- addOriginURIPropertyDescriptor(object);
- addLeftPropertyDescriptor(object);
- addRightPropertyDescriptor(object);
- addOriginPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Left URI feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addLeftURIPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_leftURI_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_leftURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__LEFT_URI, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Right URI feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addRightURIPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_rightURI_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_rightURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__RIGHT_URI, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Origin URI feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addOriginURIPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_originURI_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_originURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__ORIGIN_URI, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Left feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addLeftPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_left_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_left_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__LEFT, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Right feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addRightPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_right_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_right_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__RIGHT, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This adds a property descriptor for the Origin feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addOriginPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_MatchResource_origin_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_MatchResource_origin_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.MATCH_RESOURCE__ORIGIN, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This returns MatchResource.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/MatchResource")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- String label = ((MatchResource)object).getLeftURI();
- return label == null || label.length() == 0 ? getString("_UI_MatchResource_type") : //$NON-NLS-1$
- getString("_UI_MatchResource_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(MatchResource.class)) {
- case ComparePackage.MATCH_RESOURCE__LEFT_URI:
- case ComparePackage.MATCH_RESOURCE__RIGHT_URI:
- case ComparePackage.MATCH_RESOURCE__ORIGIN_URI:
- case ComparePackage.MATCH_RESOURCE__LEFT:
- case ComparePackage.MATCH_RESOURCE__RIGHT:
- case ComparePackage.MATCH_RESOURCE__ORIGIN:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
- true));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return EMFCompareEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.MatchResource;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.MatchResource} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class MatchResourceItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MatchResourceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addLeftURIPropertyDescriptor(object);
+ addRightURIPropertyDescriptor(object);
+ addOriginURIPropertyDescriptor(object);
+ addLeftPropertyDescriptor(object);
+ addRightPropertyDescriptor(object);
+ addOriginPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Left URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLeftURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_leftURI_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_leftURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__LEFT_URI, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Right URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addRightURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_rightURI_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_rightURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__RIGHT_URI, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Origin URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOriginURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_originURI_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_originURI_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__ORIGIN_URI, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Left feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLeftPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_left_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_left_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__LEFT, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Right feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addRightPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_right_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_right_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__RIGHT, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Origin feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOriginPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_MatchResource_origin_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_MatchResource_origin_feature", "_UI_MatchResource_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.MATCH_RESOURCE__ORIGIN, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This returns MatchResource.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/MatchResource")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((MatchResource)object).getLeftURI();
+ return label == null || label.length() == 0 ? getString("_UI_MatchResource_type") : //$NON-NLS-1$
+ getString("_UI_MatchResource_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(MatchResource.class)) {
+ case ComparePackage.MATCH_RESOURCE__LEFT_URI:
+ case ComparePackage.MATCH_RESOURCE__RIGHT_URI:
+ case ComparePackage.MATCH_RESOURCE__ORIGIN_URI:
+ case ComparePackage.MATCH_RESOURCE__LEFT:
+ case ComparePackage.MATCH_RESOURCE__RIGHT:
+ case ComparePackage.MATCH_RESOURCE__ORIGIN:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return EMFCompareEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ReferenceChangeItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ReferenceChangeItemProvider.java
index 51ffb810b..e1c751481 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ReferenceChangeItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ReferenceChangeItemProvider.java
@@ -1,161 +1,161 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.ReferenceChange;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.ReferenceChange} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class ReferenceChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReferenceChangeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addReferencePropertyDescriptor(object);
- addValuePropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addReferencePropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_ReferenceChange_reference_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_ReferenceChange_reference_feature", "_UI_ReferenceChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.REFERENCE_CHANGE__REFERENCE, true, false, true, null, null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Value feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addValuePropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_ReferenceChange_value_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_ReferenceChange_value_feature", "_UI_ReferenceChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.REFERENCE_CHANGE__VALUE, true, false, true, null, null, null));
- }
-
- /**
- * This returns ReferenceChange.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/ReferenceChange")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- DifferenceKind labelValue = ((ReferenceChange)object).getKind();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_ReferenceChange_type") : //$NON-NLS-1$
- getString("_UI_ReferenceChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.ReferenceChange;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.ReferenceChange} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class ReferenceChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ReferenceChangeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addReferencePropertyDescriptor(object);
+ addValuePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addReferencePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ReferenceChange_reference_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_ReferenceChange_reference_feature", "_UI_ReferenceChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.REFERENCE_CHANGE__REFERENCE, true, false, true, null, null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ReferenceChange_value_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_ReferenceChange_value_feature", "_UI_ReferenceChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.REFERENCE_CHANGE__VALUE, true, false, true, null, null, null));
+ }
+
+ /**
+ * This returns ReferenceChange.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/ReferenceChange")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ DifferenceKind labelValue = ((ReferenceChange)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_ReferenceChange_type") : //$NON-NLS-1$
+ getString("_UI_ReferenceChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ResourceAttachmentChangeItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ResourceAttachmentChangeItemProvider.java
index 85b7f283d..974a938e4 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ResourceAttachmentChangeItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ResourceAttachmentChangeItemProvider.java
@@ -1,152 +1,152 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.provider;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.compare.ComparePackage;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.ResourceAttachmentChange;
-
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.ResourceAttachmentChange} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-@SuppressWarnings("all")
-// generated code : suppressing warnings
-public class ResourceAttachmentChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ResourceAttachmentChangeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- addResourceURIPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Resource URI feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addResourceURIPropertyDescriptor(Object object) {
- itemPropertyDescriptors
- .add(createItemPropertyDescriptor(
- ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_ResourceAttachmentChange_resourceURI_feature"), //$NON-NLS-1$
- getString(
- "_UI_PropertyDescriptor_description", "_UI_ResourceAttachmentChange_resourceURI_feature", "_UI_ResourceAttachmentChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ComparePackage.Literals.RESOURCE_ATTACHMENT_CHANGE__RESOURCE_URI, true, false, false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
- }
-
- /**
- * This returns ResourceAttachmentChange.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceAttachmentChange")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- DifferenceKind labelValue = ((ResourceAttachmentChange)object).getKind();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_ResourceAttachmentChange_type") : //$NON-NLS-1$
- getString("_UI_ResourceAttachmentChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(ResourceAttachmentChange.class)) {
- case ComparePackage.RESOURCE_ATTACHMENT_CHANGE__RESOURCE_URI:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
- true));
- return;
- }
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.ResourceAttachmentChange;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.ResourceAttachmentChange} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+@SuppressWarnings("all")
+// generated code : suppressing warnings
+public class ResourceAttachmentChangeItemProvider extends DiffItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ResourceAttachmentChangeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addResourceURIPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Resource URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addResourceURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ResourceAttachmentChange_resourceURI_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_ResourceAttachmentChange_resourceURI_feature", "_UI_ResourceAttachmentChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.RESOURCE_ATTACHMENT_CHANGE__RESOURCE_URI, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This returns ResourceAttachmentChange.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceAttachmentChange")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ DifferenceKind labelValue = ((ResourceAttachmentChange)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_ResourceAttachmentChange_type") : //$NON-NLS-1$
+ getString("_UI_ResourceAttachmentChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(ResourceAttachmentChange.class)) {
+ case ComparePackage.RESOURCE_ATTACHMENT_CHANGE__RESOURCE_URI:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/DelegatingCommandStack.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/DelegatingCommandStack.java
index 02135b2d4..374db02a1 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/DelegatingCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/DelegatingCommandStack.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.command.CommandStackListener;
-
-/**
- * Abstract implementation that forward method calls to a {@link #delegate() delegatating}
- * {@link CommandStack}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @since 4.0
- */
-// CHECKSTYLE:OFF
-public abstract class DelegatingCommandStack implements CommandStack {
- // CHECKSTYLE:ON
-
- /**
- * Returns the backing delegate instance that methods are forwarded to.
- *
- * @return the backing delegate instance that methods are forwarded to.
- */
- protected abstract CommandStack delegate();
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#execute(org.eclipse.emf.common.command.Command)
- */
- public void execute(Command command) {
- delegate().execute(command);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#canUndo()
- */
- public boolean canUndo() {
- return delegate().canUndo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#undo()
- */
- public void undo() {
- delegate().undo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#canRedo()
- */
- public boolean canRedo() {
- return delegate().canRedo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getUndoCommand()
- */
- public Command getUndoCommand() {
- return delegate().getUndoCommand();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getRedoCommand()
- */
- public Command getRedoCommand() {
- return delegate().getRedoCommand();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getMostRecentCommand()
- */
- public Command getMostRecentCommand() {
- return delegate().getMostRecentCommand();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#redo()
- */
- public void redo() {
- delegate().redo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#flush()
- */
- public void flush() {
- delegate().flush();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
- */
- public void addCommandStackListener(CommandStackListener listener) {
- delegate().addCommandStackListener(listener);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
- */
- public void removeCommandStackListener(CommandStackListener listener) {
- delegate().removeCommandStackListener(listener);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+
+/**
+ * Abstract implementation that forward method calls to a {@link #delegate() delegatating}
+ * {@link CommandStack}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @since 4.0
+ */
+// CHECKSTYLE:OFF
+public abstract class DelegatingCommandStack implements CommandStack {
+ // CHECKSTYLE:ON
+
+ /**
+ * Returns the backing delegate instance that methods are forwarded to.
+ *
+ * @return the backing delegate instance that methods are forwarded to.
+ */
+ protected abstract CommandStack delegate();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#execute(org.eclipse.emf.common.command.Command)
+ */
+ public void execute(Command command) {
+ delegate().execute(command);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#canUndo()
+ */
+ public boolean canUndo() {
+ return delegate().canUndo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#undo()
+ */
+ public void undo() {
+ delegate().undo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#canRedo()
+ */
+ public boolean canRedo() {
+ return delegate().canRedo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getUndoCommand()
+ */
+ public Command getUndoCommand() {
+ return delegate().getUndoCommand();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getRedoCommand()
+ */
+ public Command getRedoCommand() {
+ return delegate().getRedoCommand();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getMostRecentCommand()
+ */
+ public Command getMostRecentCommand() {
+ return delegate().getMostRecentCommand();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#redo()
+ */
+ public void redo() {
+ delegate().redo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#flush()
+ */
+ public void flush() {
+ delegate().flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
+ */
+ public void addCommandStackListener(CommandStackListener listener) {
+ delegate().addCommandStackListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
+ */
+ public void removeCommandStackListener(CommandStackListener listener) {
+ delegate().removeCommandStackListener(listener);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCommandStack.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCommandStack.java
index e05a39cb3..e5e072d40 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCommandStack.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command;
-
-import org.eclipse.emf.common.command.CommandStack;
-
-/**
- * An extended {@link CommandStack command stack} that knows about each save state of the comparison.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public interface ICompareCommandStack extends CommandStack {
-
- /**
- * Returns whether the left model has changes since {@link #leftSaveIsDone} was call the last.
- *
- * @return whether the left model has changes since {@link #leftSaveIsDone} was call the last.
- */
- boolean isLeftSaveNeeded();
-
- /**
- * Returns whether the right model has changes since {@link #rightSaveIsDone} was call the last.
- *
- * @return whether the right model has changes since {@link #rightSaveIsDone} was call the last.
- */
- boolean isRightSaveNeeded();
-
- /**
- * Called after a save of the left model has been successfully performed.
- */
- void leftSaveIsDone();
-
- /**
- * Called after a save of the right model has been successfully performed.
- */
- void rightSaveIsDone();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command;
+
+import org.eclipse.emf.common.command.CommandStack;
+
+/**
+ * An extended {@link CommandStack command stack} that knows about each save state of the comparison.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public interface ICompareCommandStack extends CommandStack {
+
+ /**
+ * Returns whether the left model has changes since {@link #leftSaveIsDone} was call the last.
+ *
+ * @return whether the left model has changes since {@link #leftSaveIsDone} was call the last.
+ */
+ boolean isLeftSaveNeeded();
+
+ /**
+ * Returns whether the right model has changes since {@link #rightSaveIsDone} was call the last.
+ *
+ * @return whether the right model has changes since {@link #rightSaveIsDone} was call the last.
+ */
+ boolean isRightSaveNeeded();
+
+ /**
+ * Called after a save of the left model has been successfully performed.
+ */
+ void leftSaveIsDone();
+
+ /**
+ * Called after a save of the right model has been successfully performed.
+ */
+ void rightSaveIsDone();
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCopyCommand.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCopyCommand.java
index 508bc7f92..fc23351cf 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCopyCommand.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/ICompareCopyCommand.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command;
-
-import org.eclipse.emf.common.command.Command;
-
-/**
- * Interface of compare copy (merge) command. It knows on which side of the copy will be applied.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public interface ICompareCopyCommand extends Command {
-
- /**
- * Returns true if the command will be applied from left to right side, false otherwise.
- *
- * @return true if the command will be applied from left to right side, false otherwise.
- */
- boolean isLeftToRight();
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command;
+
+import org.eclipse.emf.common.command.Command;
+
+/**
+ * Interface of compare copy (merge) command. It knows on which side of the copy will be applied.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public interface ICompareCopyCommand extends Command {
+
+ /**
+ * Returns true if the command will be applied from left to right side, false otherwise.
+ *
+ * @return true if the command will be applied from left to right side, false otherwise.
+ */
+ boolean isLeftToRight();
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/AbstractCopyCommand.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/AbstractCopyCommand.java
index 80ed91b42..fb7f8a9f2 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/AbstractCopyCommand.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/AbstractCopyCommand.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command.impl;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.command.ICompareCopyCommand;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.ecore.change.util.ChangeRecorder;
-import org.eclipse.emf.edit.command.ChangeCommand;
-
-/**
- * This command can be used to copy a number of diffs (or a single one) in a given direction.
- *
- * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
- * @since 3.0
- */
-public abstract class AbstractCopyCommand extends ChangeCommand implements ICompareCopyCommand {
- /** The list of differences we are to merge. */
- protected final List<? extends Diff> differences;
-
- /** Direction of the merge operation. */
- protected final boolean leftToRight;
-
- /** Merger registry. */
- protected final IMerger.Registry mergerRegistry;
-
- /**
- * Constructs an instance of this command given the list of differences that it needs to merge.
- *
- * @param changeRecorder
- * The change recorder associated to this command.
- * @param notifiers
- * The collection of notifiers that will be notified of this command's execution.
- * @param differences
- * The list of differences that this command should merge.
- * @param leftToRight
- * The direction in which {@code differences} should be merged.
- * @param mergerRegistry
- * The registry of mergers.
- */
- public AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers,
- List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry) {
- super(changeRecorder, notifiers);
- this.differences = ImmutableList.copyOf(differences);
- this.leftToRight = leftToRight;
- this.mergerRegistry = mergerRegistry;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCopyCommand#isLeftToRight()
- */
- public boolean isLeftToRight() {
- return leftToRight;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#getAffectedObjects()
- */
- @Override
- public Collection<?> getAffectedObjects() {
- return differences;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
- */
- @Override
- public boolean canExecute() {
- return super.canExecute() && !differences.isEmpty();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command.impl;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.command.ICompareCopyCommand;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.ecore.change.util.ChangeRecorder;
+import org.eclipse.emf.edit.command.ChangeCommand;
+
+/**
+ * This command can be used to copy a number of diffs (or a single one) in a given direction.
+ *
+ * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
+ * @since 3.0
+ */
+public abstract class AbstractCopyCommand extends ChangeCommand implements ICompareCopyCommand {
+ /** The list of differences we are to merge. */
+ protected final List<? extends Diff> differences;
+
+ /** Direction of the merge operation. */
+ protected final boolean leftToRight;
+
+ /** Merger registry. */
+ protected final IMerger.Registry mergerRegistry;
+
+ /**
+ * Constructs an instance of this command given the list of differences that it needs to merge.
+ *
+ * @param changeRecorder
+ * The change recorder associated to this command.
+ * @param notifiers
+ * The collection of notifiers that will be notified of this command's execution.
+ * @param differences
+ * The list of differences that this command should merge.
+ * @param leftToRight
+ * The direction in which {@code differences} should be merged.
+ * @param mergerRegistry
+ * The registry of mergers.
+ */
+ public AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers,
+ List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry) {
+ super(changeRecorder, notifiers);
+ this.differences = ImmutableList.copyOf(differences);
+ this.leftToRight = leftToRight;
+ this.mergerRegistry = mergerRegistry;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCopyCommand#isLeftToRight()
+ */
+ public boolean isLeftToRight() {
+ return leftToRight;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#getAffectedObjects()
+ */
+ @Override
+ public Collection<?> getAffectedObjects() {
+ return differences;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
+ */
+ @Override
+ public boolean canExecute() {
+ return super.canExecute() && !differences.isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/CompareCommandStack.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/CompareCommandStack.java
index 043758a7e..e72f73785 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/CompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/CompareCommandStack.java
@@ -1,372 +1,372 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command.impl;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.compare.command.DelegatingCommandStack;
-import org.eclipse.emf.compare.command.ICompareCommandStack;
-import org.eclipse.emf.compare.command.ICompareCopyCommand;
-
-/**
- * A simple {@link ICompareCommandStack} that delegate execution to another command stack but keep
- * informations about execution to properly reply to {@link ICompareCommandStack} protocol.
- * <p>
- * This implementation is not robust. If an error occurs during execution of a command, the whole state will
- * be corrupted and the undo/redo may have an unknown behavior.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class CompareCommandStack extends DelegatingCommandStack implements ICompareCommandStack {
-
- /** The data structure to keep info of command executed on the right side. */
- private final CompareSideCommandStack rightCommandStack;
-
- /** The data structure to keep info of command executed on the left side. */
- private final CompareSideCommandStack leftCommandStack;
-
- /** The command to which we delegate to. */
- private final CommandStack delegate;
-
- /**
- * Creates a new instance that delegates to the given {@code commandStack}.
- *
- * @param commandStack
- * the command stack to which this instance will delegate.
- */
- public CompareCommandStack(CommandStack commandStack) {
- this.delegate = commandStack;
- this.rightCommandStack = new CompareSideCommandStack();
- this.leftCommandStack = new CompareSideCommandStack();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.DelegatingCommandStack#delegate()
- */
- @Override
- protected CommandStack delegate() {
- return delegate;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.DelegatingCommandStack#execute(org.eclipse.emf.common.command.Command)
- */
- @Override
- public void execute(Command command) {
- // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
- // side lists.
- if (command instanceof ICompareCopyCommand) {
- ICompareCopyCommand compareCommand = (ICompareCopyCommand)command;
- if (compareCommand.isLeftToRight()) {
- rightCommandStack.executed(compareCommand);
- } else {
- leftCommandStack.executed(compareCommand);
- }
- }
- super.execute(command);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.BasicCommandStack#undo()
- */
- @Override
- public void undo() {
- // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
- // side lists.
- if (canUndo()) {
- if (getUndoCommand() instanceof ICompareCopyCommand) {
- ICompareCopyCommand compareCommand = (ICompareCopyCommand)getUndoCommand();
- if (compareCommand.isLeftToRight()) {
- rightCommandStack.undone();
- } else {
- leftCommandStack.undone();
- }
- }
- }
- super.undo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.BasicCommandStack#redo()
- */
- @Override
- public void redo() {
- // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
- // side lists.
- if (canRedo()) {
- if (getRedoCommand() instanceof ICompareCopyCommand) {
- ICompareCopyCommand compareCommand = (ICompareCopyCommand)getRedoCommand();
- if (compareCommand.isLeftToRight()) {
- rightCommandStack.redone();
- } else {
- leftCommandStack.redone();
- }
- }
- }
- super.redo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#flush()
- */
- @Override
- public void flush() {
- rightCommandStack.flushed();
- leftCommandStack.flushed();
- super.flush();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#isLeftSaveNeeded()
- */
- public boolean isLeftSaveNeeded() {
- return leftCommandStack.isSaveNeeded();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#isRightSaveNeeded()
- */
- public boolean isRightSaveNeeded() {
- return rightCommandStack.isSaveNeeded();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#leftSaveIsDone()
- */
- public void leftSaveIsDone() {
- leftCommandStack.saveIsDone();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#rightSaveIsDone()
- */
- public void rightSaveIsDone() {
- rightCommandStack.saveIsDone();
- }
-
- /**
- * Simple data structure acting like a command stack but without any execution capability. It is used to
- * record execution of {@link ICompareCopyCommand} on each side.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- public static class CompareSideCommandStack {
-
- /**
- * This will force the {@link #isSaveNeeded()} to return <code>true</code>.
- */
- private static final int IS_SAVE_NEEDED_WILL_BE_TRUE = -2;
-
- /**
- * The list of commands.
- */
- private final List<ICompareCopyCommand> commandList;
-
- /**
- * The current position within the list from which the next execute, undo, or redo, will be performed.
- */
- private int top;
-
- /**
- * The command most recently executed, undone, or redone.
- */
- private Command mostRecentCommand;
-
- /**
- * The value of {@link #top} when {@link #saveIsDone} is called.
- */
- private int saveIndex = -1;
-
- /**
- * Creates a new empty instance.
- */
- public CompareSideCommandStack() {
- commandList = newArrayList();
- top = -1;
- }
-
- /**
- * Record the execution of the given command.
- *
- * @param command
- * the command to record.
- */
- public void executed(ICompareCopyCommand command) {
- // If the command is executable, record it.
- //
- if (command != null) {
- if (command.canExecute()) {
- // Clear the list past the top.
- //
- Iterator<ICompareCopyCommand> commands = commandList.listIterator(top + 1);
- while (commands.hasNext()) {
- commands.next();
- commands.remove();
- }
-
- // Record the successfully executed command.
- //
- mostRecentCommand = command;
- commandList.add(command);
- ++top;
-
- // This is kind of tricky.
- // If the saveIndex was in the redo part of the command list which has now been wiped
- // out,
- // then we can never reach a point where a save is not necessary, not even if we undo
- // all the way back to the beginning.
- //
- if (saveIndex >= top) {
- // This forces isSaveNeded to always be true.
- //
- saveIndex = IS_SAVE_NEEDED_WILL_BE_TRUE;
- }
- }
- }
- }
-
- /**
- * Record that the top of the command list has been undone.
- */
- public void undone() {
- Command command = commandList.get(top--);
- mostRecentCommand = command;
- }
-
- /**
- * Record that the top of the command list has been redone.
- */
- public void redone() {
- Command command = commandList.get(++top);
- mostRecentCommand = command;
- }
-
- /**
- * Disposes all the commands in the stack.
- */
- public void flushed() {
- // Clear the list.
- //
- Iterator<ICompareCopyCommand> commands = commandList.listIterator();
- while (commands.hasNext()) {
- commands.next();
- commands.remove();
- }
- commandList.clear();
- top = -1;
- saveIndex = -1;
- mostRecentCommand = null;
- }
-
- /**
- * Called after a save has been successfully performed.
- */
- public void saveIsDone() {
- // Remember where we are now.
- //
- saveIndex = top;
- }
-
- /**
- * Returns whether the model has changes since {@link #saveIsDone} was call the last.
- *
- * @return whether the model has changes since <code>saveIsDone</code> was call the last.
- */
- public boolean isSaveNeeded() {
- boolean ret = false;
-
- if (saveIndex < -1) {
- ret = true;
- }
-
- if (!ret) {
- if (top > saveIndex) {
- for (int i = top; !ret && i > saveIndex; --i) {
- if (!(commandList.get(i) instanceof AbstractCommand.NonDirtying)) {
- ret = true;
- }
- }
- } else {
- for (int i = saveIndex; !ret && i > top; --i) {
- if (!(commandList.get(i) instanceof AbstractCommand.NonDirtying)) {
- ret = true;
- }
- }
- }
- }
-
- return ret;
- }
-
- /**
- * Returns the command that will be undone if {@link #undo} is called.
- *
- * @return the command that will be undone if {@link #undo} is called.
- */
- public Command getUndoCommand() {
- final Command undoCommand;
- if (top == -1 || top == commandList.size()) {
- undoCommand = null;
- } else {
- undoCommand = commandList.get(top);
- }
- return undoCommand;
- }
-
- /**
- * Returns the command that will be redone if {@link #redo} is called.
- *
- * @return the command that will be redone if {@link #redo} is called.
- */
- public Command getRedoCommand() {
- final Command redoCommand;
- if (top + 1 >= commandList.size()) {
- redoCommand = null;
- } else {
- redoCommand = commandList.get(top + 1);
- }
- return redoCommand;
- }
-
- /**
- * Returns the command most recently executed, undone, or redone.
- *
- * @return the command most recently executed, undone, or redone.
- */
- public Command getMostRecentCommand() {
- return mostRecentCommand;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command.impl;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.compare.command.DelegatingCommandStack;
+import org.eclipse.emf.compare.command.ICompareCommandStack;
+import org.eclipse.emf.compare.command.ICompareCopyCommand;
+
+/**
+ * A simple {@link ICompareCommandStack} that delegate execution to another command stack but keep
+ * informations about execution to properly reply to {@link ICompareCommandStack} protocol.
+ * <p>
+ * This implementation is not robust. If an error occurs during execution of a command, the whole state will
+ * be corrupted and the undo/redo may have an unknown behavior.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class CompareCommandStack extends DelegatingCommandStack implements ICompareCommandStack {
+
+ /** The data structure to keep info of command executed on the right side. */
+ private final CompareSideCommandStack rightCommandStack;
+
+ /** The data structure to keep info of command executed on the left side. */
+ private final CompareSideCommandStack leftCommandStack;
+
+ /** The command to which we delegate to. */
+ private final CommandStack delegate;
+
+ /**
+ * Creates a new instance that delegates to the given {@code commandStack}.
+ *
+ * @param commandStack
+ * the command stack to which this instance will delegate.
+ */
+ public CompareCommandStack(CommandStack commandStack) {
+ this.delegate = commandStack;
+ this.rightCommandStack = new CompareSideCommandStack();
+ this.leftCommandStack = new CompareSideCommandStack();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.DelegatingCommandStack#delegate()
+ */
+ @Override
+ protected CommandStack delegate() {
+ return delegate;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.DelegatingCommandStack#execute(org.eclipse.emf.common.command.Command)
+ */
+ @Override
+ public void execute(Command command) {
+ // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
+ // side lists.
+ if (command instanceof ICompareCopyCommand) {
+ ICompareCopyCommand compareCommand = (ICompareCopyCommand)command;
+ if (compareCommand.isLeftToRight()) {
+ rightCommandStack.executed(compareCommand);
+ } else {
+ leftCommandStack.executed(compareCommand);
+ }
+ }
+ super.execute(command);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.BasicCommandStack#undo()
+ */
+ @Override
+ public void undo() {
+ // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
+ // side lists.
+ if (canUndo()) {
+ if (getUndoCommand() instanceof ICompareCopyCommand) {
+ ICompareCopyCommand compareCommand = (ICompareCopyCommand)getUndoCommand();
+ if (compareCommand.isLeftToRight()) {
+ rightCommandStack.undone();
+ } else {
+ leftCommandStack.undone();
+ }
+ }
+ }
+ super.undo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.BasicCommandStack#redo()
+ */
+ @Override
+ public void redo() {
+ // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
+ // side lists.
+ if (canRedo()) {
+ if (getRedoCommand() instanceof ICompareCopyCommand) {
+ ICompareCopyCommand compareCommand = (ICompareCopyCommand)getRedoCommand();
+ if (compareCommand.isLeftToRight()) {
+ rightCommandStack.redone();
+ } else {
+ leftCommandStack.redone();
+ }
+ }
+ }
+ super.redo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#flush()
+ */
+ @Override
+ public void flush() {
+ rightCommandStack.flushed();
+ leftCommandStack.flushed();
+ super.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#isLeftSaveNeeded()
+ */
+ public boolean isLeftSaveNeeded() {
+ return leftCommandStack.isSaveNeeded();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#isRightSaveNeeded()
+ */
+ public boolean isRightSaveNeeded() {
+ return rightCommandStack.isSaveNeeded();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#leftSaveIsDone()
+ */
+ public void leftSaveIsDone() {
+ leftCommandStack.saveIsDone();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#rightSaveIsDone()
+ */
+ public void rightSaveIsDone() {
+ rightCommandStack.saveIsDone();
+ }
+
+ /**
+ * Simple data structure acting like a command stack but without any execution capability. It is used to
+ * record execution of {@link ICompareCopyCommand} on each side.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ public static class CompareSideCommandStack {
+
+ /**
+ * This will force the {@link #isSaveNeeded()} to return <code>true</code>.
+ */
+ private static final int IS_SAVE_NEEDED_WILL_BE_TRUE = -2;
+
+ /**
+ * The list of commands.
+ */
+ private final List<ICompareCopyCommand> commandList;
+
+ /**
+ * The current position within the list from which the next execute, undo, or redo, will be performed.
+ */
+ private int top;
+
+ /**
+ * The command most recently executed, undone, or redone.
+ */
+ private Command mostRecentCommand;
+
+ /**
+ * The value of {@link #top} when {@link #saveIsDone} is called.
+ */
+ private int saveIndex = -1;
+
+ /**
+ * Creates a new empty instance.
+ */
+ public CompareSideCommandStack() {
+ commandList = newArrayList();
+ top = -1;
+ }
+
+ /**
+ * Record the execution of the given command.
+ *
+ * @param command
+ * the command to record.
+ */
+ public void executed(ICompareCopyCommand command) {
+ // If the command is executable, record it.
+ //
+ if (command != null) {
+ if (command.canExecute()) {
+ // Clear the list past the top.
+ //
+ Iterator<ICompareCopyCommand> commands = commandList.listIterator(top + 1);
+ while (commands.hasNext()) {
+ commands.next();
+ commands.remove();
+ }
+
+ // Record the successfully executed command.
+ //
+ mostRecentCommand = command;
+ commandList.add(command);
+ ++top;
+
+ // This is kind of tricky.
+ // If the saveIndex was in the redo part of the command list which has now been wiped
+ // out,
+ // then we can never reach a point where a save is not necessary, not even if we undo
+ // all the way back to the beginning.
+ //
+ if (saveIndex >= top) {
+ // This forces isSaveNeded to always be true.
+ //
+ saveIndex = IS_SAVE_NEEDED_WILL_BE_TRUE;
+ }
+ }
+ }
+ }
+
+ /**
+ * Record that the top of the command list has been undone.
+ */
+ public void undone() {
+ Command command = commandList.get(top--);
+ mostRecentCommand = command;
+ }
+
+ /**
+ * Record that the top of the command list has been redone.
+ */
+ public void redone() {
+ Command command = commandList.get(++top);
+ mostRecentCommand = command;
+ }
+
+ /**
+ * Disposes all the commands in the stack.
+ */
+ public void flushed() {
+ // Clear the list.
+ //
+ Iterator<ICompareCopyCommand> commands = commandList.listIterator();
+ while (commands.hasNext()) {
+ commands.next();
+ commands.remove();
+ }
+ commandList.clear();
+ top = -1;
+ saveIndex = -1;
+ mostRecentCommand = null;
+ }
+
+ /**
+ * Called after a save has been successfully performed.
+ */
+ public void saveIsDone() {
+ // Remember where we are now.
+ //
+ saveIndex = top;
+ }
+
+ /**
+ * Returns whether the model has changes since {@link #saveIsDone} was call the last.
+ *
+ * @return whether the model has changes since <code>saveIsDone</code> was call the last.
+ */
+ public boolean isSaveNeeded() {
+ boolean ret = false;
+
+ if (saveIndex < -1) {
+ ret = true;
+ }
+
+ if (!ret) {
+ if (top > saveIndex) {
+ for (int i = top; !ret && i > saveIndex; --i) {
+ if (!(commandList.get(i) instanceof AbstractCommand.NonDirtying)) {
+ ret = true;
+ }
+ }
+ } else {
+ for (int i = saveIndex; !ret && i > top; --i) {
+ if (!(commandList.get(i) instanceof AbstractCommand.NonDirtying)) {
+ ret = true;
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ /**
+ * Returns the command that will be undone if {@link #undo} is called.
+ *
+ * @return the command that will be undone if {@link #undo} is called.
+ */
+ public Command getUndoCommand() {
+ final Command undoCommand;
+ if (top == -1 || top == commandList.size()) {
+ undoCommand = null;
+ } else {
+ undoCommand = commandList.get(top);
+ }
+ return undoCommand;
+ }
+
+ /**
+ * Returns the command that will be redone if {@link #redo} is called.
+ *
+ * @return the command that will be redone if {@link #redo} is called.
+ */
+ public Command getRedoCommand() {
+ final Command redoCommand;
+ if (top + 1 >= commandList.size()) {
+ redoCommand = null;
+ } else {
+ redoCommand = commandList.get(top + 1);
+ }
+ return redoCommand;
+ }
+
+ /**
+ * Returns the command most recently executed, undone, or redone.
+ *
+ * @return the command most recently executed, undone, or redone.
+ */
+ public Command getMostRecentCommand() {
+ return mostRecentCommand;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/DualCompareCommandStack.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/DualCompareCommandStack.java
index ea1305922..5994dd3cb 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/DualCompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/DualCompareCommandStack.java
@@ -1,287 +1,287 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command.impl;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-import com.google.common.base.Preconditions;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.compare.command.ICompareCommandStack;
-import org.eclipse.emf.compare.command.ICompareCopyCommand;
-
-/**
- * {@link ICompareCommandStack} implementation that will delegates to two given command stacks; one for each
- * side of the comparison.
- * <p>
- * This implementation is not robust. If an error occurs during execution of a command, the whole state will
- * be corrupted and the undo/redo may have an unknown behavior.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class DualCompareCommandStack implements ICompareCommandStack {
-
- /**
- * This value forces isSaveNeded to always be true.
- */
- private static final int IS_SAVE_NEEDED_WILL_BE_TRUE = -2;
-
- /** The left command stack. */
- private final BasicCommandStack leftCommandStack;
-
- /** The right command stack. */
- private final BasicCommandStack rightCommandStack;
-
- /**
- * The list of command stack; it will record the stack of which command stack has been used to execute the
- * commands.
- */
- private final List<BasicCommandStack> commandStackStack;
-
- /**
- * The current position within the list from which the next execute, undo, or redo, will be performed.
- */
- private int top;
-
- /**
- * The command stack on which a command has been most recently executed, undone, or redone.
- */
- private BasicCommandStack mostRecentCommandStack;
-
- /**
- * The value of {@link #top} when {@link #saveIsDone} is called.
- */
- private int saveIndex = -1;
-
- /**
- * Creates an instance that delegates to two given {@link BasicCommandStack}.
- *
- * @param leftCommandStack
- * the left command stack.
- * @param rightCommandStack
- * the right command stack.
- */
- public DualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack) {
- this.leftCommandStack = Preconditions.checkNotNull(leftCommandStack);
- this.rightCommandStack = Preconditions.checkNotNull(rightCommandStack);
- this.commandStackStack = newArrayList();
- this.top = -1;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#execute(org.eclipse.emf.common.command.Command)
- */
- public void execute(Command command) {
- // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
- // side lists.
- if (command instanceof ICompareCopyCommand) {
- final BasicCommandStack commandStack;
- final ICompareCopyCommand compareCommand = (ICompareCopyCommand)command;
- if (compareCommand.isLeftToRight()) {
- commandStack = rightCommandStack;
- } else {
- commandStack = leftCommandStack;
- }
-
- // Clear the list past the top.
- //
- Iterator<BasicCommandStack> commandStacks = commandStackStack.listIterator(top + 1);
- while (commandStacks.hasNext()) {
- commandStacks.next();
- commandStacks.remove();
- }
-
- // Record the successfully executed command.
- //
- mostRecentCommandStack = commandStack;
- commandStackStack.add(commandStack);
- ++top;
-
- // This is kind of tricky.
- // If the saveIndex was in the redo part of the command list which has now been wiped out,
- // then we can never reach a point where a save is not necessary, not even if we undo all the
- // way back to the beginning.
- //
- if (saveIndex >= top) {
- saveIndex = IS_SAVE_NEEDED_WILL_BE_TRUE;
- }
-
- commandStack.execute(compareCommand);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#canUndo()
- */
- public boolean canUndo() {
- return top != -1 && commandStackStack.get(top).canUndo();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#undo()
- */
- public void undo() {
- if (canUndo()) {
- BasicCommandStack commandStack = commandStackStack.get(top--);
- commandStack.undo();
- mostRecentCommandStack = commandStack;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#canRedo()
- */
- public boolean canRedo() {
- return top < commandStackStack.size() - 1;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getUndoCommand()
- */
- public Command getUndoCommand() {
- final Command undoCommand;
- if (top == -1 || top == commandStackStack.size()) {
- undoCommand = null;
- } else {
- undoCommand = commandStackStack.get(top).getUndoCommand();
- }
- return undoCommand;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getRedoCommand()
- */
- public Command getRedoCommand() {
- final Command redoCommand;
- if (top + 1 >= commandStackStack.size()) {
- redoCommand = null;
- } else {
- redoCommand = commandStackStack.get(top + 1).getRedoCommand();
- }
- return redoCommand;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#getMostRecentCommand()
- */
- public Command getMostRecentCommand() {
- if (mostRecentCommandStack != null) {
- return mostRecentCommandStack.getMostRecentCommand();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#redo()
- */
- public void redo() {
- if (canRedo()) {
- BasicCommandStack commandStack = commandStackStack.get(++top);
- commandStack.redo();
- mostRecentCommandStack = commandStack;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#flush()
- */
- public void flush() {
- Iterator<BasicCommandStack> commands = commandStackStack.listIterator();
- while (commands.hasNext()) {
- commands.next();
- commands.remove();
- }
- commandStackStack.clear();
- top = -1;
- saveIndex = -1;
- mostRecentCommandStack = null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
- */
- public void addCommandStackListener(CommandStackListener listener) {
- leftCommandStack.addCommandStackListener(listener);
- rightCommandStack.addCommandStackListener(listener);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.CommandStack#removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
- */
- public void removeCommandStackListener(CommandStackListener listener) {
- leftCommandStack.removeCommandStackListener(listener);
- rightCommandStack.removeCommandStackListener(listener);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#isLeftSaveNeeded()
- */
- public boolean isLeftSaveNeeded() {
- return leftCommandStack.isSaveNeeded();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#isRightSaveNeeded()
- */
- public boolean isRightSaveNeeded() {
- return rightCommandStack.isSaveNeeded();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#leftSaveIsDone()
- */
- public void leftSaveIsDone() {
- leftCommandStack.saveIsDone();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCommandStack#rightSaveIsDone()
- */
- public void rightSaveIsDone() {
- rightCommandStack.saveIsDone();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command.impl;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.compare.command.ICompareCommandStack;
+import org.eclipse.emf.compare.command.ICompareCopyCommand;
+
+/**
+ * {@link ICompareCommandStack} implementation that will delegates to two given command stacks; one for each
+ * side of the comparison.
+ * <p>
+ * This implementation is not robust. If an error occurs during execution of a command, the whole state will
+ * be corrupted and the undo/redo may have an unknown behavior.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class DualCompareCommandStack implements ICompareCommandStack {
+
+ /**
+ * This value forces isSaveNeded to always be true.
+ */
+ private static final int IS_SAVE_NEEDED_WILL_BE_TRUE = -2;
+
+ /** The left command stack. */
+ private final BasicCommandStack leftCommandStack;
+
+ /** The right command stack. */
+ private final BasicCommandStack rightCommandStack;
+
+ /**
+ * The list of command stack; it will record the stack of which command stack has been used to execute the
+ * commands.
+ */
+ private final List<BasicCommandStack> commandStackStack;
+
+ /**
+ * The current position within the list from which the next execute, undo, or redo, will be performed.
+ */
+ private int top;
+
+ /**
+ * The command stack on which a command has been most recently executed, undone, or redone.
+ */
+ private BasicCommandStack mostRecentCommandStack;
+
+ /**
+ * The value of {@link #top} when {@link #saveIsDone} is called.
+ */
+ private int saveIndex = -1;
+
+ /**
+ * Creates an instance that delegates to two given {@link BasicCommandStack}.
+ *
+ * @param leftCommandStack
+ * the left command stack.
+ * @param rightCommandStack
+ * the right command stack.
+ */
+ public DualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack) {
+ this.leftCommandStack = Preconditions.checkNotNull(leftCommandStack);
+ this.rightCommandStack = Preconditions.checkNotNull(rightCommandStack);
+ this.commandStackStack = newArrayList();
+ this.top = -1;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#execute(org.eclipse.emf.common.command.Command)
+ */
+ public void execute(Command command) {
+ // should do that AFTER delegate.execute, but in this this case, notifiers will not see change in
+ // side lists.
+ if (command instanceof ICompareCopyCommand) {
+ final BasicCommandStack commandStack;
+ final ICompareCopyCommand compareCommand = (ICompareCopyCommand)command;
+ if (compareCommand.isLeftToRight()) {
+ commandStack = rightCommandStack;
+ } else {
+ commandStack = leftCommandStack;
+ }
+
+ // Clear the list past the top.
+ //
+ Iterator<BasicCommandStack> commandStacks = commandStackStack.listIterator(top + 1);
+ while (commandStacks.hasNext()) {
+ commandStacks.next();
+ commandStacks.remove();
+ }
+
+ // Record the successfully executed command.
+ //
+ mostRecentCommandStack = commandStack;
+ commandStackStack.add(commandStack);
+ ++top;
+
+ // This is kind of tricky.
+ // If the saveIndex was in the redo part of the command list which has now been wiped out,
+ // then we can never reach a point where a save is not necessary, not even if we undo all the
+ // way back to the beginning.
+ //
+ if (saveIndex >= top) {
+ saveIndex = IS_SAVE_NEEDED_WILL_BE_TRUE;
+ }
+
+ commandStack.execute(compareCommand);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#canUndo()
+ */
+ public boolean canUndo() {
+ return top != -1 && commandStackStack.get(top).canUndo();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#undo()
+ */
+ public void undo() {
+ if (canUndo()) {
+ BasicCommandStack commandStack = commandStackStack.get(top--);
+ commandStack.undo();
+ mostRecentCommandStack = commandStack;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#canRedo()
+ */
+ public boolean canRedo() {
+ return top < commandStackStack.size() - 1;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getUndoCommand()
+ */
+ public Command getUndoCommand() {
+ final Command undoCommand;
+ if (top == -1 || top == commandStackStack.size()) {
+ undoCommand = null;
+ } else {
+ undoCommand = commandStackStack.get(top).getUndoCommand();
+ }
+ return undoCommand;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getRedoCommand()
+ */
+ public Command getRedoCommand() {
+ final Command redoCommand;
+ if (top + 1 >= commandStackStack.size()) {
+ redoCommand = null;
+ } else {
+ redoCommand = commandStackStack.get(top + 1).getRedoCommand();
+ }
+ return redoCommand;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#getMostRecentCommand()
+ */
+ public Command getMostRecentCommand() {
+ if (mostRecentCommandStack != null) {
+ return mostRecentCommandStack.getMostRecentCommand();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#redo()
+ */
+ public void redo() {
+ if (canRedo()) {
+ BasicCommandStack commandStack = commandStackStack.get(++top);
+ commandStack.redo();
+ mostRecentCommandStack = commandStack;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#flush()
+ */
+ public void flush() {
+ Iterator<BasicCommandStack> commands = commandStackStack.listIterator();
+ while (commands.hasNext()) {
+ commands.next();
+ commands.remove();
+ }
+ commandStackStack.clear();
+ top = -1;
+ saveIndex = -1;
+ mostRecentCommandStack = null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
+ */
+ public void addCommandStackListener(CommandStackListener listener) {
+ leftCommandStack.addCommandStackListener(listener);
+ rightCommandStack.addCommandStackListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.CommandStack#removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
+ */
+ public void removeCommandStackListener(CommandStackListener listener) {
+ leftCommandStack.removeCommandStackListener(listener);
+ rightCommandStack.removeCommandStackListener(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#isLeftSaveNeeded()
+ */
+ public boolean isLeftSaveNeeded() {
+ return leftCommandStack.isSaveNeeded();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#isRightSaveNeeded()
+ */
+ public boolean isRightSaveNeeded() {
+ return rightCommandStack.isSaveNeeded();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#leftSaveIsDone()
+ */
+ public void leftSaveIsDone() {
+ leftCommandStack.saveIsDone();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCommandStack#rightSaveIsDone()
+ */
+ public void rightSaveIsDone() {
+ rightCommandStack.saveIsDone();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/MergeCommand.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/MergeCommand.java
index cfed3f80e..1bfa27aff 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/MergeCommand.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/command/impl/MergeCommand.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.command.impl;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.domain.IMergeRunnable;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.ecore.change.util.ChangeRecorder;
-
-/**
- * A merge command that delegates it {@link #doExecute()} to the
- * {@link IMergeRunnable#merge(List, boolean, IMerger.Registry)} method.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @since 4.0
- */
-public class MergeCommand extends AbstractCopyCommand {
-
- /** The merge runnable to delegate to. */
- private final IMergeRunnable runnable;
-
- /**
- * Creates a new instance.
- *
- * @param changeRecorder
- * The change recorder associated to this command.
- * @param notifiers
- * The collection of notifiers that will be notified of this command's execution.
- * @param differences
- * The list of differences that this command should merge.
- * @param leftToRight
- * The direction in which {@code differences} should be merged.
- * @param mergerRegistry
- * The registry of mergers.
- * @param runnable
- * The merge runnable to delegate to.
- */
- public MergeCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers,
- List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry,
- IMergeRunnable runnable) {
- super(changeRecorder, notifiers, differences, leftToRight, mergerRegistry);
- this.runnable = runnable;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.ChangeCommand#doExecute()
- */
- @Override
- protected void doExecute() {
- runnable.merge(differences, leftToRight, mergerRegistry);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.command.impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.domain.IMergeRunnable;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.ecore.change.util.ChangeRecorder;
+
+/**
+ * A merge command that delegates it {@link #doExecute()} to the
+ * {@link IMergeRunnable#merge(List, boolean, IMerger.Registry)} method.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @since 4.0
+ */
+public class MergeCommand extends AbstractCopyCommand {
+
+ /** The merge runnable to delegate to. */
+ private final IMergeRunnable runnable;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param changeRecorder
+ * The change recorder associated to this command.
+ * @param notifiers
+ * The collection of notifiers that will be notified of this command's execution.
+ * @param differences
+ * The list of differences that this command should merge.
+ * @param leftToRight
+ * The direction in which {@code differences} should be merged.
+ * @param mergerRegistry
+ * The registry of mergers.
+ * @param runnable
+ * The merge runnable to delegate to.
+ */
+ public MergeCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers,
+ List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry,
+ IMergeRunnable runnable) {
+ super(changeRecorder, notifiers, differences, leftToRight, mergerRegistry);
+ this.runnable = runnable;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.ChangeCommand#doExecute()
+ */
+ @Override
+ protected void doExecute() {
+ runnable.merge(differences, leftToRight, mergerRegistry);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/domain/IMergeRunnable.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/domain/IMergeRunnable.java
index b09d08c2f..dbc10c7ba 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/domain/IMergeRunnable.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/domain/IMergeRunnable.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.domain;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.merge.IMerger.Registry;
-
-/**
- * Interface for executing merge commands from the {@link ICompareEditingDomain}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @since 4.0
- */
-public interface IMergeRunnable {
-
- /**
- * Execute the merge operation.
- *
- * @param differences
- * the differences to merge.
- * @param leftToRight
- * whether the merge has to be merge from left to right or right to left.
- * @param mergerRegistry
- * the merger registry to query to get the appropriate mergers for each difference to be
- * merged.
- */
- void merge(List<? extends Diff> differences, boolean leftToRight, Registry mergerRegistry);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.domain;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.merge.IMerger.Registry;
+
+/**
+ * Interface for executing merge commands from the {@link ICompareEditingDomain}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @since 4.0
+ */
+public interface IMergeRunnable {
+
+ /**
+ * Execute the merge operation.
+ *
+ * @param differences
+ * the differences to merge.
+ * @param leftToRight
+ * whether the merge has to be merge from left to right or right to left.
+ * @param mergerRegistry
+ * the merger registry to query to get the appropriate mergers for each difference to be
+ * merged.
+ */
+ void merge(List<? extends Diff> differences, boolean leftToRight, Registry mergerRegistry);
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedAdapterFactoryItemDelegator.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedAdapterFactoryItemDelegator.java
index 7f463544b..d828475fb 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedAdapterFactoryItemDelegator.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedAdapterFactoryItemDelegator.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider;
-
-import static com.google.common.collect.Iterables.isEmpty;
-
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
-import org.eclipse.emf.compare.provider.utils.IStyledString;
-import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
-import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
-
-/**
- * An item provider adapter factory delegator that supports our custom item provider interfaces:
- * {@link IItemStyledLabelProvider} and {@link IItemDescriptionProvider}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @since 4.0
- */
-public class ExtendedAdapterFactoryItemDelegator extends AdapterFactoryItemDelegator implements IItemStyledLabelProvider, IItemDescriptionProvider {
-
- /**
- * Creates a new instance that will use the given adapter factory to respond to its implemented protocol.
- *
- * @param adapterFactory
- * the adapter factory use to adapt.
- */
- public ExtendedAdapterFactoryItemDelegator(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.provider.IItemDescriptionProvider#getDescription(java.lang.Object)
- */
- public String getDescription(Object object) {
- return getText(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.provider.IItemStyledLabelProvider#getStyledText(java.lang.Object)
- */
- public IComposedStyledString getStyledText(Object object) {
- final IComposedStyledString result;
- if (object instanceof EList<?>) {
- result = new ComposedStyledString();
- for (Object child : (List<?>)object) {
- if (!isEmpty(result)) {
- result.append(", "); //$NON-NLS-1$
- }
- IComposedStyledString styledText = getStyledText(child);
- for (IStyledString styledString : styledText) {
- result.append(styledString.getString(), styledString.getStyle());
- }
- }
- } else {
- IItemStyledLabelProvider itemStyledLabelProvider = (IItemStyledLabelProvider)adapterFactory
- .adapt(object, IItemStyledLabelProvider.class);
-
- if (itemStyledLabelProvider != null) {
- result = itemStyledLabelProvider.getStyledText(object);
- } else if (object == null) {
- result = new ComposedStyledString();
- } else {
- result = new ComposedStyledString(getText(object));
- }
- }
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider;
+
+import static com.google.common.collect.Iterables.isEmpty;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+
+/**
+ * An item provider adapter factory delegator that supports our custom item provider interfaces:
+ * {@link IItemStyledLabelProvider} and {@link IItemDescriptionProvider}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @since 4.0
+ */
+public class ExtendedAdapterFactoryItemDelegator extends AdapterFactoryItemDelegator implements IItemStyledLabelProvider, IItemDescriptionProvider {
+
+ /**
+ * Creates a new instance that will use the given adapter factory to respond to its implemented protocol.
+ *
+ * @param adapterFactory
+ * the adapter factory use to adapt.
+ */
+ public ExtendedAdapterFactoryItemDelegator(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.IItemDescriptionProvider#getDescription(java.lang.Object)
+ */
+ public String getDescription(Object object) {
+ return getText(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.IItemStyledLabelProvider#getStyledText(java.lang.Object)
+ */
+ public IComposedStyledString getStyledText(Object object) {
+ final IComposedStyledString result;
+ if (object instanceof EList<?>) {
+ result = new ComposedStyledString();
+ for (Object child : (List<?>)object) {
+ if (!isEmpty(result)) {
+ result.append(", "); //$NON-NLS-1$
+ }
+ IComposedStyledString styledText = getStyledText(child);
+ for (IStyledString styledString : styledText) {
+ result.append(styledString.getString(), styledString.getStyle());
+ }
+ }
+ } else {
+ IItemStyledLabelProvider itemStyledLabelProvider = (IItemStyledLabelProvider)adapterFactory
+ .adapt(object, IItemStyledLabelProvider.class);
+
+ if (itemStyledLabelProvider != null) {
+ result = itemStyledLabelProvider.getStyledText(object);
+ } else if (object == null) {
+ result = new ComposedStyledString();
+ } else {
+ result = new ComposedStyledString(getText(object));
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedItemProviderDecorator.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedItemProviderDecorator.java
index 856db7d7d..55eb3c040 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedItemProviderDecorator.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ExtendedItemProviderDecorator.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider;
-
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.compare.provider.spec.OverlayImageProvider;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ItemProviderDecorator;
-
-/**
- * And extended {@link ItemProviderDecorator} that provides an {@link OverlayImageProvider} and and
- * {@link ExtendedAdapterFactoryItemDelegator}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @since 4.0
- */
-public class ExtendedItemProviderDecorator extends ItemProviderDecorator implements Adapter.Internal {
-
- /** The item delegator to reuse root adapter factory (if any). */
- private final ExtendedAdapterFactoryItemDelegator itemDelegator;
-
- /** The image provider used with this item provider. */
- private final OverlayImageProvider overlayProvider;
-
- /** The list of target notifier we are installed on. */
- private final List<Notifier> targets;
-
- /**
- * An instance is created from an adapter factory. The factory is used as a key so that we always know
- * which factory created this adapter.
- *
- * @param adapterFactory
- * the adapter factory to use to adapt.
- */
- public ExtendedItemProviderDecorator(ComposeableAdapterFactory adapterFactory) {
- super(adapterFactory);
- itemDelegator = new ExtendedAdapterFactoryItemDelegator(adapterFactory.getRootAdapterFactory());
- overlayProvider = new OverlayImageProvider(EMFCompareEditPlugin.INSTANCE.getPluginResourceLocator());
- targets = new BasicEList.FastCompare<Notifier>();
- }
-
- /**
- * Returns the overlay provider.
- *
- * @return the overlayProvider
- */
- protected OverlayImageProvider getOverlayProvider() {
- return overlayProvider;
- }
-
- /**
- * Returns the itemDelegator.
- *
- * @return the itemDelegator
- */
- protected ExtendedAdapterFactoryItemDelegator getItemDelegator() {
- return itemDelegator;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#getTarget()
- */
- public Notifier getTarget() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
- */
- public void setTarget(Notifier newTarget) {
- targets.add(newTarget);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter.Internal#unsetTarget(org.eclipse.emf.common.notify.Notifier)
- */
- public void unsetTarget(Notifier oldTarget) {
- targets.remove(oldTarget);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.ItemProviderDecorator#dispose()
- */
- @Override
- public void dispose() {
- for (Notifier otherTarget : targets) {
- otherTarget.eAdapters().remove(this);
- }
- targets.clear();
-
- super.dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.compare.provider.spec.OverlayImageProvider;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemProviderDecorator;
+
+/**
+ * And extended {@link ItemProviderDecorator} that provides an {@link OverlayImageProvider} and and
+ * {@link ExtendedAdapterFactoryItemDelegator}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @since 4.0
+ */
+public class ExtendedItemProviderDecorator extends ItemProviderDecorator implements Adapter.Internal {
+
+ /** The item delegator to reuse root adapter factory (if any). */
+ private final ExtendedAdapterFactoryItemDelegator itemDelegator;
+
+ /** The image provider used with this item provider. */
+ private final OverlayImageProvider overlayProvider;
+
+ /** The list of target notifier we are installed on. */
+ private final List<Notifier> targets;
+
+ /**
+ * An instance is created from an adapter factory. The factory is used as a key so that we always know
+ * which factory created this adapter.
+ *
+ * @param adapterFactory
+ * the adapter factory to use to adapt.
+ */
+ public ExtendedItemProviderDecorator(ComposeableAdapterFactory adapterFactory) {
+ super(adapterFactory);
+ itemDelegator = new ExtendedAdapterFactoryItemDelegator(adapterFactory.getRootAdapterFactory());
+ overlayProvider = new OverlayImageProvider(EMFCompareEditPlugin.INSTANCE.getPluginResourceLocator());
+ targets = new BasicEList.FastCompare<Notifier>();
+ }
+
+ /**
+ * Returns the overlay provider.
+ *
+ * @return the overlayProvider
+ */
+ protected OverlayImageProvider getOverlayProvider() {
+ return overlayProvider;
+ }
+
+ /**
+ * Returns the itemDelegator.
+ *
+ * @return the itemDelegator
+ */
+ protected ExtendedAdapterFactoryItemDelegator getItemDelegator() {
+ return itemDelegator;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#getTarget()
+ */
+ public Notifier getTarget() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void setTarget(Notifier newTarget) {
+ targets.add(newTarget);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter.Internal#unsetTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void unsetTarget(Notifier oldTarget) {
+ targets.remove(oldTarget);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderDecorator#dispose()
+ */
+ @Override
+ public void dispose() {
+ for (Notifier otherTarget : targets) {
+ otherTarget.eAdapters().remove(this);
+ }
+ targets.clear();
+
+ super.dispose();
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ForwardingItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ForwardingItemProvider.java
index 33d1c9841..d950dd463 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ForwardingItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/ForwardingItemProvider.java
@@ -1,411 +1,411 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.command.CommandParameter;
-import org.eclipse.emf.edit.command.CreateChildCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IDisposable;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemColorProvider;
-import org.eclipse.emf.edit.provider.IItemFontProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-
-/**
- * A simple implementation that forward every call to a delegating instance.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- * @deprecated Use {@link org.eclipse.emf.edit.provider.IItemProviderDecorator} and
- * {@link org.eclipse.emf.edit.provider.DecoratorAdapterFactory} instead.
- */
-@Deprecated
-public class ForwardingItemProvider implements Adapter.Internal, IChangeNotifier, IDisposable, CreateChildCommand.Helper, ResourceLocator, IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
-
- /** The instance to delegate to. */
- private final ItemProviderAdapter fDelegate;
-
- /**
- * Creates a new instance that delegate to the given object.
- *
- * @param delegate
- * the object to delegate to.
- */
- public ForwardingItemProvider(ItemProviderAdapter delegate) {
- this.fDelegate = delegate;
- }
-
- /**
- * Returns the object to delegate to.
- *
- * @return the object to delegate to.
- */
- protected ItemProviderAdapter delegate() {
- return fDelegate;
- }
-
- /**
- * This provides access to the factory.
- *
- * @return the adapter factory.
- */
- public AdapterFactory getAdapterFactory() {
- return delegate().getAdapterFactory();
- }
-
- /**
- * This convenience method returns the first adapter factory that doesn't have a parent, i.e., the root.
- *
- * @return the first adapter factory that doesn't have a parent, i.e., the root.
- */
- protected AdapterFactory getRootAdapterFactory() {
- if (delegate().getAdapterFactory() instanceof ComposeableAdapterFactory) {
- return ((ComposeableAdapterFactory)delegate().getAdapterFactory()).getRootAdapterFactory();
- }
-
- return delegate().getAdapterFactory();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- public void notifyChanged(Notification notification) {
- delegate().notifyChanged(notification);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#getTarget()
- */
- public Notifier getTarget() {
- return delegate().getTarget();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
- */
- public void setTarget(Notifier newTarget) {
- delegate().setTarget(newTarget);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
- */
- public boolean isAdapterForType(Object type) {
- return delegate().isAdapterForType(type);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemPropertySource#getPropertyDescriptors(java.lang.Object)
- */
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- return delegate().getPropertyDescriptors(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemPropertySource#getPropertyDescriptor(java.lang.Object,
- * java.lang.Object)
- */
- public IItemPropertyDescriptor getPropertyDescriptor(Object object, Object propertyID) {
- return delegate().getPropertyDescriptor(object, propertyID);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemPropertySource#getEditableValue(java.lang.Object)
- */
- public Object getEditableValue(Object object) {
- return delegate().getEditableValue(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getText(java.lang.Object)
- */
- public String getText(Object object) {
- return delegate().getText(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getImage(java.lang.Object)
- */
- public Object getImage(Object object) {
- return delegate().getImage(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object object) {
- return delegate().hasChildren(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IStructuredItemContentProvider#getElements(java.lang.Object)
- */
- public Collection<?> getElements(Object object) {
- return delegate().getElements(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getChildren(java.lang.Object)
- */
- public Collection<?> getChildren(Object object) {
- return delegate().getChildren(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object object) {
- return delegate().getParent(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getNewChildDescriptors(java.lang.Object,
- * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Object)
- */
- public Collection<?> getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling) {
- return delegate().getNewChildDescriptors(object, editingDomain, sibling);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object,
- * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class,
- * org.eclipse.emf.edit.command.CommandParameter)
- */
- public Command createCommand(Object object, EditingDomain editingDomain,
- Class<? extends Command> commandClass, CommandParameter commandParameter) {
- return delegate().createCommand(object, editingDomain, commandClass, commandParameter);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getBaseURL()
- */
- public URL getBaseURL() {
- return delegate().getBaseURL();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getImage(java.lang.String)
- */
- public Object getImage(String key) {
- return delegate().getImage(key);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String)
- */
- public String getString(String key) {
- return delegate().getString(key);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, boolean)
- */
- public String getString(String key, boolean translate) {
- return delegate().getString(key, translate);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, java.lang.Object[])
- */
- public String getString(String key, Object[] substitutions) {
- return delegate().getString(key, substitutions);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, java.lang.Object[],
- * boolean)
- */
- public String getString(String key, Object[] substitutions, boolean translate) {
- return delegate().getString(key, substitutions, translate);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildResult(java.lang.Object)
- */
- public Collection<?> getCreateChildResult(Object child) {
- return delegate().getCreateChildResult(child);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildText(java.lang.Object,
- * java.lang.Object, java.lang.Object, java.util.Collection)
- */
- public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
- return delegate().getCreateChildText(owner, feature, child, selection);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildDescription(java.lang.Object,
- * java.lang.Object, java.lang.Object, java.util.Collection)
- */
- public String getCreateChildDescription(Object owner, Object feature, Object child,
- Collection<?> selection) {
- return delegate().getCreateChildDescription(owner, feature, child, selection);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildToolTipText(java.lang.Object,
- * java.lang.Object, java.lang.Object, java.util.Collection)
- */
- public String getCreateChildToolTipText(Object owner, Object feature, Object child,
- Collection<?> selection) {
- return delegate().getCreateChildToolTipText(owner, feature, child, selection);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildImage(java.lang.Object,
- * java.lang.Object, java.lang.Object, java.util.Collection)
- */
- public Object getCreateChildImage(Object owner, Object feature, Object child, Collection<?> selection) {
- return delegate().getCreateChildImage(owner, feature, child, selection);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IDisposable#dispose()
- */
- public void dispose() {
- delegate().dispose();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IChangeNotifier#fireNotifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- public void fireNotifyChanged(Notification notification) {
- delegate().fireNotifyChanged(notification);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IChangeNotifier#addListener(org.eclipse.emf.edit.provider.INotifyChangedListener)
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- delegate().addListener(notifyChangedListener);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IChangeNotifier#removeListener(org.eclipse.emf.edit.provider.INotifyChangedListener)
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- delegate().removeListener(notifyChangedListener);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.notify.Adapter.Internal#unsetTarget(org.eclipse.emf.common.notify.Notifier)
- */
- public void unsetTarget(Notifier oldTarget) {
- delegate().unsetTarget(oldTarget);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemFontProvider#getFont(java.lang.Object)
- */
- public Object getFont(Object object) {
- return delegate().getFont(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemColorProvider#getForeground(java.lang.Object)
- */
- public Object getForeground(Object object) {
- return delegate().getForeground(object);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.edit.provider.IItemColorProvider#getBackground(java.lang.Object)
- */
- public Object getBackground(Object object) {
- return delegate().getBackground(object);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.CreateChildCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemColorProvider;
+import org.eclipse.emf.edit.provider.IItemFontProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+
+/**
+ * A simple implementation that forward every call to a delegating instance.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ * @deprecated Use {@link org.eclipse.emf.edit.provider.IItemProviderDecorator} and
+ * {@link org.eclipse.emf.edit.provider.DecoratorAdapterFactory} instead.
+ */
+@Deprecated
+public class ForwardingItemProvider implements Adapter.Internal, IChangeNotifier, IDisposable, CreateChildCommand.Helper, ResourceLocator, IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider, IItemFontProvider {
+
+ /** The instance to delegate to. */
+ private final ItemProviderAdapter fDelegate;
+
+ /**
+ * Creates a new instance that delegate to the given object.
+ *
+ * @param delegate
+ * the object to delegate to.
+ */
+ public ForwardingItemProvider(ItemProviderAdapter delegate) {
+ this.fDelegate = delegate;
+ }
+
+ /**
+ * Returns the object to delegate to.
+ *
+ * @return the object to delegate to.
+ */
+ protected ItemProviderAdapter delegate() {
+ return fDelegate;
+ }
+
+ /**
+ * This provides access to the factory.
+ *
+ * @return the adapter factory.
+ */
+ public AdapterFactory getAdapterFactory() {
+ return delegate().getAdapterFactory();
+ }
+
+ /**
+ * This convenience method returns the first adapter factory that doesn't have a parent, i.e., the root.
+ *
+ * @return the first adapter factory that doesn't have a parent, i.e., the root.
+ */
+ protected AdapterFactory getRootAdapterFactory() {
+ if (delegate().getAdapterFactory() instanceof ComposeableAdapterFactory) {
+ return ((ComposeableAdapterFactory)delegate().getAdapterFactory()).getRootAdapterFactory();
+ }
+
+ return delegate().getAdapterFactory();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void notifyChanged(Notification notification) {
+ delegate().notifyChanged(notification);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#getTarget()
+ */
+ public Notifier getTarget() {
+ return delegate().getTarget();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void setTarget(Notifier newTarget) {
+ delegate().setTarget(newTarget);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ public boolean isAdapterForType(Object type) {
+ return delegate().isAdapterForType(type);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemPropertySource#getPropertyDescriptors(java.lang.Object)
+ */
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ return delegate().getPropertyDescriptors(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemPropertySource#getPropertyDescriptor(java.lang.Object,
+ * java.lang.Object)
+ */
+ public IItemPropertyDescriptor getPropertyDescriptor(Object object, Object propertyID) {
+ return delegate().getPropertyDescriptor(object, propertyID);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemPropertySource#getEditableValue(java.lang.Object)
+ */
+ public Object getEditableValue(Object object) {
+ return delegate().getEditableValue(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object object) {
+ return delegate().getText(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getImage(java.lang.Object)
+ */
+ public Object getImage(Object object) {
+ return delegate().getImage(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ public boolean hasChildren(Object object) {
+ return delegate().hasChildren(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IStructuredItemContentProvider#getElements(java.lang.Object)
+ */
+ public Collection<?> getElements(Object object) {
+ return delegate().getElements(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getChildren(java.lang.Object)
+ */
+ public Collection<?> getChildren(Object object) {
+ return delegate().getChildren(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getParent(java.lang.Object)
+ */
+ public Object getParent(Object object) {
+ return delegate().getParent(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#getNewChildDescriptors(java.lang.Object,
+ * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Object)
+ */
+ public Collection<?> getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling) {
+ return delegate().getNewChildDescriptors(object, editingDomain, sibling);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object,
+ * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class,
+ * org.eclipse.emf.edit.command.CommandParameter)
+ */
+ public Command createCommand(Object object, EditingDomain editingDomain,
+ Class<? extends Command> commandClass, CommandParameter commandParameter) {
+ return delegate().createCommand(object, editingDomain, commandClass, commandParameter);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getBaseURL()
+ */
+ public URL getBaseURL() {
+ return delegate().getBaseURL();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getImage(java.lang.String)
+ */
+ public Object getImage(String key) {
+ return delegate().getImage(key);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String)
+ */
+ public String getString(String key) {
+ return delegate().getString(key);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, boolean)
+ */
+ public String getString(String key, boolean translate) {
+ return delegate().getString(key, translate);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, java.lang.Object[])
+ */
+ public String getString(String key, Object[] substitutions) {
+ return delegate().getString(key, substitutions);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.util.ResourceLocator#getString(java.lang.String, java.lang.Object[],
+ * boolean)
+ */
+ public String getString(String key, Object[] substitutions, boolean translate) {
+ return delegate().getString(key, substitutions, translate);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildResult(java.lang.Object)
+ */
+ public Collection<?> getCreateChildResult(Object child) {
+ return delegate().getCreateChildResult(child);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildText(java.lang.Object,
+ * java.lang.Object, java.lang.Object, java.util.Collection)
+ */
+ public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
+ return delegate().getCreateChildText(owner, feature, child, selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildDescription(java.lang.Object,
+ * java.lang.Object, java.lang.Object, java.util.Collection)
+ */
+ public String getCreateChildDescription(Object owner, Object feature, Object child,
+ Collection<?> selection) {
+ return delegate().getCreateChildDescription(owner, feature, child, selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildToolTipText(java.lang.Object,
+ * java.lang.Object, java.lang.Object, java.util.Collection)
+ */
+ public String getCreateChildToolTipText(Object owner, Object feature, Object child,
+ Collection<?> selection) {
+ return delegate().getCreateChildToolTipText(owner, feature, child, selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildImage(java.lang.Object,
+ * java.lang.Object, java.lang.Object, java.util.Collection)
+ */
+ public Object getCreateChildImage(Object owner, Object feature, Object child, Collection<?> selection) {
+ return delegate().getCreateChildImage(owner, feature, child, selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IDisposable#dispose()
+ */
+ public void dispose() {
+ delegate().dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IChangeNotifier#fireNotifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void fireNotifyChanged(Notification notification) {
+ delegate().fireNotifyChanged(notification);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IChangeNotifier#addListener(org.eclipse.emf.edit.provider.INotifyChangedListener)
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ delegate().addListener(notifyChangedListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IChangeNotifier#removeListener(org.eclipse.emf.edit.provider.INotifyChangedListener)
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ delegate().removeListener(notifyChangedListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.Adapter.Internal#unsetTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void unsetTarget(Notifier oldTarget) {
+ delegate().unsetTarget(oldTarget);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemFontProvider#getFont(java.lang.Object)
+ */
+ public Object getFont(Object object) {
+ return delegate().getFont(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemColorProvider#getForeground(java.lang.Object)
+ */
+ public Object getForeground(Object object) {
+ return delegate().getForeground(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.provider.IItemColorProvider#getBackground(java.lang.Object)
+ */
+ public Object getBackground(Object object) {
+ return delegate().getBackground(object);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
index f45d086ee..b08f9b7bc 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider.spec;
-
-/**
- * Utility class for {@link String}s objects.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public final class Strings {
-
- /**
- * Private constructor to avoid instantiation.
- */
- private Strings() {
- }
-
- /**
- * Shorten the given {@code original} string and append the given {@code suffix} if it is longest than the
- * defined {@code max} length minus the length of the {@code suffix}.
- * <p>
- * The returned String length will always be in {@code Math.min(original.length, max)}.
- *
- * @param original
- * the original string to elide if necessary.
- * @param max
- * the maximum length of the returned string.
- * @param suffix
- * the suffix to append in case the original String is too long.
- * @return the elided string or the original string.
- */
- public static String elide(String original, int max, String suffix) {
- if (original.length() > max) {
- String elided = original.substring(0, max - suffix.length());
- return elided + suffix;
- }
- return original;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider.spec;
+
+/**
+ * Utility class for {@link String}s objects.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public final class Strings {
+
+ /**
+ * Private constructor to avoid instantiation.
+ */
+ private Strings() {
+ }
+
+ /**
+ * Shorten the given {@code original} string and append the given {@code suffix} if it is longest than the
+ * defined {@code max} length minus the length of the {@code suffix}.
+ * <p>
+ * The returned String length will always be in {@code Math.min(original.length, max)}.
+ *
+ * @param original
+ * the original string to elide if necessary.
+ * @param max
+ * the maximum length of the returned string.
+ * @param suffix
+ * the suffix to append in case the original String is too long.
+ * @return the elided string or the original string.
+ */
+ public static String elide(String original, int max, String suffix) {
+ if (original.length() > max) {
+ String elided = original.substring(0, max - suffix.length());
+ return elided + suffix;
+ }
+ return original;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/ComposedStyledString.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/ComposedStyledString.java
index 3fd33e513..da1cb2614 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/ComposedStyledString.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/ComposedStyledString.java
@@ -1,158 +1,158 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider.utils;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
-import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
-
-/**
- * Composed styled string implementation backed by an {@link java.util.ArrayList}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class ComposedStyledString implements IComposedStyledString {
-
- /** the backing list. */
- private final List<IStyledString> content;
-
- /** Creates a new empty instance. */
- public ComposedStyledString() {
- content = newArrayList();
- }
-
- /**
- * Creates a new instance with the given text without style.
- *
- * @param text
- * the text.
- */
- public ComposedStyledString(String text) {
- this(text, Style.NO_STYLE);
- }
-
- /**
- * Creates a new instance with the given text and the given style.
- *
- * @param text
- * the text.
- * @param style
- * the style of the text.
- */
- public ComposedStyledString(String text, Style style) {
- this();
- append(text, style);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString#getString()
- */
- public String getString() {
- StringBuilder sb = new StringBuilder();
- for (IStyledString styledString : this) {
- sb.append(styledString.getString());
- }
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString#append(java.lang.String)
- */
- public IComposedStyledString append(String str) {
- content.add(new StyledString(str, IStyledString.Style.NO_STYLE));
- return this;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString#append(java.lang.String,
- * org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString.Style)
- */
- public IComposedStyledString append(String str, Style style) {
- content.add(new StyledString(str, style));
- return this;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString#append(org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString)
- * @since 4.0
- */
- public IComposedStyledString append(IComposedStyledString composedStyledString) {
- for (IStyledString styledString : composedStyledString) {
- content.add(styledString);
- }
- return this;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<IStyledString> iterator() {
- return content.iterator();
- }
-
- /**
- * Private implementation of {@link IStyledString} backed by the tuple String and Style.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- private static final class StyledString implements IStyledString {
- /** The string. */
- private final String str;
-
- /** The style. */
- private final Style style;
-
- /**
- * Creates a new styled string.
- *
- * @param str
- * the text value
- * @param style
- * the style.
- */
- StyledString(String str, Style style) {
- this.str = str;
- this.style = style;
- }
-
- /**
- * Returns the string value.
- *
- * @return the string value.
- */
- public String getString() {
- return str;
- }
-
- /**
- * Returns the style.
- *
- * @return the style.
- */
- public Style getStyle() {
- return style;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider.utils;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
+
+/**
+ * Composed styled string implementation backed by an {@link java.util.ArrayList}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class ComposedStyledString implements IComposedStyledString {
+
+ /** the backing list. */
+ private final List<IStyledString> content;
+
+ /** Creates a new empty instance. */
+ public ComposedStyledString() {
+ content = newArrayList();
+ }
+
+ /**
+ * Creates a new instance with the given text without style.
+ *
+ * @param text
+ * the text.
+ */
+ public ComposedStyledString(String text) {
+ this(text, Style.NO_STYLE);
+ }
+
+ /**
+ * Creates a new instance with the given text and the given style.
+ *
+ * @param text
+ * the text.
+ * @param style
+ * the style of the text.
+ */
+ public ComposedStyledString(String text, Style style) {
+ this();
+ append(text, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString#getString()
+ */
+ public String getString() {
+ StringBuilder sb = new StringBuilder();
+ for (IStyledString styledString : this) {
+ sb.append(styledString.getString());
+ }
+ return sb.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString#append(java.lang.String)
+ */
+ public IComposedStyledString append(String str) {
+ content.add(new StyledString(str, IStyledString.Style.NO_STYLE));
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString#append(java.lang.String,
+ * org.eclipse.emf.compare.ide.ui.internal.util.IComposedStyledString.Style)
+ */
+ public IComposedStyledString append(String str, Style style) {
+ content.add(new StyledString(str, style));
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString#append(org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString)
+ * @since 4.0
+ */
+ public IComposedStyledString append(IComposedStyledString composedStyledString) {
+ for (IStyledString styledString : composedStyledString) {
+ content.add(styledString);
+ }
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator<IStyledString> iterator() {
+ return content.iterator();
+ }
+
+ /**
+ * Private implementation of {@link IStyledString} backed by the tuple String and Style.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ private static final class StyledString implements IStyledString {
+ /** The string. */
+ private final String str;
+
+ /** The style. */
+ private final Style style;
+
+ /**
+ * Creates a new styled string.
+ *
+ * @param str
+ * the text value
+ * @param style
+ * the style.
+ */
+ StyledString(String str, Style style) {
+ this.str = str;
+ this.style = style;
+ }
+
+ /**
+ * Returns the string value.
+ *
+ * @return the string value.
+ */
+ public String getString() {
+ return str;
+ }
+
+ /**
+ * Returns the style.
+ *
+ * @return the style.
+ */
+ public Style getStyle() {
+ return style;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/IStyledString.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/IStyledString.java
index e946d60da..2024fe915 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/IStyledString.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/utils/IStyledString.java
@@ -1,423 +1,423 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.provider.utils;
-
-import org.eclipse.emf.common.util.URI;
-
-/**
- * Utility class that mimics the JFace's StyledString.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public interface IStyledString {
-
- /**
- * Returns the Java string for this styled string.
- *
- * @return the Java string for this styled string.
- */
- String getString();
-
- /**
- * Returns the style associated with this string.
- *
- * @return the style associated with this string.
- */
- Style getStyle();
-
- /**
- * An iterable of {@link IStyledString}. It is appendable.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- interface IComposedStyledString extends Iterable<IStyledString> {
-
- /**
- * Append the given string with no style.
- *
- * @param str
- * the string to append.
- * @return this instance to let you chain the calls.
- */
- IComposedStyledString append(String str);
-
- /**
- * Append the given string with the given style.
- *
- * @param str
- * the string to append.
- * @param style
- * the style of the appended string.
- * @return this instance to let you chain the calls.
- */
- IComposedStyledString append(String str, Style style);
-
- /**
- * Appends the given composed styled string to this.
- *
- * @param composedStyledString
- * the styled string to append.
- * @return this instance.
- * @since 4.0
- */
- IComposedStyledString append(IComposedStyledString composedStyledString);
-
- /**
- * Returns the Java string for this composed styled string.
- *
- * @return the Java string for this composed styled string.
- */
- String getString();
- }
-
- /**
- * A style class for {@link IStyledString}.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- public static final class Style {
-
- /** Instance that represent a default unstyled string. */
- public static final Style NO_STYLE = new Style(null, null, null, false, null, null, null, null, null);
-
- /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.QUALIFIER_STYLER. */
- public static final Style QUALIFIER_STYLER = new Style(null, null, null, false, null, null, null,
- null, null);
-
- /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.COUNTER_STYLER. */
- public static final Style COUNTER_STYLER = new Style(null, null, null, false, null, null, null, null,
- null);
-
- /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.DECORATIONS_STYLER. */
- public static final Style DECORATIONS_STYLER = new Style(null, null, null, false, null, null, null,
- null, null);
-
- /** The font URI. */
- private final URI font;
-
- /** The background color URI. */
- private final URI backgroundColor;
-
- /** The foreground color URI. */
- private final URI foregroundColor;
-
- /** Is the string strikedout. */
- private final boolean isStrikedout;
-
- /** The strikeout color URI. */
- private final URI strikeoutColor;
-
- /** The style of the underline. */
- private final UnderLineStyle underlineStyle;
-
- /** The underline color URI. */
- private final URI underlineColor;
-
- /** The border style. */
- private final BorderStyle borderStyle;
-
- /** The border color URI. */
- private final URI borderColor;
-
- /**
- * Creates a new instance with the given values for each component of this style.
- *
- * @param font
- * the font
- * @param backgroundColor
- * the background color
- * @param foregroundColor
- * the foreground color
- * @param isStrikedout
- * whether to strikedout the text
- * @param strikeoutColor
- * the color of the strikedout
- * @param underlineStyle
- * the style of the underline
- * @param underlineColor
- * the color of the underline
- * @param borderStyle
- * the style of the border
- * @param borderColor
- * the color of the border
- */
- // CHECKSTYLE:OFF private method
- private Style(URI font, URI backgroundColor, URI foregroundColor, boolean isStrikedout,
- URI strikeoutColor, UnderLineStyle underlineStyle, URI underlineColor,
- BorderStyle borderStyle, URI borderColor) {
- // CHECKSTYLE:ON
- this.font = font;
- this.backgroundColor = backgroundColor;
- this.foregroundColor = foregroundColor;
- this.isStrikedout = isStrikedout;
- this.strikeoutColor = strikeoutColor;
- this.underlineStyle = underlineStyle;
- this.underlineColor = underlineColor;
- this.borderStyle = borderStyle;
- this.borderColor = borderColor;
- }
-
- public URI getFont() {
- return font;
- }
-
- public URI getBackgoundColor() {
- return backgroundColor;
- }
-
- public URI getForegroundColor() {
- return foregroundColor;
- }
-
- public boolean isStrikedout() {
- return isStrikedout;
- }
-
- public URI getStrikeoutColor() {
- return strikeoutColor;
- }
-
- public UnderLineStyle getUnderlineStyle() {
- return underlineStyle;
- }
-
- public URI getUnderlineColor() {
- return underlineColor;
- }
-
- public BorderStyle getBorderStyle() {
- return borderStyle;
- }
-
- public URI getBorderColor() {
- return borderColor;
- }
-
- /**
- * The possible styles of the underline. These are those supported by JFace 3.8. Other versions or
- * other widgets toolkit may not support all of these or may support more than these.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- public static enum UnderLineStyle {
- /** No underline. */
- NONE,
- /** Single line. */
- SINGLE,
- /** Double line. */
- DOUBLE,
- /** Squiggle line. */
- SQUIGGLE,
- /** Error line (often dash line). */
- ERROR,
- /** Hyperlink. */
- LINK;
- }
-
- /**
- * The possible styles of the border. These are those supported by JFace 3.8. Other versions or other
- * widgets toolkit may not support all of these or may support more than these.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- public static enum BorderStyle {
- /** No border. */
- NONE,
- /** Solid thin border. */
- SOLID,
- /** Dot thin border. */
- DOT,
- /** Dash thin border. */
- DASH;
- }
-
- /**
- * Returns a new builder for the style.
- *
- * @return a new builder for the style.
- */
- public static StyleBuilder builder() {
- return new StyleBuilder();
- }
-
- /**
- * A {@link Style} builder.
- *
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
- public static final class StyleBuilder {
-
- /** The black color URI constant. */
- private static final URI BLACK = URI.createURI("color://rgb/0/0/0"); //$NON-NLS-1$
-
- /** The font. */
- private URI font;
-
- /** The background color. */
- private URI backgroundColor;
-
- /** The foreground color. */
- private URI foregroundColor;
-
- /** Is the text strikedout. */
- private boolean isStrikedout;
-
- /** The strikedout color. */
- private URI strikeoutColor;
-
- /** The underline style. */
- private UnderLineStyle underlineStyle = UnderLineStyle.NONE;
-
- /** The underline color. */
- private URI underlineColor;
-
- /** The border style. */
- private BorderStyle borderStyle = BorderStyle.NONE;
-
- /** The border color. */
- private URI borderColor;
-
- /**
- * Set the font.
- *
- * @param pFont
- * the font to set.
- * @return this.
- */
- public StyleBuilder setFont(URI pFont) {
- this.font = pFont;
- return this;
- }
-
- /**
- * Set the background color.
- *
- * @param pBackgroundColor
- * the backgroundColor to set
- * @return this.
- */
- public StyleBuilder setBackgroundColor(URI pBackgroundColor) {
- this.backgroundColor = pBackgroundColor;
- return this;
- }
-
- /**
- * Set the foreground color.
- *
- * @param pForegroundColor
- * the forregroundColor to set
- * @return this
- */
- public StyleBuilder setForegroundColor(URI pForegroundColor) {
- this.foregroundColor = pForegroundColor;
- return this;
- }
-
- /**
- * Set the strikedout.
- *
- * @param pIsStrikedout
- * the isStrikedout to set
- * @return this.
- */
- public StyleBuilder setStrikedout(boolean pIsStrikedout) {
- this.isStrikedout = pIsStrikedout;
- if (strikeoutColor == null) {
- strikeoutColor = BLACK;
- }
- return this;
- }
-
- /**
- * Set the strikeout color.
- *
- * @param pStrikeoutColor
- * the strikeoutColor to set
- * @return this.
- */
- public StyleBuilder setStrikeoutColor(URI pStrikeoutColor) {
- this.strikeoutColor = pStrikeoutColor;
- isStrikedout = true;
- return this;
- }
-
- /**
- * Set the border color.
- *
- * @param pBorderColor
- * the borderColor to set
- * @return this.
- */
- public StyleBuilder setBorderColor(URI pBorderColor) {
- this.borderColor = pBorderColor;
- if (borderStyle == BorderStyle.NONE) {
- borderStyle = BorderStyle.SOLID;
- }
- return this;
- }
-
- /**
- * Set the border color.
- *
- * @param pBorderStyle
- * the borderStyle to set
- * @return this.
- */
- public StyleBuilder setBorderStyle(BorderStyle pBorderStyle) {
- this.borderStyle = pBorderStyle;
- if (borderColor == null) {
- borderColor = BLACK;
- }
- return this;
- }
-
- /**
- * Set the underline color.
- *
- * @param pUnderlineColor
- * the underlineColor to set
- * @return this.
- */
- public StyleBuilder setUnderlineColor(URI pUnderlineColor) {
- this.underlineColor = pUnderlineColor;
- if (underlineStyle == UnderLineStyle.NONE) {
- underlineStyle = UnderLineStyle.SINGLE;
- }
- return this;
- }
-
- /**
- * Set the underline style.
- *
- * @param pUnderlineStyle
- * the underlineStyle to set
- * @return this.
- */
- public StyleBuilder setUnderlineStyle(UnderLineStyle pUnderlineStyle) {
- this.underlineStyle = pUnderlineStyle;
- if (pUnderlineStyle == null) {
- underlineColor = BLACK;
- }
- return this;
- }
-
- /**
- * Builds and returns a new Style instance regarding the values that have been given beforehands.
- *
- * @return a new Style instance regarding the values that have been given beforehands.
- */
- public Style build() {
- return new Style(font, backgroundColor, foregroundColor, isStrikedout, strikeoutColor,
- underlineStyle, underlineColor, borderStyle, borderColor);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.provider.utils;
+
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * Utility class that mimics the JFace's StyledString.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public interface IStyledString {
+
+ /**
+ * Returns the Java string for this styled string.
+ *
+ * @return the Java string for this styled string.
+ */
+ String getString();
+
+ /**
+ * Returns the style associated with this string.
+ *
+ * @return the style associated with this string.
+ */
+ Style getStyle();
+
+ /**
+ * An iterable of {@link IStyledString}. It is appendable.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ interface IComposedStyledString extends Iterable<IStyledString> {
+
+ /**
+ * Append the given string with no style.
+ *
+ * @param str
+ * the string to append.
+ * @return this instance to let you chain the calls.
+ */
+ IComposedStyledString append(String str);
+
+ /**
+ * Append the given string with the given style.
+ *
+ * @param str
+ * the string to append.
+ * @param style
+ * the style of the appended string.
+ * @return this instance to let you chain the calls.
+ */
+ IComposedStyledString append(String str, Style style);
+
+ /**
+ * Appends the given composed styled string to this.
+ *
+ * @param composedStyledString
+ * the styled string to append.
+ * @return this instance.
+ * @since 4.0
+ */
+ IComposedStyledString append(IComposedStyledString composedStyledString);
+
+ /**
+ * Returns the Java string for this composed styled string.
+ *
+ * @return the Java string for this composed styled string.
+ */
+ String getString();
+ }
+
+ /**
+ * A style class for {@link IStyledString}.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ public static final class Style {
+
+ /** Instance that represent a default unstyled string. */
+ public static final Style NO_STYLE = new Style(null, null, null, false, null, null, null, null, null);
+
+ /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.QUALIFIER_STYLER. */
+ public static final Style QUALIFIER_STYLER = new Style(null, null, null, false, null, null, null,
+ null, null);
+
+ /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.COUNTER_STYLER. */
+ public static final Style COUNTER_STYLER = new Style(null, null, null, false, null, null, null, null,
+ null);
+
+ /** Constant that will eventually map to org.eclipse.jface.viewers.StyledString.DECORATIONS_STYLER. */
+ public static final Style DECORATIONS_STYLER = new Style(null, null, null, false, null, null, null,
+ null, null);
+
+ /** The font URI. */
+ private final URI font;
+
+ /** The background color URI. */
+ private final URI backgroundColor;
+
+ /** The foreground color URI. */
+ private final URI foregroundColor;
+
+ /** Is the string strikedout. */
+ private final boolean isStrikedout;
+
+ /** The strikeout color URI. */
+ private final URI strikeoutColor;
+
+ /** The style of the underline. */
+ private final UnderLineStyle underlineStyle;
+
+ /** The underline color URI. */
+ private final URI underlineColor;
+
+ /** The border style. */
+ private final BorderStyle borderStyle;
+
+ /** The border color URI. */
+ private final URI borderColor;
+
+ /**
+ * Creates a new instance with the given values for each component of this style.
+ *
+ * @param font
+ * the font
+ * @param backgroundColor
+ * the background color
+ * @param foregroundColor
+ * the foreground color
+ * @param isStrikedout
+ * whether to strikedout the text
+ * @param strikeoutColor
+ * the color of the strikedout
+ * @param underlineStyle
+ * the style of the underline
+ * @param underlineColor
+ * the color of the underline
+ * @param borderStyle
+ * the style of the border
+ * @param borderColor
+ * the color of the border
+ */
+ // CHECKSTYLE:OFF private method
+ private Style(URI font, URI backgroundColor, URI foregroundColor, boolean isStrikedout,
+ URI strikeoutColor, UnderLineStyle underlineStyle, URI underlineColor,
+ BorderStyle borderStyle, URI borderColor) {
+ // CHECKSTYLE:ON
+ this.font = font;
+ this.backgroundColor = backgroundColor;
+ this.foregroundColor = foregroundColor;
+ this.isStrikedout = isStrikedout;
+ this.strikeoutColor = strikeoutColor;
+ this.underlineStyle = underlineStyle;
+ this.underlineColor = underlineColor;
+ this.borderStyle = borderStyle;
+ this.borderColor = borderColor;
+ }
+
+ public URI getFont() {
+ return font;
+ }
+
+ public URI getBackgoundColor() {
+ return backgroundColor;
+ }
+
+ public URI getForegroundColor() {
+ return foregroundColor;
+ }
+
+ public boolean isStrikedout() {
+ return isStrikedout;
+ }
+
+ public URI getStrikeoutColor() {
+ return strikeoutColor;
+ }
+
+ public UnderLineStyle getUnderlineStyle() {
+ return underlineStyle;
+ }
+
+ public URI getUnderlineColor() {
+ return underlineColor;
+ }
+
+ public BorderStyle getBorderStyle() {
+ return borderStyle;
+ }
+
+ public URI getBorderColor() {
+ return borderColor;
+ }
+
+ /**
+ * The possible styles of the underline. These are those supported by JFace 3.8. Other versions or
+ * other widgets toolkit may not support all of these or may support more than these.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ public static enum UnderLineStyle {
+ /** No underline. */
+ NONE,
+ /** Single line. */
+ SINGLE,
+ /** Double line. */
+ DOUBLE,
+ /** Squiggle line. */
+ SQUIGGLE,
+ /** Error line (often dash line). */
+ ERROR,
+ /** Hyperlink. */
+ LINK;
+ }
+
+ /**
+ * The possible styles of the border. These are those supported by JFace 3.8. Other versions or other
+ * widgets toolkit may not support all of these or may support more than these.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ public static enum BorderStyle {
+ /** No border. */
+ NONE,
+ /** Solid thin border. */
+ SOLID,
+ /** Dot thin border. */
+ DOT,
+ /** Dash thin border. */
+ DASH;
+ }
+
+ /**
+ * Returns a new builder for the style.
+ *
+ * @return a new builder for the style.
+ */
+ public static StyleBuilder builder() {
+ return new StyleBuilder();
+ }
+
+ /**
+ * A {@link Style} builder.
+ *
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ public static final class StyleBuilder {
+
+ /** The black color URI constant. */
+ private static final URI BLACK = URI.createURI("color://rgb/0/0/0"); //$NON-NLS-1$
+
+ /** The font. */
+ private URI font;
+
+ /** The background color. */
+ private URI backgroundColor;
+
+ /** The foreground color. */
+ private URI foregroundColor;
+
+ /** Is the text strikedout. */
+ private boolean isStrikedout;
+
+ /** The strikedout color. */
+ private URI strikeoutColor;
+
+ /** The underline style. */
+ private UnderLineStyle underlineStyle = UnderLineStyle.NONE;
+
+ /** The underline color. */
+ private URI underlineColor;
+
+ /** The border style. */
+ private BorderStyle borderStyle = BorderStyle.NONE;
+
+ /** The border color. */
+ private URI borderColor;
+
+ /**
+ * Set the font.
+ *
+ * @param pFont
+ * the font to set.
+ * @return this.
+ */
+ public StyleBuilder setFont(URI pFont) {
+ this.font = pFont;
+ return this;
+ }
+
+ /**
+ * Set the background color.
+ *
+ * @param pBackgroundColor
+ * the backgroundColor to set
+ * @return this.
+ */
+ public StyleBuilder setBackgroundColor(URI pBackgroundColor) {
+ this.backgroundColor = pBackgroundColor;
+ return this;
+ }
+
+ /**
+ * Set the foreground color.
+ *
+ * @param pForegroundColor
+ * the forregroundColor to set
+ * @return this
+ */
+ public StyleBuilder setForegroundColor(URI pForegroundColor) {
+ this.foregroundColor = pForegroundColor;
+ return this;
+ }
+
+ /**
+ * Set the strikedout.
+ *
+ * @param pIsStrikedout
+ * the isStrikedout to set
+ * @return this.
+ */
+ public StyleBuilder setStrikedout(boolean pIsStrikedout) {
+ this.isStrikedout = pIsStrikedout;
+ if (strikeoutColor == null) {
+ strikeoutColor = BLACK;
+ }
+ return this;
+ }
+
+ /**
+ * Set the strikeout color.
+ *
+ * @param pStrikeoutColor
+ * the strikeoutColor to set
+ * @return this.
+ */
+ public StyleBuilder setStrikeoutColor(URI pStrikeoutColor) {
+ this.strikeoutColor = pStrikeoutColor;
+ isStrikedout = true;
+ return this;
+ }
+
+ /**
+ * Set the border color.
+ *
+ * @param pBorderColor
+ * the borderColor to set
+ * @return this.
+ */
+ public StyleBuilder setBorderColor(URI pBorderColor) {
+ this.borderColor = pBorderColor;
+ if (borderStyle == BorderStyle.NONE) {
+ borderStyle = BorderStyle.SOLID;
+ }
+ return this;
+ }
+
+ /**
+ * Set the border color.
+ *
+ * @param pBorderStyle
+ * the borderStyle to set
+ * @return this.
+ */
+ public StyleBuilder setBorderStyle(BorderStyle pBorderStyle) {
+ this.borderStyle = pBorderStyle;
+ if (borderColor == null) {
+ borderColor = BLACK;
+ }
+ return this;
+ }
+
+ /**
+ * Set the underline color.
+ *
+ * @param pUnderlineColor
+ * the underlineColor to set
+ * @return this.
+ */
+ public StyleBuilder setUnderlineColor(URI pUnderlineColor) {
+ this.underlineColor = pUnderlineColor;
+ if (underlineStyle == UnderLineStyle.NONE) {
+ underlineStyle = UnderLineStyle.SINGLE;
+ }
+ return this;
+ }
+
+ /**
+ * Set the underline style.
+ *
+ * @param pUnderlineStyle
+ * the underlineStyle to set
+ * @return this.
+ */
+ public StyleBuilder setUnderlineStyle(UnderLineStyle pUnderlineStyle) {
+ this.underlineStyle = pUnderlineStyle;
+ if (pUnderlineStyle == null) {
+ underlineColor = BLACK;
+ }
+ return this;
+ }
+
+ /**
+ * Builds and returns a new Style instance regarding the values that have been given beforehands.
+ *
+ * @return a new Style instance regarding the values that have been given beforehands.
+ */
+ public Style build() {
+ return new Style(font, backgroundColor, foregroundColor, isStrikedout, strikeoutColor,
+ underlineStyle, underlineColor, borderStyle, borderColor);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/.project b/plugins/org.eclipse.emf.compare.ide.tests/.project
index 5c122774c..a5e452802 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/.project
+++ b/plugins/org.eclipse.emf.compare.ide.tests/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.emf.compare.ide.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.compare.ide.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.resources.prefs
index 3d916f296..99f26c020 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=Cp1252
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\r\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.jdt.ui.prefs
index 4517c0f23..4e1442ee9 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,60 +1,60 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_EMF Compare
-formatter_settings_version=12
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMF Compare
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/build.properties b/plugins/org.eclipse.emf.compare.ide.tests/build.properties
index 1b08f841b..cdd2db7f1 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/build.properties
+++ b/plugins/org.eclipse.emf.compare.ide.tests/build.properties
@@ -1,7 +1,7 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/pom.xml b/plugins/org.eclipse.emf.compare.ide.tests/pom.xml
index 6a7a08408..9ef55a4bf 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/pom.xml
+++ b/plugins/org.eclipse.emf.compare.ide.tests/pom.xml
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>emf.compare-parent</artifactId>
- <groupId>org.eclipse.emf.compare</groupId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
- </parent>
- <groupId>org.eclipse.emf.compare</groupId>
- <artifactId>org.eclipse.emf.compare.ide.tests</artifactId>
- <version>3.1.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <build>
- <resources>
- <resource>
- <directory>src</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>org/eclipse/emf/compare/ide/tests/suite/AllTests.class</include>
- </includes>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
- <testFailureIgnore>true</testFailureIgnore>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>emf.compare-parent</artifactId>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
+ </parent>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <artifactId>org.eclipse.emf.compare.ide.tests</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>org/eclipse/emf/compare/ide/tests/suite/AllTests.class</include>
+ </includes>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/Activator.java b/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/Activator.java
index 347b6d5da..d306130b2 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/Activator.java
+++ b/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/Activator.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.tests;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/suite/AllTests.java
index ce40ad7dd..23e6bc3bc 100644
--- a/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.ide.tests/src/org/eclipse/emf/compare/ide/tests/suite/AllTests.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.tests.suite;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.textui.TestRunner;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({})
-public class AllTests {
- /**
- * Launches the test with the given arguments.
- *
- * @param args
- * Arguments of the testCase.
- */
- public static void main(String[] args) {
- TestRunner.run(suite());
- }
-
- /**
- * Creates the {@link junit.framework.TestSuite TestSuite} for all the test.
- *
- * @return The test suite containing all the tests
- */
- public static Test suite() {
- return new JUnit4TestAdapter(AllTests.class);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.tests.suite;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({})
+public class AllTests {
+ /**
+ * Launches the test with the given arguments.
+ *
+ * @param args
+ * Arguments of the testCase.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Creates the {@link junit.framework.TestSuite TestSuite} for all the test.
+ *
+ * @return The test suite containing all the tests
+ */
+ public static Test suite() {
+ return new JUnit4TestAdapter(AllTests.class);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/.project b/plugins/org.eclipse.emf.compare.ide.ui.tests/.project
index 70a74c275..7af89db38 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/.project
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.emf.compare.ide.ui.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.compare.ide.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.resources.prefs
index 3d916f296..99f26c020 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=Cp1252
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\r\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.jdt.ui.prefs
index 4517c0f23..4e1442ee9 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,60 +1,60 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_EMF Compare
-formatter_settings_version=12
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMF Compare
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/build.properties b/plugins/org.eclipse.emf.compare.ide.ui.tests/build.properties
index 1b08f841b..cdd2db7f1 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/build.properties
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/build.properties
@@ -1,7 +1,7 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/pom.xml b/plugins/org.eclipse.emf.compare.ide.ui.tests/pom.xml
index a80f8df9d..20d09f5a9 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/pom.xml
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/pom.xml
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>emf.compare-parent</artifactId>
- <groupId>org.eclipse.emf.compare</groupId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
- </parent>
- <groupId>org.eclipse.emf.compare</groupId>
- <artifactId>org.eclipse.emf.compare.ide.ui.tests</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <build>
- <resources>
- <resource>
- <directory>src</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.class</include>
- </includes>
- <useUIHarness>true</useUIHarness>
- <useUIThread>false</useUIThread>
- <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
- <testFailureIgnore>true</testFailureIgnore>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>emf.compare-parent</artifactId>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
+ </parent>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <artifactId>org.eclipse.emf.compare.ide.ui.tests</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.class</include>
+ </includes>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/Activator.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/Activator.java
index 7ded85e92..55cd42b1f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/Activator.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/Activator.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/CompareTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/CompareTestCase.java
index 160c5c159..5972bae2e 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/CompareTestCase.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/CompareTestCase.java
@@ -1,239 +1,239 @@
-/*******************************************************************************
- * Copyright (C) 2013 Obeo and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterators.filter;
-import static org.eclipse.emf.ecore.util.EcoreUtil.getAllProperContents;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.junit.After;
-import org.junit.Before;
-
-@SuppressWarnings("nls")
-public class CompareTestCase {
- protected static final String PACKAGE_NAME_PREFIX = "package";
-
- protected static final String CLASS1_NAME_PREFIX = "Class_A";
-
- protected static final String CLASS2_NAME_PREFIX = "Class_B";
-
- protected static final String CLASS3_NAME_PREFIX = "Class_C";
-
- protected static final String CLASS4_NAME_PREFIX = "Class_D";
-
- protected TestProject project;
-
- @Before
- public void setUp() throws Exception {
- project = new TestProject();
- }
-
- @After
- public void tearDown() throws Exception {
- project.dispose();
- }
-
- /**
- * The base model for both our files will be one package containing two classes. There are no references
- * and no attributes set, save for the name of these objects.
- *
- * @param nameSuffix
- * Suffix that will be appended to all names for this model.
- * @return A basic model to be used by these tests.
- */
- protected EPackage createBasicModel(String nameSuffix) {
- EPackage root = createPackage(null, PACKAGE_NAME_PREFIX + nameSuffix);
- createClass(root, CLASS1_NAME_PREFIX + nameSuffix);
- createClass(root, CLASS2_NAME_PREFIX + nameSuffix);
- return root;
- }
-
- protected EPackage createPackage(EPackage parent, String name) {
- final EPackage newPackage = EcoreFactory.eINSTANCE.createEPackage();
- newPackage.setName(name);
- if (parent != null) {
- parent.getESubpackages().add(newPackage);
- }
- return newPackage;
- }
-
- protected EClass createClass(EPackage parent, String name) {
- final EClass newClass = EcoreFactory.eINSTANCE.createEClass();
- newClass.setName(name);
- if (parent != null) {
- parent.getEClassifiers().add(newClass);
- }
- return newClass;
- }
-
- protected EObject findObject(Resource resource, String namePrefix) {
- Iterator<EObject> children = EcoreUtil.getAllProperContents(resource, false);
- while (children.hasNext()) {
- final EObject child = children.next();
- if (child instanceof ENamedElement && ((ENamedElement)child).getName().startsWith(namePrefix)) {
- return child;
- }
- }
- return null;
- }
-
- /**
- * Connects an EMF resource to the given File within the given project. The resource will be created with
- * a workspace-relative "{@code platform:/resource}" URI.
- *
- * @param file
- * The file we're attaching an EMF Resource on.
- * @param resourceSet
- * The resource set in which the new Resource will be created.
- * @return The created EMF Resource.
- */
- protected Resource connectResource(IFile file, ResourceSet resourceSet) throws CoreException {
- URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-
- return createResource(uri, resourceSet);
- }
-
- private static Resource createResource(URI modelURI, ResourceSet resourceSet) {
- final Resource resource = new XMIResourceImpl(modelURI) {
- @Override
- protected boolean useUUIDs() {
- return true;
- }
- };
- resourceSet.getResources().add(resource);
- return resource;
- }
-
- /**
- * This will seek for a random EClass in both given resources, then use the "eSuperTypes" reference of the
- * source one to create a reference towards the target.
- *
- * @param source
- * Resource within which we'll search for our source EClass (the class which will have a
- * superType).
- * @param target
- * Resource within which we'll search for our target EClass (the superType).
- */
- protected void makeCrossReference(Resource source, Resource target) {
- final Iterator<EClass> sourceChildren = filter(getAllProperContents(source, false), EClass.class);
- final Iterator<EClass> targetChildren = filter(getAllProperContents(target, false), EClass.class);
- assertTrue(sourceChildren.hasNext());
- assertTrue(targetChildren.hasNext());
- final EClass sourceClass = sourceChildren.next();
- final EClass targetClass = targetChildren.next();
-
- sourceClass.getESuperTypes().add(targetClass);
- }
-
- /**
- * This will seek and break all cross-references from <code>source</code> to <code>target</code>.
- *
- * @param source
- * Resource within which we'll search for our cross-references.
- * @param target
- * Target of the cross-references to break.
- */
- protected void breakCrossReferences(Resource source, Resource target) {
- final Iterator<EObject> sourceChildren = getAllProperContents(source, false);
-
- while (sourceChildren.hasNext()) {
- final EObject child = sourceChildren.next();
- breakCrossReferences(child, target);
- }
- }
-
- private void breakCrossReferences(EObject source, Resource target) {
- for (EReference ref : source.eClass().getEAllReferences()) {
- final Object value = source.eGet(ref);
- if (!ref.isMany()) {
- if (value instanceof EObject && ((EObject)value).eResource() == target && !ref.isDerived()) {
- source.eSet(ref, null);
- }
- } else if (value instanceof Collection<?>) {
- final Collection<?> valueList = (Collection<?>)value;
- final Iterable<EObject> copy = filter(new ArrayList<Object>(valueList), EObject.class);
- for (EObject targetEObject : copy) {
- if (targetEObject.eResource() == target) {
- valueList.remove(targetEObject);
- }
- }
- }
- }
- }
-
- /**
- * Create a cross-resource reference through the "superType" reference of a given EClass.
- * <p>
- * The source EClass will be searched within the {@code source} Resource and its name should have a set
- * prefix. Similarly, the target EClass will be searched withi the {@code target} Resource.
- * </p>
- *
- * @param source
- * Resource within which we'll search for our source EClass (the class which will have a
- * superType).
- * @param target
- * Resource within which we'll search for our target EClass (the superType).
- * @param sourceNamePrefix
- * Prefix (or exact name) of the source EClass.
- * @param targetNamePrefix
- * Prefix (or exact name) of the target EClass.
- */
- protected void makeCrossReference(Resource source, Resource target, String sourceNamePrefix,
- String targetNamePrefix) {
- final EObject sourceObject = findObject(source, sourceNamePrefix);
- final EObject targetObject = findObject(target, targetNamePrefix);
-
- assertTrue(sourceObject instanceof EClass);
- assertTrue(targetObject instanceof EClass);
-
- ((EClass)sourceObject).getESuperTypes().add((EClass)targetObject);
- }
-
- protected void reload(Resource... resources) throws IOException {
- for (Resource resource : resources) {
- resource.getContents().clear();
- resource.unload();
- }
- // separate loop to reload so that we are sure everything has been unloaded
- for (Resource resource : resources) {
- resource.load(Collections.emptyMap());
- }
- // And a third loop to re-resolve every cross-references between the reloaded resources
- for (Resource resource : resources) {
- EcoreUtil.resolveAll(resource);
- }
- }
-
- protected void save(Resource... resources) throws IOException {
- for (Resource resource : resources) {
- resource.save(Collections.emptyMap());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (C) 2013 Obeo and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterators.filter;
+import static org.eclipse.emf.ecore.util.EcoreUtil.getAllProperContents;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.junit.After;
+import org.junit.Before;
+
+@SuppressWarnings("nls")
+public class CompareTestCase {
+ protected static final String PACKAGE_NAME_PREFIX = "package";
+
+ protected static final String CLASS1_NAME_PREFIX = "Class_A";
+
+ protected static final String CLASS2_NAME_PREFIX = "Class_B";
+
+ protected static final String CLASS3_NAME_PREFIX = "Class_C";
+
+ protected static final String CLASS4_NAME_PREFIX = "Class_D";
+
+ protected TestProject project;
+
+ @Before
+ public void setUp() throws Exception {
+ project = new TestProject();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ project.dispose();
+ }
+
+ /**
+ * The base model for both our files will be one package containing two classes. There are no references
+ * and no attributes set, save for the name of these objects.
+ *
+ * @param nameSuffix
+ * Suffix that will be appended to all names for this model.
+ * @return A basic model to be used by these tests.
+ */
+ protected EPackage createBasicModel(String nameSuffix) {
+ EPackage root = createPackage(null, PACKAGE_NAME_PREFIX + nameSuffix);
+ createClass(root, CLASS1_NAME_PREFIX + nameSuffix);
+ createClass(root, CLASS2_NAME_PREFIX + nameSuffix);
+ return root;
+ }
+
+ protected EPackage createPackage(EPackage parent, String name) {
+ final EPackage newPackage = EcoreFactory.eINSTANCE.createEPackage();
+ newPackage.setName(name);
+ if (parent != null) {
+ parent.getESubpackages().add(newPackage);
+ }
+ return newPackage;
+ }
+
+ protected EClass createClass(EPackage parent, String name) {
+ final EClass newClass = EcoreFactory.eINSTANCE.createEClass();
+ newClass.setName(name);
+ if (parent != null) {
+ parent.getEClassifiers().add(newClass);
+ }
+ return newClass;
+ }
+
+ protected EObject findObject(Resource resource, String namePrefix) {
+ Iterator<EObject> children = EcoreUtil.getAllProperContents(resource, false);
+ while (children.hasNext()) {
+ final EObject child = children.next();
+ if (child instanceof ENamedElement && ((ENamedElement)child).getName().startsWith(namePrefix)) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Connects an EMF resource to the given File within the given project. The resource will be created with
+ * a workspace-relative "{@code platform:/resource}" URI.
+ *
+ * @param file
+ * The file we're attaching an EMF Resource on.
+ * @param resourceSet
+ * The resource set in which the new Resource will be created.
+ * @return The created EMF Resource.
+ */
+ protected Resource connectResource(IFile file, ResourceSet resourceSet) throws CoreException {
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+
+ return createResource(uri, resourceSet);
+ }
+
+ private static Resource createResource(URI modelURI, ResourceSet resourceSet) {
+ final Resource resource = new XMIResourceImpl(modelURI) {
+ @Override
+ protected boolean useUUIDs() {
+ return true;
+ }
+ };
+ resourceSet.getResources().add(resource);
+ return resource;
+ }
+
+ /**
+ * This will seek for a random EClass in both given resources, then use the "eSuperTypes" reference of the
+ * source one to create a reference towards the target.
+ *
+ * @param source
+ * Resource within which we'll search for our source EClass (the class which will have a
+ * superType).
+ * @param target
+ * Resource within which we'll search for our target EClass (the superType).
+ */
+ protected void makeCrossReference(Resource source, Resource target) {
+ final Iterator<EClass> sourceChildren = filter(getAllProperContents(source, false), EClass.class);
+ final Iterator<EClass> targetChildren = filter(getAllProperContents(target, false), EClass.class);
+ assertTrue(sourceChildren.hasNext());
+ assertTrue(targetChildren.hasNext());
+ final EClass sourceClass = sourceChildren.next();
+ final EClass targetClass = targetChildren.next();
+
+ sourceClass.getESuperTypes().add(targetClass);
+ }
+
+ /**
+ * This will seek and break all cross-references from <code>source</code> to <code>target</code>.
+ *
+ * @param source
+ * Resource within which we'll search for our cross-references.
+ * @param target
+ * Target of the cross-references to break.
+ */
+ protected void breakCrossReferences(Resource source, Resource target) {
+ final Iterator<EObject> sourceChildren = getAllProperContents(source, false);
+
+ while (sourceChildren.hasNext()) {
+ final EObject child = sourceChildren.next();
+ breakCrossReferences(child, target);
+ }
+ }
+
+ private void breakCrossReferences(EObject source, Resource target) {
+ for (EReference ref : source.eClass().getEAllReferences()) {
+ final Object value = source.eGet(ref);
+ if (!ref.isMany()) {
+ if (value instanceof EObject && ((EObject)value).eResource() == target && !ref.isDerived()) {
+ source.eSet(ref, null);
+ }
+ } else if (value instanceof Collection<?>) {
+ final Collection<?> valueList = (Collection<?>)value;
+ final Iterable<EObject> copy = filter(new ArrayList<Object>(valueList), EObject.class);
+ for (EObject targetEObject : copy) {
+ if (targetEObject.eResource() == target) {
+ valueList.remove(targetEObject);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a cross-resource reference through the "superType" reference of a given EClass.
+ * <p>
+ * The source EClass will be searched within the {@code source} Resource and its name should have a set
+ * prefix. Similarly, the target EClass will be searched withi the {@code target} Resource.
+ * </p>
+ *
+ * @param source
+ * Resource within which we'll search for our source EClass (the class which will have a
+ * superType).
+ * @param target
+ * Resource within which we'll search for our target EClass (the superType).
+ * @param sourceNamePrefix
+ * Prefix (or exact name) of the source EClass.
+ * @param targetNamePrefix
+ * Prefix (or exact name) of the target EClass.
+ */
+ protected void makeCrossReference(Resource source, Resource target, String sourceNamePrefix,
+ String targetNamePrefix) {
+ final EObject sourceObject = findObject(source, sourceNamePrefix);
+ final EObject targetObject = findObject(target, targetNamePrefix);
+
+ assertTrue(sourceObject instanceof EClass);
+ assertTrue(targetObject instanceof EClass);
+
+ ((EClass)sourceObject).getESuperTypes().add((EClass)targetObject);
+ }
+
+ protected void reload(Resource... resources) throws IOException {
+ for (Resource resource : resources) {
+ resource.getContents().clear();
+ resource.unload();
+ }
+ // separate loop to reload so that we are sure everything has been unloaded
+ for (Resource resource : resources) {
+ resource.load(Collections.emptyMap());
+ }
+ // And a third loop to re-resolve every cross-references between the reloaded resources
+ for (Resource resource : resources) {
+ EcoreUtil.resolveAll(resource);
+ }
+ }
+
+ protected void save(Resource... resources) throws IOException {
+ for (Resource resource : resources) {
+ resource.save(Collections.emptyMap());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
index e347d0138..b5d39d900 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests.suite;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.textui.TestRunner;
-
-import org.eclipse.emf.compare.ide.ui.tests.unit.DependenciesTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({DependenciesTest.class, })
-public class AllTests {
- /**
- * Launches the test with the given arguments.
- *
- * @param args
- * Arguments of the testCase.
- */
- public static void main(String[] args) {
- TestRunner.run(suite());
- }
-
- /**
- * Creates the {@link junit.framework.TestSuite TestSuite} for all the test.
- *
- * @return The test suite containing all the tests
- */
- public static Test suite() {
- return new JUnit4TestAdapter(AllTests.class);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests.suite;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
+import org.eclipse.emf.compare.ide.ui.tests.unit.DependenciesTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({DependenciesTest.class, })
+public class AllTests {
+ /**
+ * Launches the test with the given arguments.
+ *
+ * @param args
+ * Arguments of the testCase.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Creates the {@link junit.framework.TestSuite TestSuite} for all the test.
+ *
+ * @return The test suite containing all the tests
+ */
+ public static Test suite() {
+ return new JUnit4TestAdapter(AllTests.class);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
index dee17f54b..d2d1adad5 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests.unit;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.compare.ide.ui.internal.logical.ProjectModelResolver;
-import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
-import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
-import org.eclipse.emf.compare.ide.utils.StorageTraversal;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class DependenciesTest extends CompareTestCase {
- private static final String FILE1_SUFFIX = "_file1";
-
- private static final String FILE2_SUFFIX = "_file2";
-
- private static final String FILE3_SUFFIX = "_file3";
-
- private IFile iFile1;
-
- private IFile iFile2;
-
- private IFile iFile3;
-
- private Resource resource1;
-
- private Resource resource2;
-
- private Resource resource3;
-
- private IModelResolver resolver;
-
- private IProgressMonitor monitor;
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- resolver = new ProjectModelResolver();
- resolver.initialize();
- monitor = new NullProgressMonitor();
-
- final IProject iProject = project.getProject();
- final ResourceSet resourceSet = new ResourceSetImpl();
-
- final File file1 = project.getOrCreateFile(iProject, "file1.ecore");
- final File file2 = project.getOrCreateFile(iProject, "file2.ecore");
- final File file3 = project.getOrCreateFile(iProject, "file3.ecore");
-
- iFile1 = project.getIFile(iProject, file1);
- iFile2 = project.getIFile(iProject, file2);
- iFile3 = project.getIFile(iProject, file3);
-
- resource1 = connectResource(iFile1, resourceSet);
- resource2 = connectResource(iFile2, resourceSet);
- resource3 = connectResource(iFile3, resourceSet);
-
- resource1.getContents().add(createBasicModel(FILE1_SUFFIX));
- resource2.getContents().add(createBasicModel(FILE2_SUFFIX));
- resource3.getContents().add(createBasicModel(FILE3_SUFFIX));
-
- save(resource1, resource2, resource3);
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- resolver.dispose();
- super.tearDown();
- }
-
- @Test
- public void testScopeNoDependencies() {
- StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile1));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile2));
-
- traversal = resolver.resolveLocalModel(iFile3, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile3));
- }
-
- @Test
- public void testScopeAddedDependency() throws Exception {
- makeCrossReference(resource2, resource1);
- save(resource2);
-
- StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 2);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 2);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
- }
-
- @Test
- public void testScopeRemovedDependency() throws Exception {
- makeCrossReference(resource2, resource1);
- save(resource2);
-
- breakCrossReferences(resource2, resource1);
- save(resource2);
-
- StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile1));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile2));
- }
-
- @Test
- public void testScopeDepth() throws Exception {
- makeCrossReference(resource2, resource1);
- makeCrossReference(resource3, resource2);
- save(resource2, resource3);
-
- StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 3);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
- assertTrue(traversal.getStorages().contains(iFile3));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 3);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
- assertTrue(traversal.getStorages().contains(iFile3));
-
- traversal = resolver.resolveLocalModel(iFile3, monitor);
- assertEquals(traversal.getStorages().size(), 3);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
- assertTrue(traversal.getStorages().contains(iFile3));
- }
-
- @Test
- public void testScopeUpdate() throws Exception {
- makeCrossReference(resource2, resource1);
- makeCrossReference(resource3, resource2);
- save(resource2, resource3);
-
- StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 3);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile2));
- assertTrue(traversal.getStorages().contains(iFile3));
-
- breakCrossReferences(resource2, resource1);
- save(resource2);
-
- traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile1));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 2);
- assertTrue(traversal.getStorages().contains(iFile2));
- assertTrue(traversal.getStorages().contains(iFile3));
-
- breakCrossReferences(resource3, resource2);
- makeCrossReference(resource3, resource1);
- save(resource3);
-
- traversal = resolver.resolveLocalModel(iFile1, monitor);
- assertEquals(traversal.getStorages().size(), 2);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile3));
-
- traversal = resolver.resolveLocalModel(iFile2, monitor);
- assertEquals(traversal.getStorages().size(), 1);
- assertTrue(traversal.getStorages().contains(iFile2));
-
- traversal = resolver.resolveLocalModel(iFile3, monitor);
- assertEquals(traversal.getStorages().size(), 2);
- assertTrue(traversal.getStorages().contains(iFile1));
- assertTrue(traversal.getStorages().contains(iFile3));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Obeo.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.compare.ide.ui.internal.logical.ProjectModelResolver;
+import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
+import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
+import org.eclipse.emf.compare.ide.utils.StorageTraversal;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class DependenciesTest extends CompareTestCase {
+ private static final String FILE1_SUFFIX = "_file1";
+
+ private static final String FILE2_SUFFIX = "_file2";
+
+ private static final String FILE3_SUFFIX = "_file3";
+
+ private IFile iFile1;
+
+ private IFile iFile2;
+
+ private IFile iFile3;
+
+ private Resource resource1;
+
+ private Resource resource2;
+
+ private Resource resource3;
+
+ private IModelResolver resolver;
+
+ private IProgressMonitor monitor;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ resolver = new ProjectModelResolver();
+ resolver.initialize();
+ monitor = new NullProgressMonitor();
+
+ final IProject iProject = project.getProject();
+ final ResourceSet resourceSet = new ResourceSetImpl();
+
+ final File file1 = project.getOrCreateFile(iProject, "file1.ecore");
+ final File file2 = project.getOrCreateFile(iProject, "file2.ecore");
+ final File file3 = project.getOrCreateFile(iProject, "file3.ecore");
+
+ iFile1 = project.getIFile(iProject, file1);
+ iFile2 = project.getIFile(iProject, file2);
+ iFile3 = project.getIFile(iProject, file3);
+
+ resource1 = connectResource(iFile1, resourceSet);
+ resource2 = connectResource(iFile2, resourceSet);
+ resource3 = connectResource(iFile3, resourceSet);
+
+ resource1.getContents().add(createBasicModel(FILE1_SUFFIX));
+ resource2.getContents().add(createBasicModel(FILE2_SUFFIX));
+ resource3.getContents().add(createBasicModel(FILE3_SUFFIX));
+
+ save(resource1, resource2, resource3);
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ resolver.dispose();
+ super.tearDown();
+ }
+
+ @Test
+ public void testScopeNoDependencies() {
+ StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile1));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile2));
+
+ traversal = resolver.resolveLocalModel(iFile3, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile3));
+ }
+
+ @Test
+ public void testScopeAddedDependency() throws Exception {
+ makeCrossReference(resource2, resource1);
+ save(resource2);
+
+ StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 2);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 2);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+ }
+
+ @Test
+ public void testScopeRemovedDependency() throws Exception {
+ makeCrossReference(resource2, resource1);
+ save(resource2);
+
+ breakCrossReferences(resource2, resource1);
+ save(resource2);
+
+ StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile1));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile2));
+ }
+
+ @Test
+ public void testScopeDepth() throws Exception {
+ makeCrossReference(resource2, resource1);
+ makeCrossReference(resource3, resource2);
+ save(resource2, resource3);
+
+ StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 3);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+ assertTrue(traversal.getStorages().contains(iFile3));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 3);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+ assertTrue(traversal.getStorages().contains(iFile3));
+
+ traversal = resolver.resolveLocalModel(iFile3, monitor);
+ assertEquals(traversal.getStorages().size(), 3);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+ assertTrue(traversal.getStorages().contains(iFile3));
+ }
+
+ @Test
+ public void testScopeUpdate() throws Exception {
+ makeCrossReference(resource2, resource1);
+ makeCrossReference(resource3, resource2);
+ save(resource2, resource3);
+
+ StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 3);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile2));
+ assertTrue(traversal.getStorages().contains(iFile3));
+
+ breakCrossReferences(resource2, resource1);
+ save(resource2);
+
+ traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile1));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 2);
+ assertTrue(traversal.getStorages().contains(iFile2));
+ assertTrue(traversal.getStorages().contains(iFile3));
+
+ breakCrossReferences(resource3, resource2);
+ makeCrossReference(resource3, resource1);
+ save(resource3);
+
+ traversal = resolver.resolveLocalModel(iFile1, monitor);
+ assertEquals(traversal.getStorages().size(), 2);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile3));
+
+ traversal = resolver.resolveLocalModel(iFile2, monitor);
+ assertEquals(traversal.getStorages().size(), 1);
+ assertTrue(traversal.getStorages().contains(iFile2));
+
+ traversal = resolver.resolveLocalModel(iFile3, monitor);
+ assertEquals(traversal.getStorages().size(), 2);
+ assertTrue(traversal.getStorages().contains(iFile1));
+ assertTrue(traversal.getStorages().contains(iFile3));
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/workspace/TestProject.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/workspace/TestProject.java
index 8e4aa2cf4..848dce770 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/workspace/TestProject.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/workspace/TestProject.java
@@ -1,153 +1,153 @@
-/*******************************************************************************
- * Copyright (C) 2013 Obeo and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests.workspace;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-@SuppressWarnings("nls")
-public class TestProject {
- /** The underlying eclipse project. */
- private IProject project;
-
- /**
- * Creates a new project in the workspace with a default name. An existing test project with that name
- * will be deleted and re-created.
- */
- public TestProject() throws CoreException {
- this("Project-1");
- }
-
- /**
- * This will create a new project with the given name inside the workspace. If this project already
- * existed, it will be deleted and re-created.
- *
- * @param name
- * Name of our project.
- */
- public TestProject(String name) throws CoreException {
- final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name);
- project = root.getProject(description.getName());
- if (project.exists()) {
- project.delete(true, true, new NullProgressMonitor());
- }
- project.create(description, new NullProgressMonitor());
- project.open(new NullProgressMonitor());
- }
-
- public IProject getProject() {
- return project;
- }
-
- /**
- * Create or get a file for the given path.
- *
- * @param project
- * Instance of project inside which a file will be created.
- * @param path
- * Project-relative path for the new file.
- * @return Newly created file
- */
- public File getOrCreateFile(IProject aProject, String path) throws IOException {
- String fullPath = aProject.getLocation().append(path).toOSString();
- int lastSeparator = fullPath.lastIndexOf(File.separator);
- mkdirs(new File(fullPath.substring(0, lastSeparator)), true);
-
- File file = new File(fullPath);
- if (!file.exists()) {
- createNewFile(file);
- }
-
- return file;
- }
-
- /**
- * Find an IFile corresponding to the given java.io.File within the given project.
- *
- * @param aProject
- * The project within which we're searching for a file.
- * @param file
- * java.io.File for which we're searching a corresponding eclipse IFile.
- * @return The IFile we found for the given file.
- */
- public IFile getIFile(IProject aProject, File file) throws CoreException {
- IPath filePath = new Path(file.getAbsolutePath());
- String relativePath = filePath.makeRelativeTo(aProject.getLocation()).toString();
-
- String quotedProjectName = Pattern.quote(aProject.getName());
- relativePath = relativePath.replaceFirst(quotedProjectName, "");
-
- IFile iFile = aProject.getFile(relativePath);
- iFile.refreshLocal(0, new NullProgressMonitor());
-
- return iFile;
- }
-
- /**
- * Creates the directory named by this abstract pathname, including any necessary but nonexistent parent
- * directories. Note that if this operation fails it may have succeeded in creating some of the necessary
- * parent directories.
- *
- * @param d
- * directory to be created
- * @param skipExisting
- * if {@code true} skip creation of the given directory if it already exists in the file system
- * @throws IOException
- * if creation of {@code d} fails. This may occur if {@code d} did exist when the method was
- * called. This can therefore cause IOExceptions during race conditions when multiple
- * concurrent threads all try to create the same directory.
- */
- private static void mkdirs(final File d, boolean skipExisting) throws IOException {
- if (!d.mkdirs()) {
- if (skipExisting && d.isDirectory()) {
- return;
- }
- }
- }
-
- private static void createNewFile(File f) throws IOException {
- f.createNewFile();
- }
-
- public IFile createFile(String name, byte[] content) throws Exception {
- IFile file = project.getFile(name);
- InputStream inputStream = new ByteArrayInputStream(content);
- file.create(inputStream, true, new NullProgressMonitor());
-
- return file;
- }
-
- public IFolder createFolder(String name) throws Exception {
- IFolder folder = project.getFolder(name);
- folder.create(true, true, new NullProgressMonitor());
-
- return folder;
- }
-
- public void dispose() throws CoreException, IOException {
- if (project.exists()) {
- project.delete(true, true, new NullProgressMonitor());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (C) 2013 Obeo and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests.workspace;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+@SuppressWarnings("nls")
+public class TestProject {
+ /** The underlying eclipse project. */
+ private IProject project;
+
+ /**
+ * Creates a new project in the workspace with a default name. An existing test project with that name
+ * will be deleted and re-created.
+ */
+ public TestProject() throws CoreException {
+ this("Project-1");
+ }
+
+ /**
+ * This will create a new project with the given name inside the workspace. If this project already
+ * existed, it will be deleted and re-created.
+ *
+ * @param name
+ * Name of our project.
+ */
+ public TestProject(String name) throws CoreException {
+ final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name);
+ project = root.getProject(description.getName());
+ if (project.exists()) {
+ project.delete(true, true, new NullProgressMonitor());
+ }
+ project.create(description, new NullProgressMonitor());
+ project.open(new NullProgressMonitor());
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ /**
+ * Create or get a file for the given path.
+ *
+ * @param project
+ * Instance of project inside which a file will be created.
+ * @param path
+ * Project-relative path for the new file.
+ * @return Newly created file
+ */
+ public File getOrCreateFile(IProject aProject, String path) throws IOException {
+ String fullPath = aProject.getLocation().append(path).toOSString();
+ int lastSeparator = fullPath.lastIndexOf(File.separator);
+ mkdirs(new File(fullPath.substring(0, lastSeparator)), true);
+
+ File file = new File(fullPath);
+ if (!file.exists()) {
+ createNewFile(file);
+ }
+
+ return file;
+ }
+
+ /**
+ * Find an IFile corresponding to the given java.io.File within the given project.
+ *
+ * @param aProject
+ * The project within which we're searching for a file.
+ * @param file
+ * java.io.File for which we're searching a corresponding eclipse IFile.
+ * @return The IFile we found for the given file.
+ */
+ public IFile getIFile(IProject aProject, File file) throws CoreException {
+ IPath filePath = new Path(file.getAbsolutePath());
+ String relativePath = filePath.makeRelativeTo(aProject.getLocation()).toString();
+
+ String quotedProjectName = Pattern.quote(aProject.getName());
+ relativePath = relativePath.replaceFirst(quotedProjectName, "");
+
+ IFile iFile = aProject.getFile(relativePath);
+ iFile.refreshLocal(0, new NullProgressMonitor());
+
+ return iFile;
+ }
+
+ /**
+ * Creates the directory named by this abstract pathname, including any necessary but nonexistent parent
+ * directories. Note that if this operation fails it may have succeeded in creating some of the necessary
+ * parent directories.
+ *
+ * @param d
+ * directory to be created
+ * @param skipExisting
+ * if {@code true} skip creation of the given directory if it already exists in the file system
+ * @throws IOException
+ * if creation of {@code d} fails. This may occur if {@code d} did exist when the method was
+ * called. This can therefore cause IOExceptions during race conditions when multiple
+ * concurrent threads all try to create the same directory.
+ */
+ private static void mkdirs(final File d, boolean skipExisting) throws IOException {
+ if (!d.mkdirs()) {
+ if (skipExisting && d.isDirectory()) {
+ return;
+ }
+ }
+ }
+
+ private static void createNewFile(File f) throws IOException {
+ f.createNewFile();
+ }
+
+ public IFile createFile(String name, byte[] content) throws Exception {
+ IFile file = project.getFile(name);
+ InputStream inputStream = new ByteArrayInputStream(content);
+ file.create(inputStream, true, new NullProgressMonitor());
+
+ return file;
+ }
+
+ public IFolder createFolder(String name) throws Exception {
+ IFolder folder = project.getFolder(name);
+ folder.create(true, true, new NullProgressMonitor());
+
+ return folder;
+ }
+
+ public void dispose() throws CoreException, IOException {
+ if (project.exists()) {
+ project.delete(true, true, new NullProgressMonitor());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.tests/.project b/plugins/org.eclipse.emf.compare.tests/.project
index 436d6c947..10615551b 100644
--- a/plugins/org.eclipse.emf.compare.tests/.project
+++ b/plugins/org.eclipse.emf.compare.tests/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.emf.compare.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.compare.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.resources.prefs
index 4824b8026..99f26c020 100644
--- a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\r\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.jdt.ui.prefs
index 4517c0f23..4e1442ee9 100644
--- a/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.compare.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,60 +1,60 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_EMF Compare
-formatter_settings_version=12
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMF Compare
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=fr;com;java;javax;org;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.compare.tests/build.properties b/plugins/org.eclipse.emf.compare.tests/build.properties
index 395e6a4c0..94eb7bb2d 100644
--- a/plugins/org.eclipse.emf.compare.tests/build.properties
+++ b/plugins/org.eclipse.emf.compare.tests/build.properties
@@ -1,20 +1,20 @@
-# Copyright (c) 2011, 2012 Obeo.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Obeo - initial API and implementation
-
-bin.includes = .,\
- model/,\
- META-INF/,\
- plugin.xml,\
- plugin.properties,\
- about.html
-jars.compile.order = .
-source.. = src/,\
- src-gen/
-output.. = bin/
-src.includes = about.html
+# Copyright (c) 2011, 2012 Obeo.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/,\
+ src-gen/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel b/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
index 54e348a7d..f71641ec5 100644
--- a/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
+++ b/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
@@ -1,47 +1,47 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2011, 2012 Obeo.&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Obeo - initial API and implementation"
- modelDirectory="/org.eclipse.emf.compare.tests/src-gen" modelPluginID="org.eclipse.emf.compare.tests"
- modelName="Nodes" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
- containmentProxies="true" complianceLevel="5.0" runtimeVersion="2.4">
- <foreignModel>nodes.ecore</foreignModel>
- <genPackages prefix="Nodes" basePackage="org.eclipse.emf.compare.tests" resource="XMI"
- disposableProviderFactory="true" contentTypeIdentifier="org.eclipse.emf.compare.test.nodes.contenttype"
- ecorePackage="nodes.ecore#/">
- <genClasses ecoreClass="nodes.ecore#//Node">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//Node/name"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//Node/containmentRef1"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeMultipleContainment">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultipleContainment/containmentRef2"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultipleContainment/containmentRef3"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeSingleValueContainment">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeSingleValueContainment/singleValueContainment"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeSingleValueAttribute">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeSingleValueAttribute/singleValuedAttribute"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeMultiValuedAttribute">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeMultiValuedAttribute/multiValuedAttribute"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeSingleValueReference">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeSingleValueReference/singleValuedReference"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeMultiValueReference">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultiValueReference/multiValuedReference"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefOneToOne">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToOne/source"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToOne/destination"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefOneToMany">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToMany/source"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToMany/destination"/>
- </genClasses>
- <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefManyToMany">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/source"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/destination"/>
- </genClasses>
- </genPackages>
-</genmodel:GenModel>
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2011, 2012 Obeo.&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Obeo - initial API and implementation"
+ modelDirectory="/org.eclipse.emf.compare.tests/src-gen" modelPluginID="org.eclipse.emf.compare.tests"
+ modelName="Nodes" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ containmentProxies="true" complianceLevel="5.0" runtimeVersion="2.4">
+ <foreignModel>nodes.ecore</foreignModel>
+ <genPackages prefix="Nodes" basePackage="org.eclipse.emf.compare.tests" resource="XMI"
+ disposableProviderFactory="true" contentTypeIdentifier="org.eclipse.emf.compare.test.nodes.contenttype"
+ ecorePackage="nodes.ecore#/">
+ <genClasses ecoreClass="nodes.ecore#//Node">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//Node/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//Node/containmentRef1"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeMultipleContainment">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultipleContainment/containmentRef2"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultipleContainment/containmentRef3"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeSingleValueContainment">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeSingleValueContainment/singleValueContainment"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeSingleValueAttribute">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeSingleValueAttribute/singleValuedAttribute"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeMultiValuedAttribute">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeMultiValuedAttribute/multiValuedAttribute"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeSingleValueReference">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeSingleValueReference/singleValuedReference"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeMultiValueReference">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeMultiValueReference/multiValuedReference"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefOneToOne">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToOne/source"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToOne/destination"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefOneToMany">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToMany/source"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefOneToMany/destination"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeOppositeRefManyToMany">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/source"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/destination"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/org.eclipse.emf.compare.tests/plugin.xml b/plugins/org.eclipse.emf.compare.tests/plugin.xml
index 19422b1af..cff36fcb8 100644
--- a/plugins/org.eclipse.emf.compare.tests/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.tests/plugin.xml
@@ -1,44 +1,44 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<!--
- Copyright (c) 2011, 2012 Obeo.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Obeo - initial API and implementation
--->
-
-<plugin>
-
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
- uri="http://www.eclipse.org/emf/compare/tests/nodes"
- class="org.eclipse.emf.compare.tests.nodes.NodesPackage"
- genModel="model/nodes.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="nodes"
- class="org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl"/>
- </extension>
-
- <extension point="org.eclipse.core.contenttype.contentTypes">
- <content-type
- base-type="org.eclipse.emf.ecore.xmi"
- file-extensions="nodes"
- id="org.eclipse.emf.compare.test.nodes.contenttype"
- name="%_UI_Nodes_content_type"
- priority="normal">
- <describer class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer">
- <parameter name="namespace" value="http://www.eclipse.org/emf/compare/tests/nodes"/>
- <parameter name="kind" value="xmi"/>
- </describer>
- </content-type>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ Copyright (c) 2011, 2012 Obeo.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Obeo - initial API and implementation
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/compare/tests/nodes"
+ class="org.eclipse.emf.compare.tests.nodes.NodesPackage"
+ genModel="model/nodes.genmodel"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.extension_parser">
+ <parser
+ type="nodes"
+ class="org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl"/>
+ </extension>
+
+ <extension point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.emf.ecore.xmi"
+ file-extensions="nodes"
+ id="org.eclipse.emf.compare.test.nodes.contenttype"
+ name="%_UI_Nodes_content_type"
+ priority="normal">
+ <describer class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer">
+ <parameter name="namespace" value="http://www.eclipse.org/emf/compare/tests/nodes"/>
+ <parameter name="kind" value="xmi"/>
+ </describer>
+ </content-type>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.compare.tests/pom.xml b/plugins/org.eclipse.emf.compare.tests/pom.xml
index 611eb3398..8ac99ff98 100644
--- a/plugins/org.eclipse.emf.compare.tests/pom.xml
+++ b/plugins/org.eclipse.emf.compare.tests/pom.xml
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>emf.compare-parent</artifactId>
- <groupId>org.eclipse.emf.compare</groupId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
- </parent>
- <groupId>org.eclipse.emf.compare</groupId>
- <artifactId>org.eclipse.emf.compare.tests</artifactId>
- <version>3.1.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <build>
- <resources>
- <resource>
- <directory>src</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>src-gen</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>org/eclipse/emf/compare/tests/suite/AllTests.class</include>
- <!--
- <include>org/eclipse/emf/compare/tests/suite/AllPluginTests.class</include>
- -->
- </includes>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>emf.compare-parent</artifactId>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../../org.eclipse.emf.compare-parent</relativePath>
+ </parent>
+ <groupId>org.eclipse.emf.compare</groupId>
+ <artifactId>org.eclipse.emf.compare.tests</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src-gen</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>org/eclipse/emf/compare/tests/suite/AllTests.class</include>
+ <!--
+ <include>org/eclipse/emf/compare/tests/suite/AllPluginTests.class</include>
+ -->
+ </includes>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/Node.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/Node.java
index 717859577..0eac182ec 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/Node.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/Node.java
@@ -1,84 +1,84 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1 <em>Containment Ref1</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode()
- * @model
- * @generated
- */
-public interface Node extends EObject {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode_Name()
- * @model id="true"
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
- /**
- * Returns the value of the '<em><b>Containment Ref1</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Containment Ref1</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Containment Ref1</em>' containment reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode_ContainmentRef1()
- * @model containment="true" resolveProxies="true"
- * @generated
- */
- EList<Node> getContainmentRef1();
-
-} // Node
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1 <em>Containment Ref1</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode()
+ * @model
+ * @generated
+ */
+public interface Node extends EObject {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode_Name()
+ * @model id="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Containment Ref1</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Containment Ref1</em>' containment reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNode_ContainmentRef1()
+ * @model containment="true" resolveProxies="true"
+ * @generated
+ */
+ EList<Node> getContainmentRef1();
+
+} // Node
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValueReference.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValueReference.java
index b80791f8c..57d33c54e 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValueReference.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValueReference.java
@@ -1,55 +1,55 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Multi Value Reference</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference <em>Multi Valued Reference</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValueReference()
- * @model
- * @generated
- */
-public interface NodeMultiValueReference extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Multi Valued Reference</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Multi Valued Reference</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Multi Valued Reference</em>' reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValueReference_MultiValuedReference()
- * @model
- * @generated
- */
- EList<Node> getMultiValuedReference();
-
-} // NodeMultiValueReference
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Multi Value Reference</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference <em>Multi Valued Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValueReference()
+ * @model
+ * @generated
+ */
+public interface NodeMultiValueReference extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Multi Valued Reference</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Multi Valued Reference</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Multi Valued Reference</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValueReference_MultiValuedReference()
+ * @model
+ * @generated
+ */
+ EList<Node> getMultiValuedReference();
+
+} // NodeMultiValueReference
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValuedAttribute.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValuedAttribute.java
index 6486107b2..4a7eec1a7 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValuedAttribute.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultiValuedAttribute.java
@@ -1,55 +1,55 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Multi Valued Attribute</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute <em>Multi Valued Attribute</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValuedAttribute()
- * @model
- * @generated
- */
-public interface NodeMultiValuedAttribute extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Multi Valued Attribute</b></em>' attribute list.
- * The list contents are of type {@link java.lang.String}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Multi Valued Attribute</em>' attribute list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Multi Valued Attribute</em>' attribute list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValuedAttribute_MultiValuedAttribute()
- * @model
- * @generated
- */
- EList<String> getMultiValuedAttribute();
-
-} // NodeMultiValuedAttribute
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Multi Valued Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute <em>Multi Valued Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValuedAttribute()
+ * @model
+ * @generated
+ */
+public interface NodeMultiValuedAttribute extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Multi Valued Attribute</b></em>' attribute list.
+ * The list contents are of type {@link java.lang.String}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Multi Valued Attribute</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Multi Valued Attribute</em>' attribute list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultiValuedAttribute_MultiValuedAttribute()
+ * @model
+ * @generated
+ */
+ EList<String> getMultiValuedAttribute();
+
+} // NodeMultiValuedAttribute
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultipleContainment.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultipleContainment.java
index f0bfccd8e..64526dd40 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultipleContainment.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeMultipleContainment.java
@@ -1,72 +1,72 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Multiple Containment</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2 <em>Containment Ref2</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3 <em>Containment Ref3</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment()
- * @model
- * @generated
- */
-public interface NodeMultipleContainment extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Containment Ref2</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Containment Ref2</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Containment Ref2</em>' containment reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment_ContainmentRef2()
- * @model containment="true" resolveProxies="true"
- * @generated
- */
- EList<Node> getContainmentRef2();
-
- /**
- * Returns the value of the '<em><b>Containment Ref3</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Containment Ref3</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Containment Ref3</em>' containment reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment_ContainmentRef3()
- * @model containment="true" resolveProxies="true"
- * @generated
- */
- EList<Node> getContainmentRef3();
-
-} // NodeMultipleContainment
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Multiple Containment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2 <em>Containment Ref2</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3 <em>Containment Ref3</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment()
+ * @model
+ * @generated
+ */
+public interface NodeMultipleContainment extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Containment Ref2</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Containment Ref2</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Containment Ref2</em>' containment reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment_ContainmentRef2()
+ * @model containment="true" resolveProxies="true"
+ * @generated
+ */
+ EList<Node> getContainmentRef2();
+
+ /**
+ * Returns the value of the '<em><b>Containment Ref3</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Containment Ref3</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Containment Ref3</em>' containment reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeMultipleContainment_ContainmentRef3()
+ * @model containment="true" resolveProxies="true"
+ * @generated
+ */
+ EList<Node> getContainmentRef3();
+
+} // NodeMultipleContainment
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefManyToMany.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefManyToMany.java
index 6c50342ef..836a13a92 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefManyToMany.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefManyToMany.java
@@ -1,76 +1,76 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Opposite Ref Many To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany()
- * @model
- * @generated
- */
-public interface NodeOppositeRefManyToMany extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Source</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany}.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Source</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Source</em>' reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany_Source()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination
- * @model opposite="destination"
- * @generated
- */
- EList<NodeOppositeRefManyToMany> getSource();
-
- /**
- * Returns the value of the '<em><b>Destination</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany}.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Destination</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Destination</em>' reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany_Destination()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource
- * @model opposite="source"
- * @generated
- */
- EList<NodeOppositeRefManyToMany> getDestination();
-
-} // NodeOppositeRefManyToMany
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Opposite Ref Many To Many</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany()
+ * @model
+ * @generated
+ */
+public interface NodeOppositeRefManyToMany extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Source</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Source</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Source</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany_Source()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination
+ * @model opposite="destination"
+ * @generated
+ */
+ EList<NodeOppositeRefManyToMany> getSource();
+
+ /**
+ * Returns the value of the '<em><b>Destination</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Destination</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Destination</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefManyToMany_Destination()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource
+ * @model opposite="source"
+ * @generated
+ */
+ EList<NodeOppositeRefManyToMany> getDestination();
+
+} // NodeOppositeRefManyToMany
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToMany.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToMany.java
index fb4c0e498..ce511a572 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToMany.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToMany.java
@@ -1,86 +1,86 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Opposite Ref One To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany()
- * @model
- * @generated
- */
-public interface NodeOppositeRefOneToMany extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Source</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Source</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Source</em>' reference.
- * @see #setSource(NodeOppositeRefOneToMany)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany_Source()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination
- * @model opposite="destination"
- * @generated
- */
- NodeOppositeRefOneToMany getSource();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Source</em>' reference.
- * @see #getSource()
- * @generated
- */
- void setSource(NodeOppositeRefOneToMany value);
-
- /**
- * Returns the value of the '<em><b>Destination</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany}.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Destination</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Destination</em>' reference list.
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany_Destination()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource
- * @model opposite="source"
- * @generated
- */
- EList<NodeOppositeRefOneToMany> getDestination();
-
-} // NodeOppositeRefOneToMany
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Opposite Ref One To Many</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany()
+ * @model
+ * @generated
+ */
+public interface NodeOppositeRefOneToMany extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Source</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Source</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Source</em>' reference.
+ * @see #setSource(NodeOppositeRefOneToMany)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany_Source()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination
+ * @model opposite="destination"
+ * @generated
+ */
+ NodeOppositeRefOneToMany getSource();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Source</em>' reference.
+ * @see #getSource()
+ * @generated
+ */
+ void setSource(NodeOppositeRefOneToMany value);
+
+ /**
+ * Returns the value of the '<em><b>Destination</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Destination</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Destination</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToMany_Destination()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource
+ * @model opposite="source"
+ * @generated
+ */
+ EList<NodeOppositeRefOneToMany> getDestination();
+
+} // NodeOppositeRefOneToMany
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToOne.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToOne.java
index faf5541f3..4531296b1 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToOne.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeOppositeRefOneToOne.java
@@ -1,95 +1,95 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Opposite Ref One To One</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne()
- * @model
- * @generated
- */
-public interface NodeOppositeRefOneToOne extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Source</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Source</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Source</em>' reference.
- * @see #setSource(NodeOppositeRefOneToOne)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne_Source()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination
- * @model opposite="destination"
- * @generated
- */
- NodeOppositeRefOneToOne getSource();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Source</em>' reference.
- * @see #getSource()
- * @generated
- */
- void setSource(NodeOppositeRefOneToOne value);
-
- /**
- * Returns the value of the '<em><b>Destination</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Destination</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Destination</em>' reference.
- * @see #setDestination(NodeOppositeRefOneToOne)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne_Destination()
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource
- * @model opposite="source"
- * @generated
- */
- NodeOppositeRefOneToOne getDestination();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Destination</em>' reference.
- * @see #getDestination()
- * @generated
- */
- void setDestination(NodeOppositeRefOneToOne value);
-
-} // NodeOppositeRefOneToOne
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Opposite Ref One To One</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne()
+ * @model
+ * @generated
+ */
+public interface NodeOppositeRefOneToOne extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Source</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Source</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Source</em>' reference.
+ * @see #setSource(NodeOppositeRefOneToOne)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne_Source()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination
+ * @model opposite="destination"
+ * @generated
+ */
+ NodeOppositeRefOneToOne getSource();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Source</em>' reference.
+ * @see #getSource()
+ * @generated
+ */
+ void setSource(NodeOppositeRefOneToOne value);
+
+ /**
+ * Returns the value of the '<em><b>Destination</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Destination</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Destination</em>' reference.
+ * @see #setDestination(NodeOppositeRefOneToOne)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeOppositeRefOneToOne_Destination()
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource
+ * @model opposite="source"
+ * @generated
+ */
+ NodeOppositeRefOneToOne getDestination();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Destination</em>' reference.
+ * @see #getDestination()
+ * @generated
+ */
+ void setDestination(NodeOppositeRefOneToOne value);
+
+} // NodeOppositeRefOneToOne
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueAttribute.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueAttribute.java
index c5b7d5898..7a4942d02 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueAttribute.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueAttribute.java
@@ -1,64 +1,64 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Single Value Attribute</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueAttribute()
- * @model
- * @generated
- */
-public interface NodeSingleValueAttribute extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Single Valued Attribute</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Single Valued Attribute</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Single Valued Attribute</em>' attribute.
- * @see #setSingleValuedAttribute(String)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueAttribute_SingleValuedAttribute()
- * @model
- * @generated
- */
- String getSingleValuedAttribute();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Single Valued Attribute</em>' attribute.
- * @see #getSingleValuedAttribute()
- * @generated
- */
- void setSingleValuedAttribute(String value);
-
-} // NodeSingleValueAttribute
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Single Value Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueAttribute()
+ * @model
+ * @generated
+ */
+public interface NodeSingleValueAttribute extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Single Valued Attribute</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Single Valued Attribute</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Single Valued Attribute</em>' attribute.
+ * @see #setSingleValuedAttribute(String)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueAttribute_SingleValuedAttribute()
+ * @model
+ * @generated
+ */
+ String getSingleValuedAttribute();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Single Valued Attribute</em>' attribute.
+ * @see #getSingleValuedAttribute()
+ * @generated
+ */
+ void setSingleValuedAttribute(String value);
+
+} // NodeSingleValueAttribute
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueContainment.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueContainment.java
index dd737a843..11c04755e 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueContainment.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueContainment.java
@@ -1,64 +1,64 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Single Value Containment</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueContainment()
- * @model
- * @generated
- */
-public interface NodeSingleValueContainment extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Single Value Containment</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Single Value Containment</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Single Value Containment</em>' containment reference.
- * @see #setSingleValueContainment(Node)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueContainment_SingleValueContainment()
- * @model containment="true" resolveProxies="true"
- * @generated
- */
- Node getSingleValueContainment();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Single Value Containment</em>' containment reference.
- * @see #getSingleValueContainment()
- * @generated
- */
- void setSingleValueContainment(Node value);
-
-} // NodeSingleValueContainment
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Single Value Containment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueContainment()
+ * @model
+ * @generated
+ */
+public interface NodeSingleValueContainment extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Single Value Containment</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Single Value Containment</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Single Value Containment</em>' containment reference.
+ * @see #setSingleValueContainment(Node)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueContainment_SingleValueContainment()
+ * @model containment="true" resolveProxies="true"
+ * @generated
+ */
+ Node getSingleValueContainment();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Single Value Containment</em>' containment reference.
+ * @see #getSingleValueContainment()
+ * @generated
+ */
+ void setSingleValueContainment(Node value);
+
+} // NodeSingleValueContainment
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueReference.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueReference.java
index e19bbb34f..598afc863 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueReference.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeSingleValueReference.java
@@ -1,64 +1,64 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Node Single Value Reference</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueReference()
- * @model
- * @generated
- */
-public interface NodeSingleValueReference extends Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Returns the value of the '<em><b>Single Valued Reference</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Single Valued Reference</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Single Valued Reference</em>' reference.
- * @see #setSingleValuedReference(Node)
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueReference_SingleValuedReference()
- * @model
- * @generated
- */
- Node getSingleValuedReference();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Single Valued Reference</em>' reference.
- * @see #getSingleValuedReference()
- * @generated
- */
- void setSingleValuedReference(Node value);
-
-} // NodeSingleValueReference
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Single Value Reference</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueReference()
+ * @model
+ * @generated
+ */
+public interface NodeSingleValueReference extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Single Valued Reference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Single Valued Reference</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Single Valued Reference</em>' reference.
+ * @see #setSingleValuedReference(Node)
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeSingleValueReference_SingleValuedReference()
+ * @model
+ * @generated
+ */
+ Node getSingleValuedReference();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Single Valued Reference</em>' reference.
+ * @see #getSingleValuedReference()
+ * @generated
+ */
+ void setSingleValuedReference(Node value);
+
+} // NodeSingleValueReference
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
index ebb370ccf..00e88b927 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
@@ -1,138 +1,138 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
- * @generated
- */
-public interface NodesFactory extends EFactory {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- NodesFactory eINSTANCE = org.eclipse.emf.compare.tests.nodes.impl.NodesFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>Node</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node</em>'.
- * @generated
- */
- Node createNode();
-
- /**
- * Returns a new object of class '<em>Node Multiple Containment</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Multiple Containment</em>'.
- * @generated
- */
- NodeMultipleContainment createNodeMultipleContainment();
-
- /**
- * Returns a new object of class '<em>Node Single Value Containment</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Single Value Containment</em>'.
- * @generated
- */
- NodeSingleValueContainment createNodeSingleValueContainment();
-
- /**
- * Returns a new object of class '<em>Node Single Value Attribute</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Single Value Attribute</em>'.
- * @generated
- */
- NodeSingleValueAttribute createNodeSingleValueAttribute();
-
- /**
- * Returns a new object of class '<em>Node Multi Valued Attribute</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Multi Valued Attribute</em>'.
- * @generated
- */
- NodeMultiValuedAttribute createNodeMultiValuedAttribute();
-
- /**
- * Returns a new object of class '<em>Node Single Value Reference</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Single Value Reference</em>'.
- * @generated
- */
- NodeSingleValueReference createNodeSingleValueReference();
-
- /**
- * Returns a new object of class '<em>Node Multi Value Reference</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Multi Value Reference</em>'.
- * @generated
- */
- NodeMultiValueReference createNodeMultiValueReference();
-
- /**
- * Returns a new object of class '<em>Node Opposite Ref One To One</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Opposite Ref One To One</em>'.
- * @generated
- */
- NodeOppositeRefOneToOne createNodeOppositeRefOneToOne();
-
- /**
- * Returns a new object of class '<em>Node Opposite Ref One To Many</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Opposite Ref One To Many</em>'.
- * @generated
- */
- NodeOppositeRefOneToMany createNodeOppositeRefOneToMany();
-
- /**
- * Returns a new object of class '<em>Node Opposite Ref Many To Many</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Node Opposite Ref Many To Many</em>'.
- * @generated
- */
- NodeOppositeRefManyToMany createNodeOppositeRefManyToMany();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- NodesPackage getNodesPackage();
-
-} //NodesFactory
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
+ * @generated
+ */
+public interface NodesFactory extends EFactory {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ NodesFactory eINSTANCE = org.eclipse.emf.compare.tests.nodes.impl.NodesFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Node</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node</em>'.
+ * @generated
+ */
+ Node createNode();
+
+ /**
+ * Returns a new object of class '<em>Node Multiple Containment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Multiple Containment</em>'.
+ * @generated
+ */
+ NodeMultipleContainment createNodeMultipleContainment();
+
+ /**
+ * Returns a new object of class '<em>Node Single Value Containment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Single Value Containment</em>'.
+ * @generated
+ */
+ NodeSingleValueContainment createNodeSingleValueContainment();
+
+ /**
+ * Returns a new object of class '<em>Node Single Value Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Single Value Attribute</em>'.
+ * @generated
+ */
+ NodeSingleValueAttribute createNodeSingleValueAttribute();
+
+ /**
+ * Returns a new object of class '<em>Node Multi Valued Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Multi Valued Attribute</em>'.
+ * @generated
+ */
+ NodeMultiValuedAttribute createNodeMultiValuedAttribute();
+
+ /**
+ * Returns a new object of class '<em>Node Single Value Reference</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Single Value Reference</em>'.
+ * @generated
+ */
+ NodeSingleValueReference createNodeSingleValueReference();
+
+ /**
+ * Returns a new object of class '<em>Node Multi Value Reference</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Multi Value Reference</em>'.
+ * @generated
+ */
+ NodeMultiValueReference createNodeMultiValueReference();
+
+ /**
+ * Returns a new object of class '<em>Node Opposite Ref One To One</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Opposite Ref One To One</em>'.
+ * @generated
+ */
+ NodeOppositeRefOneToOne createNodeOppositeRefOneToOne();
+
+ /**
+ * Returns a new object of class '<em>Node Opposite Ref One To Many</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Opposite Ref One To Many</em>'.
+ * @generated
+ */
+ NodeOppositeRefOneToMany createNodeOppositeRefOneToMany();
+
+ /**
+ * Returns a new object of class '<em>Node Opposite Ref Many To Many</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Opposite Ref Many To Many</em>'.
+ * @generated
+ */
+ NodeOppositeRefManyToMany createNodeOppositeRefManyToMany();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ NodesPackage getNodesPackage();
+
+} //NodesFactory
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
index 31e34093f..d5d0bff03 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
@@ -1,1080 +1,1080 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.NodesFactory
- * @model kind="package"
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public interface NodesPackage extends EPackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "nodes"; //$NON-NLS-1$
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "http://www.eclipse.org/emf/compare/tests/nodes"; //$NON-NLS-1$
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "nodes"; //$NON-NLS-1$
-
- /**
- * The package content type ID.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eCONTENT_TYPE = "org.eclipse.emf.compare.test.nodes.contenttype"; //$NON-NLS-1$
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- NodesPackage eINSTANCE = org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl <em>Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNode()
- * @generated
- */
- int NODE = 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE__NAME = 0;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE__CONTAINMENT_REF1 = 1;
-
- /**
- * The number of structural features of the '<em>Node</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl <em>Node Multiple Containment</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultipleContainment()
- * @generated
- */
- int NODE_MULTIPLE_CONTAINMENT = 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTIPLE_CONTAINMENT__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Containment Ref2</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2 = NODE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Containment Ref3</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3 = NODE_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Node Multiple Containment</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTIPLE_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl <em>Node Single Value Containment</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueContainment()
- * @generated
- */
- int NODE_SINGLE_VALUE_CONTAINMENT = 2;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_CONTAINMENT__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Single Value Containment</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT = NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Node Single Value Containment</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl <em>Node Single Value Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueAttribute()
- * @generated
- */
- int NODE_SINGLE_VALUE_ATTRIBUTE = 3;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_ATTRIBUTE__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_ATTRIBUTE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Single Valued Attribute</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Node Single Value Attribute</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_ATTRIBUTE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl <em>Node Multi Valued Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValuedAttribute()
- * @generated
- */
- int NODE_MULTI_VALUED_ATTRIBUTE = 4;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUED_ATTRIBUTE__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUED_ATTRIBUTE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Multi Valued Attribute</b></em>' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Node Multi Valued Attribute</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUED_ATTRIBUTE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl <em>Node Single Value Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueReference()
- * @generated
- */
- int NODE_SINGLE_VALUE_REFERENCE = 5;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_REFERENCE__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_REFERENCE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Single Valued Reference</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Node Single Value Reference</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_SINGLE_VALUE_REFERENCE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl <em>Node Multi Value Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValueReference()
- * @generated
- */
- int NODE_MULTI_VALUE_REFERENCE = 6;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUE_REFERENCE__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUE_REFERENCE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Multi Valued Reference</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Node Multi Value Reference</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_MULTI_VALUE_REFERENCE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
-
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl <em>Node Opposite Ref One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToOne()
- * @generated
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE = 7;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Source</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Destination</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION = NODE_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Node Opposite Ref One To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_ONE_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl <em>Node Opposite Ref One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToMany()
- * @generated
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY = 8;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Source</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Destination</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION = NODE_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Node Opposite Ref One To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_ONE_TO_MANY_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl <em>Node Opposite Ref Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefManyToMany()
- * @generated
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY = 9;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY__NAME = NODE__NAME;
-
- /**
- * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
-
- /**
- * The feature id for the '<em><b>Source</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE = NODE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Destination</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION = NODE_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Node Opposite Ref Many To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int NODE_OPPOSITE_REF_MANY_TO_MANY_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.Node <em>Node</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.Node
- * @generated
- */
- EClass getNode();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.Node#getName()
- * @see #getNode()
- * @generated
- */
- EAttribute getNode_Name();
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1 <em>Containment Ref1</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Containment Ref1</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1()
- * @see #getNode()
- * @generated
- */
- EReference getNode_ContainmentRef1();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment <em>Node Multiple Containment</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Multiple Containment</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment
- * @generated
- */
- EClass getNodeMultipleContainment();
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2 <em>Containment Ref2</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Containment Ref2</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2()
- * @see #getNodeMultipleContainment()
- * @generated
- */
- EReference getNodeMultipleContainment_ContainmentRef2();
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3 <em>Containment Ref3</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Containment Ref3</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3()
- * @see #getNodeMultipleContainment()
- * @generated
- */
- EReference getNodeMultipleContainment_ContainmentRef3();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment <em>Node Single Value Containment</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Single Value Containment</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment
- * @generated
- */
- EClass getNodeSingleValueContainment();
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Single Value Containment</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment()
- * @see #getNodeSingleValueContainment()
- * @generated
- */
- EReference getNodeSingleValueContainment_SingleValueContainment();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute <em>Node Single Value Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Single Value Attribute</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute
- * @generated
- */
- EClass getNodeSingleValueAttribute();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Single Valued Attribute</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute()
- * @see #getNodeSingleValueAttribute()
- * @generated
- */
- EAttribute getNodeSingleValueAttribute_SingleValuedAttribute();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute <em>Node Multi Valued Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Multi Valued Attribute</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute
- * @generated
- */
- EClass getNodeMultiValuedAttribute();
-
- /**
- * Returns the meta object for the attribute list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute <em>Multi Valued Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute list '<em>Multi Valued Attribute</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute()
- * @see #getNodeMultiValuedAttribute()
- * @generated
- */
- EAttribute getNodeMultiValuedAttribute_MultiValuedAttribute();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference <em>Node Single Value Reference</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Single Value Reference</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference
- * @generated
- */
- EClass getNodeSingleValueReference();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Single Valued Reference</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference()
- * @see #getNodeSingleValueReference()
- * @generated
- */
- EReference getNodeSingleValueReference_SingleValuedReference();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference <em>Node Multi Value Reference</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Multi Value Reference</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference
- * @generated
- */
- EClass getNodeMultiValueReference();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference <em>Multi Valued Reference</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Multi Valued Reference</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference()
- * @see #getNodeMultiValueReference()
- * @generated
- */
- EReference getNodeMultiValueReference_MultiValuedReference();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne <em>Node Opposite Ref One To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Opposite Ref One To One</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne
- * @generated
- */
- EClass getNodeOppositeRefOneToOne();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Source</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource()
- * @see #getNodeOppositeRefOneToOne()
- * @generated
- */
- EReference getNodeOppositeRefOneToOne_Source();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Destination</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination()
- * @see #getNodeOppositeRefOneToOne()
- * @generated
- */
- EReference getNodeOppositeRefOneToOne_Destination();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany <em>Node Opposite Ref One To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Opposite Ref One To Many</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany
- * @generated
- */
- EClass getNodeOppositeRefOneToMany();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Source</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource()
- * @see #getNodeOppositeRefOneToMany()
- * @generated
- */
- EReference getNodeOppositeRefOneToMany_Source();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Destination</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination()
- * @see #getNodeOppositeRefOneToMany()
- * @generated
- */
- EReference getNodeOppositeRefOneToMany_Destination();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany <em>Node Opposite Ref Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Node Opposite Ref Many To Many</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany
- * @generated
- */
- EClass getNodeOppositeRefManyToMany();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Source</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource()
- * @see #getNodeOppositeRefManyToMany()
- * @generated
- */
- EReference getNodeOppositeRefManyToMany_Source();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Destination</em>'.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination()
- * @see #getNodeOppositeRefManyToMany()
- * @generated
- */
- EReference getNodeOppositeRefManyToMany_Destination();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- NodesFactory getNodesFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl <em>Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNode()
- * @generated
- */
- EClass NODE = eINSTANCE.getNode();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute NODE__NAME = eINSTANCE.getNode_Name();
-
- /**
- * The meta object literal for the '<em><b>Containment Ref1</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE__CONTAINMENT_REF1 = eINSTANCE.getNode_ContainmentRef1();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl <em>Node Multiple Containment</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultipleContainment()
- * @generated
- */
- EClass NODE_MULTIPLE_CONTAINMENT = eINSTANCE.getNodeMultipleContainment();
-
- /**
- * The meta object literal for the '<em><b>Containment Ref2</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2 = eINSTANCE.getNodeMultipleContainment_ContainmentRef2();
-
- /**
- * The meta object literal for the '<em><b>Containment Ref3</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3 = eINSTANCE.getNodeMultipleContainment_ContainmentRef3();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl <em>Node Single Value Containment</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueContainment()
- * @generated
- */
- EClass NODE_SINGLE_VALUE_CONTAINMENT = eINSTANCE.getNodeSingleValueContainment();
-
- /**
- * The meta object literal for the '<em><b>Single Value Containment</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT = eINSTANCE.getNodeSingleValueContainment_SingleValueContainment();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl <em>Node Single Value Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueAttribute()
- * @generated
- */
- EClass NODE_SINGLE_VALUE_ATTRIBUTE = eINSTANCE.getNodeSingleValueAttribute();
-
- /**
- * The meta object literal for the '<em><b>Single Valued Attribute</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE = eINSTANCE.getNodeSingleValueAttribute_SingleValuedAttribute();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl <em>Node Multi Valued Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValuedAttribute()
- * @generated
- */
- EClass NODE_MULTI_VALUED_ATTRIBUTE = eINSTANCE.getNodeMultiValuedAttribute();
-
- /**
- * The meta object literal for the '<em><b>Multi Valued Attribute</b></em>' attribute list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE = eINSTANCE.getNodeMultiValuedAttribute_MultiValuedAttribute();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl <em>Node Single Value Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueReference()
- * @generated
- */
- EClass NODE_SINGLE_VALUE_REFERENCE = eINSTANCE.getNodeSingleValueReference();
-
- /**
- * The meta object literal for the '<em><b>Single Valued Reference</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE = eINSTANCE.getNodeSingleValueReference_SingleValuedReference();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl <em>Node Multi Value Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValueReference()
- * @generated
- */
- EClass NODE_MULTI_VALUE_REFERENCE = eINSTANCE.getNodeMultiValueReference();
-
- /**
- * The meta object literal for the '<em><b>Multi Valued Reference</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE = eINSTANCE.getNodeMultiValueReference_MultiValuedReference();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl <em>Node Opposite Ref One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToOne()
- * @generated
- */
- EClass NODE_OPPOSITE_REF_ONE_TO_ONE = eINSTANCE.getNodeOppositeRefOneToOne();
-
- /**
- * The meta object literal for the '<em><b>Source</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE = eINSTANCE.getNodeOppositeRefOneToOne_Source();
-
- /**
- * The meta object literal for the '<em><b>Destination</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION = eINSTANCE.getNodeOppositeRefOneToOne_Destination();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl <em>Node Opposite Ref One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToMany()
- * @generated
- */
- EClass NODE_OPPOSITE_REF_ONE_TO_MANY = eINSTANCE.getNodeOppositeRefOneToMany();
-
- /**
- * The meta object literal for the '<em><b>Source</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE = eINSTANCE.getNodeOppositeRefOneToMany_Source();
-
- /**
- * The meta object literal for the '<em><b>Destination</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION = eINSTANCE.getNodeOppositeRefOneToMany_Destination();
-
- /**
- * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl <em>Node Opposite Ref Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl
- * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefManyToMany()
- * @generated
- */
- EClass NODE_OPPOSITE_REF_MANY_TO_MANY = eINSTANCE.getNodeOppositeRefManyToMany();
-
- /**
- * The meta object literal for the '<em><b>Source</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE = eINSTANCE.getNodeOppositeRefManyToMany_Source();
-
- /**
- * The meta object literal for the '<em><b>Destination</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION = eINSTANCE.getNodeOppositeRefManyToMany_Destination();
-
- }
-
-} //NodesPackage
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.NodesFactory
+ * @model kind="package"
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public interface NodesPackage extends EPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "nodes"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/compare/tests/nodes"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "nodes"; //$NON-NLS-1$
+
+ /**
+ * The package content type ID.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eCONTENT_TYPE = "org.eclipse.emf.compare.test.nodes.contenttype"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ NodesPackage eINSTANCE = org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl <em>Node</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNode()
+ * @generated
+ */
+ int NODE = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE__CONTAINMENT_REF1 = 1;
+
+ /**
+ * The number of structural features of the '<em>Node</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl <em>Node Multiple Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultipleContainment()
+ * @generated
+ */
+ int NODE_MULTIPLE_CONTAINMENT = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTIPLE_CONTAINMENT__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref2</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2 = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref3</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3 = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Node Multiple Containment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTIPLE_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl <em>Node Single Value Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueContainment()
+ * @generated
+ */
+ int NODE_SINGLE_VALUE_CONTAINMENT = 2;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_CONTAINMENT__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Single Value Containment</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Node Single Value Containment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl <em>Node Single Value Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueAttribute()
+ * @generated
+ */
+ int NODE_SINGLE_VALUE_ATTRIBUTE = 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_ATTRIBUTE__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_ATTRIBUTE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Single Valued Attribute</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Node Single Value Attribute</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_ATTRIBUTE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl <em>Node Multi Valued Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValuedAttribute()
+ * @generated
+ */
+ int NODE_MULTI_VALUED_ATTRIBUTE = 4;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUED_ATTRIBUTE__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUED_ATTRIBUTE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Multi Valued Attribute</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Node Multi Valued Attribute</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUED_ATTRIBUTE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl <em>Node Single Value Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueReference()
+ * @generated
+ */
+ int NODE_SINGLE_VALUE_REFERENCE = 5;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_REFERENCE__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_REFERENCE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Single Valued Reference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Node Single Value Reference</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_SINGLE_VALUE_REFERENCE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl <em>Node Multi Value Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValueReference()
+ * @generated
+ */
+ int NODE_MULTI_VALUE_REFERENCE = 6;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUE_REFERENCE__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUE_REFERENCE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Multi Valued Reference</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Node Multi Value Reference</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_MULTI_VALUE_REFERENCE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl <em>Node Opposite Ref One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToOne()
+ * @generated
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE = 7;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Source</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Destination</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Node Opposite Ref One To One</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_ONE_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl <em>Node Opposite Ref One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToMany()
+ * @generated
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY = 8;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Source</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Destination</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Node Opposite Ref One To Many</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_ONE_TO_MANY_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl <em>Node Opposite Ref Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefManyToMany()
+ * @generated
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY = 9;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Source</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Destination</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Node Opposite Ref Many To Many</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_OPPOSITE_REF_MANY_TO_MANY_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.Node <em>Node</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.Node
+ * @generated
+ */
+ EClass getNode();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.compare.tests.nodes.Node#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.Node#getName()
+ * @see #getNode()
+ * @generated
+ */
+ EAttribute getNode_Name();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1 <em>Containment Ref1</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Containment Ref1</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.Node#getContainmentRef1()
+ * @see #getNode()
+ * @generated
+ */
+ EReference getNode_ContainmentRef1();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment <em>Node Multiple Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Multiple Containment</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment
+ * @generated
+ */
+ EClass getNodeMultipleContainment();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2 <em>Containment Ref2</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Containment Ref2</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef2()
+ * @see #getNodeMultipleContainment()
+ * @generated
+ */
+ EReference getNodeMultipleContainment_ContainmentRef2();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3 <em>Containment Ref3</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Containment Ref3</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment#getContainmentRef3()
+ * @see #getNodeMultipleContainment()
+ * @generated
+ */
+ EReference getNodeMultipleContainment_ContainmentRef3();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment <em>Node Single Value Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Single Value Containment</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment
+ * @generated
+ */
+ EClass getNodeSingleValueContainment();
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment <em>Single Value Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Single Value Containment</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment#getSingleValueContainment()
+ * @see #getNodeSingleValueContainment()
+ * @generated
+ */
+ EReference getNodeSingleValueContainment_SingleValueContainment();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute <em>Node Single Value Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Single Value Attribute</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute
+ * @generated
+ */
+ EClass getNodeSingleValueAttribute();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute <em>Single Valued Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Single Valued Attribute</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute#getSingleValuedAttribute()
+ * @see #getNodeSingleValueAttribute()
+ * @generated
+ */
+ EAttribute getNodeSingleValueAttribute_SingleValuedAttribute();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute <em>Node Multi Valued Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Multi Valued Attribute</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute
+ * @generated
+ */
+ EClass getNodeMultiValuedAttribute();
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute <em>Multi Valued Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Multi Valued Attribute</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute#getMultiValuedAttribute()
+ * @see #getNodeMultiValuedAttribute()
+ * @generated
+ */
+ EAttribute getNodeMultiValuedAttribute_MultiValuedAttribute();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference <em>Node Single Value Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Single Value Reference</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference
+ * @generated
+ */
+ EClass getNodeSingleValueReference();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference <em>Single Valued Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Single Valued Reference</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference#getSingleValuedReference()
+ * @see #getNodeSingleValueReference()
+ * @generated
+ */
+ EReference getNodeSingleValueReference_SingleValuedReference();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference <em>Node Multi Value Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Multi Value Reference</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference
+ * @generated
+ */
+ EClass getNodeMultiValueReference();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference <em>Multi Valued Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Multi Valued Reference</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference#getMultiValuedReference()
+ * @see #getNodeMultiValueReference()
+ * @generated
+ */
+ EReference getNodeMultiValueReference_MultiValuedReference();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne <em>Node Opposite Ref One To One</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Opposite Ref One To One</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne
+ * @generated
+ */
+ EClass getNodeOppositeRefOneToOne();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Source</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getSource()
+ * @see #getNodeOppositeRefOneToOne()
+ * @generated
+ */
+ EReference getNodeOppositeRefOneToOne_Source();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Destination</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne#getDestination()
+ * @see #getNodeOppositeRefOneToOne()
+ * @generated
+ */
+ EReference getNodeOppositeRefOneToOne_Destination();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany <em>Node Opposite Ref One To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Opposite Ref One To Many</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany
+ * @generated
+ */
+ EClass getNodeOppositeRefOneToMany();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Source</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getSource()
+ * @see #getNodeOppositeRefOneToMany()
+ * @generated
+ */
+ EReference getNodeOppositeRefOneToMany_Source();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Destination</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany#getDestination()
+ * @see #getNodeOppositeRefOneToMany()
+ * @generated
+ */
+ EReference getNodeOppositeRefOneToMany_Destination();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany <em>Node Opposite Ref Many To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Opposite Ref Many To Many</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany
+ * @generated
+ */
+ EClass getNodeOppositeRefManyToMany();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource <em>Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Source</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getSource()
+ * @see #getNodeOppositeRefManyToMany()
+ * @generated
+ */
+ EReference getNodeOppositeRefManyToMany_Source();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination <em>Destination</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Destination</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany#getDestination()
+ * @see #getNodeOppositeRefManyToMany()
+ * @generated
+ */
+ EReference getNodeOppositeRefManyToMany_Destination();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ NodesFactory getNodesFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl <em>Node</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNode()
+ * @generated
+ */
+ EClass NODE = eINSTANCE.getNode();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NODE__NAME = eINSTANCE.getNode_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Containment Ref1</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE__CONTAINMENT_REF1 = eINSTANCE.getNode_ContainmentRef1();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl <em>Node Multiple Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultipleContainment()
+ * @generated
+ */
+ EClass NODE_MULTIPLE_CONTAINMENT = eINSTANCE.getNodeMultipleContainment();
+
+ /**
+ * The meta object literal for the '<em><b>Containment Ref2</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2 = eINSTANCE.getNodeMultipleContainment_ContainmentRef2();
+
+ /**
+ * The meta object literal for the '<em><b>Containment Ref3</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3 = eINSTANCE.getNodeMultipleContainment_ContainmentRef3();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl <em>Node Single Value Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueContainment()
+ * @generated
+ */
+ EClass NODE_SINGLE_VALUE_CONTAINMENT = eINSTANCE.getNodeSingleValueContainment();
+
+ /**
+ * The meta object literal for the '<em><b>Single Value Containment</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT = eINSTANCE.getNodeSingleValueContainment_SingleValueContainment();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl <em>Node Single Value Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueAttribute()
+ * @generated
+ */
+ EClass NODE_SINGLE_VALUE_ATTRIBUTE = eINSTANCE.getNodeSingleValueAttribute();
+
+ /**
+ * The meta object literal for the '<em><b>Single Valued Attribute</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE = eINSTANCE.getNodeSingleValueAttribute_SingleValuedAttribute();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl <em>Node Multi Valued Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValuedAttribute()
+ * @generated
+ */
+ EClass NODE_MULTI_VALUED_ATTRIBUTE = eINSTANCE.getNodeMultiValuedAttribute();
+
+ /**
+ * The meta object literal for the '<em><b>Multi Valued Attribute</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE = eINSTANCE.getNodeMultiValuedAttribute_MultiValuedAttribute();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl <em>Node Single Value Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeSingleValueReference()
+ * @generated
+ */
+ EClass NODE_SINGLE_VALUE_REFERENCE = eINSTANCE.getNodeSingleValueReference();
+
+ /**
+ * The meta object literal for the '<em><b>Single Valued Reference</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE = eINSTANCE.getNodeSingleValueReference_SingleValuedReference();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl <em>Node Multi Value Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeMultiValueReference()
+ * @generated
+ */
+ EClass NODE_MULTI_VALUE_REFERENCE = eINSTANCE.getNodeMultiValueReference();
+
+ /**
+ * The meta object literal for the '<em><b>Multi Valued Reference</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE = eINSTANCE.getNodeMultiValueReference_MultiValuedReference();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl <em>Node Opposite Ref One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToOne()
+ * @generated
+ */
+ EClass NODE_OPPOSITE_REF_ONE_TO_ONE = eINSTANCE.getNodeOppositeRefOneToOne();
+
+ /**
+ * The meta object literal for the '<em><b>Source</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE = eINSTANCE.getNodeOppositeRefOneToOne_Source();
+
+ /**
+ * The meta object literal for the '<em><b>Destination</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION = eINSTANCE.getNodeOppositeRefOneToOne_Destination();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl <em>Node Opposite Ref One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefOneToMany()
+ * @generated
+ */
+ EClass NODE_OPPOSITE_REF_ONE_TO_MANY = eINSTANCE.getNodeOppositeRefOneToMany();
+
+ /**
+ * The meta object literal for the '<em><b>Source</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE = eINSTANCE.getNodeOppositeRefOneToMany_Source();
+
+ /**
+ * The meta object literal for the '<em><b>Destination</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION = eINSTANCE.getNodeOppositeRefOneToMany_Destination();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl <em>Node Opposite Ref Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeOppositeRefManyToMany()
+ * @generated
+ */
+ EClass NODE_OPPOSITE_REF_MANY_TO_MANY = eINSTANCE.getNodeOppositeRefManyToMany();
+
+ /**
+ * The meta object literal for the '<em><b>Source</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE = eINSTANCE.getNodeOppositeRefManyToMany_Source();
+
+ /**
+ * The meta object literal for the '<em><b>Destination</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION = eINSTANCE.getNodeOppositeRefManyToMany_Destination();
+
+ }
+
+} //NodesPackage
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeImpl.java
index 2d4956bbf..97e624413 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeImpl.java
@@ -1,236 +1,236 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl#getContainmentRef1 <em>Containment Ref1</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class NodeImpl extends EObjectImpl implements Node {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getContainmentRef1() <em>Containment Ref1</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContainmentRef1()
- * @generated
- * @ordered
- */
- protected EList<Node> containmentRef1;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE__NAME, oldName, name));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<Node> getContainmentRef1() {
- if (containmentRef1 == null) {
- containmentRef1 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE__CONTAINMENT_REF1);
- }
- return containmentRef1;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE__CONTAINMENT_REF1:
- return ((InternalEList<?>)getContainmentRef1()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE__NAME:
- return getName();
- case NodesPackage.NODE__CONTAINMENT_REF1:
- return getContainmentRef1();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE__NAME:
- setName((String)newValue);
- return;
- case NodesPackage.NODE__CONTAINMENT_REF1:
- getContainmentRef1().clear();
- getContainmentRef1().addAll((Collection<? extends Node>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE__NAME:
- setName(NAME_EDEFAULT);
- return;
- case NodesPackage.NODE__CONTAINMENT_REF1:
- getContainmentRef1().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE__NAME:
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case NodesPackage.NODE__CONTAINMENT_REF1:
- return containmentRef1 != null && !containmentRef1.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: "); //$NON-NLS-1$
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
-} //NodeImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeImpl#getContainmentRef1 <em>Containment Ref1</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class NodeImpl extends EObjectImpl implements Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getContainmentRef1() <em>Containment Ref1</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContainmentRef1()
+ * @generated
+ * @ordered
+ */
+ protected EList<Node> containmentRef1;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getContainmentRef1() {
+ if (containmentRef1 == null) {
+ containmentRef1 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE__CONTAINMENT_REF1);
+ }
+ return containmentRef1;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE__CONTAINMENT_REF1:
+ return ((InternalEList<?>)getContainmentRef1()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE__NAME:
+ return getName();
+ case NodesPackage.NODE__CONTAINMENT_REF1:
+ return getContainmentRef1();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE__NAME:
+ setName((String)newValue);
+ return;
+ case NodesPackage.NODE__CONTAINMENT_REF1:
+ getContainmentRef1().clear();
+ getContainmentRef1().addAll((Collection<? extends Node>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case NodesPackage.NODE__CONTAINMENT_REF1:
+ getContainmentRef1().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case NodesPackage.NODE__CONTAINMENT_REF1:
+ return containmentRef1 != null && !containmentRef1.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NodeImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValueReferenceImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValueReferenceImpl.java
index 3b924fffa..61d46eeca 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValueReferenceImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValueReferenceImpl.java
@@ -1,149 +1,149 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.util.EObjectResolvingEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Multi Value Reference</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl#getMultiValuedReference <em>Multi Valued Reference</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeMultiValueReferenceImpl extends NodeImpl implements NodeMultiValueReference {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getMultiValuedReference() <em>Multi Valued Reference</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMultiValuedReference()
- * @generated
- * @ordered
- */
- protected EList<Node> multiValuedReference;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeMultiValueReferenceImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_MULTI_VALUE_REFERENCE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<Node> getMultiValuedReference() {
- if (multiValuedReference == null) {
- multiValuedReference = new EObjectResolvingEList<Node>(Node.class, this, NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE);
- }
- return multiValuedReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
- return getMultiValuedReference();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
- getMultiValuedReference().clear();
- getMultiValuedReference().addAll((Collection<? extends Node>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
- getMultiValuedReference().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
- return multiValuedReference != null && !multiValuedReference.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeMultiValueReferenceImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Multi Value Reference</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValueReferenceImpl#getMultiValuedReference <em>Multi Valued Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeMultiValueReferenceImpl extends NodeImpl implements NodeMultiValueReference {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getMultiValuedReference() <em>Multi Valued Reference</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMultiValuedReference()
+ * @generated
+ * @ordered
+ */
+ protected EList<Node> multiValuedReference;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeMultiValueReferenceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_MULTI_VALUE_REFERENCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getMultiValuedReference() {
+ if (multiValuedReference == null) {
+ multiValuedReference = new EObjectResolvingEList<Node>(Node.class, this, NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE);
+ }
+ return multiValuedReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
+ return getMultiValuedReference();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
+ getMultiValuedReference().clear();
+ getMultiValuedReference().addAll((Collection<? extends Node>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
+ getMultiValuedReference().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE:
+ return multiValuedReference != null && !multiValuedReference.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeMultiValueReferenceImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValuedAttributeImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValuedAttributeImpl.java
index 21715586f..74ecbd289 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValuedAttributeImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultiValuedAttributeImpl.java
@@ -1,164 +1,164 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Multi Valued Attribute</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl#getMultiValuedAttribute <em>Multi Valued Attribute</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeMultiValuedAttributeImpl extends NodeImpl implements NodeMultiValuedAttribute {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getMultiValuedAttribute() <em>Multi Valued Attribute</em>}' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMultiValuedAttribute()
- * @generated
- * @ordered
- */
- protected EList<String> multiValuedAttribute;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeMultiValuedAttributeImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_MULTI_VALUED_ATTRIBUTE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<String> getMultiValuedAttribute() {
- if (multiValuedAttribute == null) {
- multiValuedAttribute = new EDataTypeUniqueEList<String>(String.class, this, NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE);
- }
- return multiValuedAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
- return getMultiValuedAttribute();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
- getMultiValuedAttribute().clear();
- getMultiValuedAttribute().addAll((Collection<? extends String>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
- getMultiValuedAttribute().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
- return multiValuedAttribute != null && !multiValuedAttribute.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (multiValuedAttribute: "); //$NON-NLS-1$
- result.append(multiValuedAttribute);
- result.append(')');
- return result.toString();
- }
-
-} //NodeMultiValuedAttributeImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Multi Valued Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultiValuedAttributeImpl#getMultiValuedAttribute <em>Multi Valued Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeMultiValuedAttributeImpl extends NodeImpl implements NodeMultiValuedAttribute {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getMultiValuedAttribute() <em>Multi Valued Attribute</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMultiValuedAttribute()
+ * @generated
+ * @ordered
+ */
+ protected EList<String> multiValuedAttribute;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeMultiValuedAttributeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_MULTI_VALUED_ATTRIBUTE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<String> getMultiValuedAttribute() {
+ if (multiValuedAttribute == null) {
+ multiValuedAttribute = new EDataTypeUniqueEList<String>(String.class, this, NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE);
+ }
+ return multiValuedAttribute;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
+ return getMultiValuedAttribute();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
+ getMultiValuedAttribute().clear();
+ getMultiValuedAttribute().addAll((Collection<? extends String>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
+ getMultiValuedAttribute().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE:
+ return multiValuedAttribute != null && !multiValuedAttribute.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (multiValuedAttribute: "); //$NON-NLS-1$
+ result.append(multiValuedAttribute);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NodeMultiValuedAttributeImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultipleContainmentImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultipleContainmentImpl.java
index ff23f598d..d6d3919f5 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultipleContainmentImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeMultipleContainmentImpl.java
@@ -1,203 +1,203 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Multiple Containment</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl#getContainmentRef2 <em>Containment Ref2</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl#getContainmentRef3 <em>Containment Ref3</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-// Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeMultipleContainmentImpl extends NodeImpl implements NodeMultipleContainment {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getContainmentRef2() <em>Containment Ref2</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContainmentRef2()
- * @generated
- * @ordered
- */
- protected EList<Node> containmentRef2;
-
- /**
- * The cached value of the '{@link #getContainmentRef3() <em>Containment Ref3</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContainmentRef3()
- * @generated
- * @ordered
- */
- protected EList<Node> containmentRef3;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeMultipleContainmentImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_MULTIPLE_CONTAINMENT;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<Node> getContainmentRef2() {
- if (containmentRef2 == null) {
- containmentRef2 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2);
- }
- return containmentRef2;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<Node> getContainmentRef3() {
- if (containmentRef3 == null) {
- containmentRef3 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3);
- }
- return containmentRef3;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
- return ((InternalEList<?>)getContainmentRef2()).basicRemove(otherEnd, msgs);
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
- return ((InternalEList<?>)getContainmentRef3()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
- return getContainmentRef2();
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
- return getContainmentRef3();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
- getContainmentRef2().clear();
- getContainmentRef2().addAll((Collection<? extends Node>)newValue);
- return;
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
- getContainmentRef3().clear();
- getContainmentRef3().addAll((Collection<? extends Node>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
- getContainmentRef2().clear();
- return;
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
- getContainmentRef3().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
- return containmentRef2 != null && !containmentRef2.isEmpty();
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
- return containmentRef3 != null && !containmentRef3.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeMultipleContainmentImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Multiple Containment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl#getContainmentRef2 <em>Containment Ref2</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeMultipleContainmentImpl#getContainmentRef3 <em>Containment Ref3</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+// Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeMultipleContainmentImpl extends NodeImpl implements NodeMultipleContainment {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getContainmentRef2() <em>Containment Ref2</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContainmentRef2()
+ * @generated
+ * @ordered
+ */
+ protected EList<Node> containmentRef2;
+
+ /**
+ * The cached value of the '{@link #getContainmentRef3() <em>Containment Ref3</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContainmentRef3()
+ * @generated
+ * @ordered
+ */
+ protected EList<Node> containmentRef3;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeMultipleContainmentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_MULTIPLE_CONTAINMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getContainmentRef2() {
+ if (containmentRef2 == null) {
+ containmentRef2 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2);
+ }
+ return containmentRef2;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getContainmentRef3() {
+ if (containmentRef3 == null) {
+ containmentRef3 = new EObjectContainmentEList.Resolving<Node>(Node.class, this, NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3);
+ }
+ return containmentRef3;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
+ return ((InternalEList<?>)getContainmentRef2()).basicRemove(otherEnd, msgs);
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
+ return ((InternalEList<?>)getContainmentRef3()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
+ return getContainmentRef2();
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
+ return getContainmentRef3();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
+ getContainmentRef2().clear();
+ getContainmentRef2().addAll((Collection<? extends Node>)newValue);
+ return;
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
+ getContainmentRef3().clear();
+ getContainmentRef3().addAll((Collection<? extends Node>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
+ getContainmentRef2().clear();
+ return;
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
+ getContainmentRef3().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2:
+ return containmentRef2 != null && !containmentRef2.isEmpty();
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3:
+ return containmentRef3 != null && !containmentRef3.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeMultipleContainmentImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefManyToManyImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefManyToManyImpl.java
index d59b69f7f..0ed294028 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefManyToManyImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefManyToManyImpl.java
@@ -1,219 +1,219 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Opposite Ref Many To Many</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeOppositeRefManyToManyImpl extends NodeImpl implements NodeOppositeRefManyToMany {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getSource() <em>Source</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSource()
- * @generated
- * @ordered
- */
- protected EList<NodeOppositeRefManyToMany> source;
-
- /**
- * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDestination()
- * @generated
- * @ordered
- */
- protected EList<NodeOppositeRefManyToMany> destination;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeOppositeRefManyToManyImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_OPPOSITE_REF_MANY_TO_MANY;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<NodeOppositeRefManyToMany> getSource() {
- if (source == null) {
- source = new EObjectWithInverseResolvingEList.ManyInverse<NodeOppositeRefManyToMany>(NodeOppositeRefManyToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION);
- }
- return source;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<NodeOppositeRefManyToMany> getDestination() {
- if (destination == null) {
- destination = new EObjectWithInverseResolvingEList.ManyInverse<NodeOppositeRefManyToMany>(NodeOppositeRefManyToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE);
- }
- return destination;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- return ((InternalEList<InternalEObject>)(InternalEList<?>)getSource()).basicAdd(otherEnd, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- return ((InternalEList<InternalEObject>)(InternalEList<?>)getDestination()).basicAdd(otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- return ((InternalEList<?>)getDestination()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- return getSource();
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- return getDestination();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- getSource().clear();
- getSource().addAll((Collection<? extends NodeOppositeRefManyToMany>)newValue);
- return;
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- getDestination().clear();
- getDestination().addAll((Collection<? extends NodeOppositeRefManyToMany>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- getSource().clear();
- return;
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- getDestination().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
- return source != null && !source.isEmpty();
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
- return destination != null && !destination.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeOppositeRefManyToManyImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Opposite Ref Many To Many</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefManyToManyImpl#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeOppositeRefManyToManyImpl extends NodeImpl implements NodeOppositeRefManyToMany {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getSource() <em>Source</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSource()
+ * @generated
+ * @ordered
+ */
+ protected EList<NodeOppositeRefManyToMany> source;
+
+ /**
+ * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDestination()
+ * @generated
+ * @ordered
+ */
+ protected EList<NodeOppositeRefManyToMany> destination;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeOppositeRefManyToManyImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_OPPOSITE_REF_MANY_TO_MANY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<NodeOppositeRefManyToMany> getSource() {
+ if (source == null) {
+ source = new EObjectWithInverseResolvingEList.ManyInverse<NodeOppositeRefManyToMany>(NodeOppositeRefManyToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION);
+ }
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<NodeOppositeRefManyToMany> getDestination() {
+ if (destination == null) {
+ destination = new EObjectWithInverseResolvingEList.ManyInverse<NodeOppositeRefManyToMany>(NodeOppositeRefManyToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION, NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE);
+ }
+ return destination;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getSource()).basicAdd(otherEnd, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getDestination()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ return ((InternalEList<?>)getDestination()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ return getSource();
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ return getDestination();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ getSource().clear();
+ getSource().addAll((Collection<? extends NodeOppositeRefManyToMany>)newValue);
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ getDestination().clear();
+ getDestination().addAll((Collection<? extends NodeOppositeRefManyToMany>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ getSource().clear();
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ getDestination().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE:
+ return source != null && !source.isEmpty();
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION:
+ return destination != null && !destination.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeOppositeRefManyToManyImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToManyImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToManyImpl.java
index 3a0040a3a..57e40a281 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToManyImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToManyImpl.java
@@ -1,272 +1,272 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Opposite Ref One To Many</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeOppositeRefOneToManyImpl extends NodeImpl implements NodeOppositeRefOneToMany {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSource()
- * @generated
- * @ordered
- */
- protected NodeOppositeRefOneToMany source;
-
- /**
- * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDestination()
- * @generated
- * @ordered
- */
- protected EList<NodeOppositeRefOneToMany> destination;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeOppositeRefOneToManyImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_OPPOSITE_REF_ONE_TO_MANY;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToMany getSource() {
- if (source != null && source.eIsProxy()) {
- InternalEObject oldSource = (InternalEObject)source;
- source = (NodeOppositeRefOneToMany)eResolveProxy(oldSource);
- if (source != oldSource) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, oldSource, source));
- }
- }
- return source;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToMany basicGetSource() {
- return source;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSource(NodeOppositeRefOneToMany newSource, NotificationChain msgs) {
- NodeOppositeRefOneToMany oldSource = source;
- source = newSource;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, oldSource, newSource);
- if (msgs == null) msgs = notification; else msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSource(NodeOppositeRefOneToMany newSource) {
- if (newSource != source) {
- NotificationChain msgs = null;
- if (source != null)
- msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
- if (newSource != null)
- msgs = ((InternalEObject)newSource).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
- msgs = basicSetSource(newSource, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, newSource, newSource));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<NodeOppositeRefOneToMany> getDestination() {
- if (destination == null) {
- destination = new EObjectWithInverseResolvingEList<NodeOppositeRefOneToMany>(NodeOppositeRefOneToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE);
- }
- return destination;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- if (source != null)
- msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
- return basicSetSource((NodeOppositeRefOneToMany)otherEnd, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- return ((InternalEList<InternalEObject>)(InternalEList<?>)getDestination()).basicAdd(otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- return basicSetSource(null, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- return ((InternalEList<?>)getDestination()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- if (resolve) return getSource();
- return basicGetSource();
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- return getDestination();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- setSource((NodeOppositeRefOneToMany)newValue);
- return;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- getDestination().clear();
- getDestination().addAll((Collection<? extends NodeOppositeRefOneToMany>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- setSource((NodeOppositeRefOneToMany)null);
- return;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- getDestination().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
- return source != null;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
- return destination != null && !destination.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeOppositeRefOneToManyImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Opposite Ref One To Many</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToManyImpl#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeOppositeRefOneToManyImpl extends NodeImpl implements NodeOppositeRefOneToMany {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSource()
+ * @generated
+ * @ordered
+ */
+ protected NodeOppositeRefOneToMany source;
+
+ /**
+ * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDestination()
+ * @generated
+ * @ordered
+ */
+ protected EList<NodeOppositeRefOneToMany> destination;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeOppositeRefOneToManyImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_OPPOSITE_REF_ONE_TO_MANY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToMany getSource() {
+ if (source != null && source.eIsProxy()) {
+ InternalEObject oldSource = (InternalEObject)source;
+ source = (NodeOppositeRefOneToMany)eResolveProxy(oldSource);
+ if (source != oldSource) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, oldSource, source));
+ }
+ }
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToMany basicGetSource() {
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSource(NodeOppositeRefOneToMany newSource, NotificationChain msgs) {
+ NodeOppositeRefOneToMany oldSource = source;
+ source = newSource;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, oldSource, newSource);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSource(NodeOppositeRefOneToMany newSource) {
+ if (newSource != source) {
+ NotificationChain msgs = null;
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
+ if (newSource != null)
+ msgs = ((InternalEObject)newSource).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
+ msgs = basicSetSource(newSource, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE, newSource, newSource));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<NodeOppositeRefOneToMany> getDestination() {
+ if (destination == null) {
+ destination = new EObjectWithInverseResolvingEList<NodeOppositeRefOneToMany>(NodeOppositeRefOneToMany.class, this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE);
+ }
+ return destination;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION, NodeOppositeRefOneToMany.class, msgs);
+ return basicSetSource((NodeOppositeRefOneToMany)otherEnd, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getDestination()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ return basicSetSource(null, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ return ((InternalEList<?>)getDestination()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ if (resolve) return getSource();
+ return basicGetSource();
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ return getDestination();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ setSource((NodeOppositeRefOneToMany)newValue);
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ getDestination().clear();
+ getDestination().addAll((Collection<? extends NodeOppositeRefOneToMany>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ setSource((NodeOppositeRefOneToMany)null);
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ getDestination().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE:
+ return source != null;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION:
+ return destination != null && !destination.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeOppositeRefOneToManyImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToOneImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToOneImpl.java
index 1a65e20ab..789f6140b 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToOneImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeOppositeRefOneToOneImpl.java
@@ -1,313 +1,313 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Opposite Ref One To One</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl#getSource <em>Source</em>}</li>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl#getDestination <em>Destination</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeOppositeRefOneToOneImpl extends NodeImpl implements NodeOppositeRefOneToOne {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSource()
- * @generated
- * @ordered
- */
- protected NodeOppositeRefOneToOne source;
-
- /**
- * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDestination()
- * @generated
- * @ordered
- */
- protected NodeOppositeRefOneToOne destination;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeOppositeRefOneToOneImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_OPPOSITE_REF_ONE_TO_ONE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToOne getSource() {
- if (source != null && source.eIsProxy()) {
- InternalEObject oldSource = (InternalEObject)source;
- source = (NodeOppositeRefOneToOne)eResolveProxy(oldSource);
- if (source != oldSource) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, oldSource, source));
- }
- }
- return source;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToOne basicGetSource() {
- return source;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSource(NodeOppositeRefOneToOne newSource, NotificationChain msgs) {
- NodeOppositeRefOneToOne oldSource = source;
- source = newSource;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, oldSource, newSource);
- if (msgs == null) msgs = notification; else msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSource(NodeOppositeRefOneToOne newSource) {
- if (newSource != source) {
- NotificationChain msgs = null;
- if (source != null)
- msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
- if (newSource != null)
- msgs = ((InternalEObject)newSource).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
- msgs = basicSetSource(newSource, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, newSource, newSource));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToOne getDestination() {
- if (destination != null && destination.eIsProxy()) {
- InternalEObject oldDestination = (InternalEObject)destination;
- destination = (NodeOppositeRefOneToOne)eResolveProxy(oldDestination);
- if (destination != oldDestination) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, oldDestination, destination));
- }
- }
- return destination;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToOne basicGetDestination() {
- return destination;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetDestination(NodeOppositeRefOneToOne newDestination, NotificationChain msgs) {
- NodeOppositeRefOneToOne oldDestination = destination;
- destination = newDestination;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, oldDestination, newDestination);
- if (msgs == null) msgs = notification; else msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setDestination(NodeOppositeRefOneToOne newDestination) {
- if (newDestination != destination) {
- NotificationChain msgs = null;
- if (destination != null)
- msgs = ((InternalEObject)destination).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
- if (newDestination != null)
- msgs = ((InternalEObject)newDestination).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
- msgs = basicSetDestination(newDestination, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, newDestination, newDestination));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- if (source != null)
- msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
- return basicSetSource((NodeOppositeRefOneToOne)otherEnd, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- if (destination != null)
- msgs = ((InternalEObject)destination).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
- return basicSetDestination((NodeOppositeRefOneToOne)otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- return basicSetSource(null, msgs);
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- return basicSetDestination(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- if (resolve) return getSource();
- return basicGetSource();
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- if (resolve) return getDestination();
- return basicGetDestination();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- setSource((NodeOppositeRefOneToOne)newValue);
- return;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- setDestination((NodeOppositeRefOneToOne)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- setSource((NodeOppositeRefOneToOne)null);
- return;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- setDestination((NodeOppositeRefOneToOne)null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
- return source != null;
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
- return destination != null;
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeOppositeRefOneToOneImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Opposite Ref One To One</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl#getSource <em>Source</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeOppositeRefOneToOneImpl#getDestination <em>Destination</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeOppositeRefOneToOneImpl extends NodeImpl implements NodeOppositeRefOneToOne {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSource()
+ * @generated
+ * @ordered
+ */
+ protected NodeOppositeRefOneToOne source;
+
+ /**
+ * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDestination()
+ * @generated
+ * @ordered
+ */
+ protected NodeOppositeRefOneToOne destination;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeOppositeRefOneToOneImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_OPPOSITE_REF_ONE_TO_ONE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToOne getSource() {
+ if (source != null && source.eIsProxy()) {
+ InternalEObject oldSource = (InternalEObject)source;
+ source = (NodeOppositeRefOneToOne)eResolveProxy(oldSource);
+ if (source != oldSource) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, oldSource, source));
+ }
+ }
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToOne basicGetSource() {
+ return source;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSource(NodeOppositeRefOneToOne newSource, NotificationChain msgs) {
+ NodeOppositeRefOneToOne oldSource = source;
+ source = newSource;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, oldSource, newSource);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSource(NodeOppositeRefOneToOne newSource) {
+ if (newSource != source) {
+ NotificationChain msgs = null;
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
+ if (newSource != null)
+ msgs = ((InternalEObject)newSource).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
+ msgs = basicSetSource(newSource, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, newSource, newSource));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToOne getDestination() {
+ if (destination != null && destination.eIsProxy()) {
+ InternalEObject oldDestination = (InternalEObject)destination;
+ destination = (NodeOppositeRefOneToOne)eResolveProxy(oldDestination);
+ if (destination != oldDestination) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, oldDestination, destination));
+ }
+ }
+ return destination;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToOne basicGetDestination() {
+ return destination;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetDestination(NodeOppositeRefOneToOne newDestination, NotificationChain msgs) {
+ NodeOppositeRefOneToOne oldDestination = destination;
+ destination = newDestination;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, oldDestination, newDestination);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setDestination(NodeOppositeRefOneToOne newDestination) {
+ if (newDestination != destination) {
+ NotificationChain msgs = null;
+ if (destination != null)
+ msgs = ((InternalEObject)destination).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
+ if (newDestination != null)
+ msgs = ((InternalEObject)newDestination).eInverseAdd(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
+ msgs = basicSetDestination(newDestination, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, newDestination, newDestination));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ if (source != null)
+ msgs = ((InternalEObject)source).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION, NodeOppositeRefOneToOne.class, msgs);
+ return basicSetSource((NodeOppositeRefOneToOne)otherEnd, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ if (destination != null)
+ msgs = ((InternalEObject)destination).eInverseRemove(this, NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE, NodeOppositeRefOneToOne.class, msgs);
+ return basicSetDestination((NodeOppositeRefOneToOne)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ return basicSetSource(null, msgs);
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ return basicSetDestination(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ if (resolve) return getSource();
+ return basicGetSource();
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ if (resolve) return getDestination();
+ return basicGetDestination();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ setSource((NodeOppositeRefOneToOne)newValue);
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ setDestination((NodeOppositeRefOneToOne)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ setSource((NodeOppositeRefOneToOne)null);
+ return;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ setDestination((NodeOppositeRefOneToOne)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE:
+ return source != null;
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION:
+ return destination != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeOppositeRefOneToOneImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueAttributeImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueAttributeImpl.java
index 506204c9f..b5658179f 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueAttributeImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueAttributeImpl.java
@@ -1,179 +1,179 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Single Value Attribute</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl#getSingleValuedAttribute <em>Single Valued Attribute</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeSingleValueAttributeImpl extends NodeImpl implements NodeSingleValueAttribute {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The default value of the '{@link #getSingleValuedAttribute() <em>Single Valued Attribute</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSingleValuedAttribute()
- * @generated
- * @ordered
- */
- protected static final String SINGLE_VALUED_ATTRIBUTE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSingleValuedAttribute() <em>Single Valued Attribute</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSingleValuedAttribute()
- * @generated
- * @ordered
- */
- protected String singleValuedAttribute = SINGLE_VALUED_ATTRIBUTE_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeSingleValueAttributeImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_SINGLE_VALUE_ATTRIBUTE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getSingleValuedAttribute() {
- return singleValuedAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSingleValuedAttribute(String newSingleValuedAttribute) {
- String oldSingleValuedAttribute = singleValuedAttribute;
- singleValuedAttribute = newSingleValuedAttribute;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE, oldSingleValuedAttribute, singleValuedAttribute));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
- return getSingleValuedAttribute();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
- setSingleValuedAttribute((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
- setSingleValuedAttribute(SINGLE_VALUED_ATTRIBUTE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
- return SINGLE_VALUED_ATTRIBUTE_EDEFAULT == null ? singleValuedAttribute != null : !SINGLE_VALUED_ATTRIBUTE_EDEFAULT.equals(singleValuedAttribute);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (singleValuedAttribute: "); //$NON-NLS-1$
- result.append(singleValuedAttribute);
- result.append(')');
- return result.toString();
- }
-
-} //NodeSingleValueAttributeImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Single Value Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueAttributeImpl#getSingleValuedAttribute <em>Single Valued Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeSingleValueAttributeImpl extends NodeImpl implements NodeSingleValueAttribute {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The default value of the '{@link #getSingleValuedAttribute() <em>Single Valued Attribute</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSingleValuedAttribute()
+ * @generated
+ * @ordered
+ */
+ protected static final String SINGLE_VALUED_ATTRIBUTE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSingleValuedAttribute() <em>Single Valued Attribute</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSingleValuedAttribute()
+ * @generated
+ * @ordered
+ */
+ protected String singleValuedAttribute = SINGLE_VALUED_ATTRIBUTE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeSingleValueAttributeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_SINGLE_VALUE_ATTRIBUTE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getSingleValuedAttribute() {
+ return singleValuedAttribute;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSingleValuedAttribute(String newSingleValuedAttribute) {
+ String oldSingleValuedAttribute = singleValuedAttribute;
+ singleValuedAttribute = newSingleValuedAttribute;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE, oldSingleValuedAttribute, singleValuedAttribute));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
+ return getSingleValuedAttribute();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
+ setSingleValuedAttribute((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
+ setSingleValuedAttribute(SINGLE_VALUED_ATTRIBUTE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE:
+ return SINGLE_VALUED_ATTRIBUTE_EDEFAULT == null ? singleValuedAttribute != null : !SINGLE_VALUED_ATTRIBUTE_EDEFAULT.equals(singleValuedAttribute);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (singleValuedAttribute: "); //$NON-NLS-1$
+ result.append(singleValuedAttribute);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NodeSingleValueAttributeImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueContainmentImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueContainmentImpl.java
index adc78e1ca..471e34297 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueContainmentImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueContainmentImpl.java
@@ -1,216 +1,216 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Single Value Containment</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl#getSingleValueContainment <em>Single Value Containment</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeSingleValueContainmentImpl extends NodeImpl implements NodeSingleValueContainment {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getSingleValueContainment() <em>Single Value Containment</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSingleValueContainment()
- * @generated
- * @ordered
- */
- protected Node singleValueContainment;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeSingleValueContainmentImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_SINGLE_VALUE_CONTAINMENT;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Node getSingleValueContainment() {
- if (singleValueContainment != null && singleValueContainment.eIsProxy()) {
- InternalEObject oldSingleValueContainment = (InternalEObject)singleValueContainment;
- singleValueContainment = (Node)eResolveProxy(oldSingleValueContainment);
- if (singleValueContainment != oldSingleValueContainment) {
- InternalEObject newSingleValueContainment = (InternalEObject)singleValueContainment;
- NotificationChain msgs = oldSingleValueContainment.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, null);
- if (newSingleValueContainment.eInternalContainer() == null) {
- msgs = newSingleValueContainment.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
- }
- if (msgs != null) msgs.dispatch();
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, oldSingleValueContainment, singleValueContainment));
- }
- }
- return singleValueContainment;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Node basicGetSingleValueContainment() {
- return singleValueContainment;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSingleValueContainment(Node newSingleValueContainment, NotificationChain msgs) {
- Node oldSingleValueContainment = singleValueContainment;
- singleValueContainment = newSingleValueContainment;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, oldSingleValueContainment, newSingleValueContainment);
- if (msgs == null) msgs = notification; else msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSingleValueContainment(Node newSingleValueContainment) {
- if (newSingleValueContainment != singleValueContainment) {
- NotificationChain msgs = null;
- if (singleValueContainment != null)
- msgs = ((InternalEObject)singleValueContainment).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
- if (newSingleValueContainment != null)
- msgs = ((InternalEObject)newSingleValueContainment).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
- msgs = basicSetSingleValueContainment(newSingleValueContainment, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, newSingleValueContainment, newSingleValueContainment));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
- return basicSetSingleValueContainment(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
- if (resolve) return getSingleValueContainment();
- return basicGetSingleValueContainment();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
- setSingleValueContainment((Node)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
- setSingleValueContainment((Node)null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
- return singleValueContainment != null;
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeSingleValueContainmentImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Single Value Containment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueContainmentImpl#getSingleValueContainment <em>Single Value Containment</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeSingleValueContainmentImpl extends NodeImpl implements NodeSingleValueContainment {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getSingleValueContainment() <em>Single Value Containment</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSingleValueContainment()
+ * @generated
+ * @ordered
+ */
+ protected Node singleValueContainment;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeSingleValueContainmentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_SINGLE_VALUE_CONTAINMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Node getSingleValueContainment() {
+ if (singleValueContainment != null && singleValueContainment.eIsProxy()) {
+ InternalEObject oldSingleValueContainment = (InternalEObject)singleValueContainment;
+ singleValueContainment = (Node)eResolveProxy(oldSingleValueContainment);
+ if (singleValueContainment != oldSingleValueContainment) {
+ InternalEObject newSingleValueContainment = (InternalEObject)singleValueContainment;
+ NotificationChain msgs = oldSingleValueContainment.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, null);
+ if (newSingleValueContainment.eInternalContainer() == null) {
+ msgs = newSingleValueContainment.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
+ }
+ if (msgs != null) msgs.dispatch();
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, oldSingleValueContainment, singleValueContainment));
+ }
+ }
+ return singleValueContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Node basicGetSingleValueContainment() {
+ return singleValueContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSingleValueContainment(Node newSingleValueContainment, NotificationChain msgs) {
+ Node oldSingleValueContainment = singleValueContainment;
+ singleValueContainment = newSingleValueContainment;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, oldSingleValueContainment, newSingleValueContainment);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSingleValueContainment(Node newSingleValueContainment) {
+ if (newSingleValueContainment != singleValueContainment) {
+ NotificationChain msgs = null;
+ if (singleValueContainment != null)
+ msgs = ((InternalEObject)singleValueContainment).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
+ if (newSingleValueContainment != null)
+ msgs = ((InternalEObject)newSingleValueContainment).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, null, msgs);
+ msgs = basicSetSingleValueContainment(newSingleValueContainment, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT, newSingleValueContainment, newSingleValueContainment));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
+ return basicSetSingleValueContainment(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
+ if (resolve) return getSingleValueContainment();
+ return basicGetSingleValueContainment();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
+ setSingleValueContainment((Node)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
+ setSingleValueContainment((Node)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT:
+ return singleValueContainment != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeSingleValueContainmentImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueReferenceImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueReferenceImpl.java
index 2889333a5..78eaf1700 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueReferenceImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeSingleValueReferenceImpl.java
@@ -1,173 +1,173 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Node Single Value Reference</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl#getSingleValuedReference <em>Single Valued Reference</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodeSingleValueReferenceImpl extends NodeImpl implements NodeSingleValueReference {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached value of the '{@link #getSingleValuedReference() <em>Single Valued Reference</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSingleValuedReference()
- * @generated
- * @ordered
- */
- protected Node singleValuedReference;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodeSingleValueReferenceImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return NodesPackage.Literals.NODE_SINGLE_VALUE_REFERENCE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Node getSingleValuedReference() {
- if (singleValuedReference != null && singleValuedReference.eIsProxy()) {
- InternalEObject oldSingleValuedReference = (InternalEObject)singleValuedReference;
- singleValuedReference = (Node)eResolveProxy(oldSingleValuedReference);
- if (singleValuedReference != oldSingleValuedReference) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE, oldSingleValuedReference, singleValuedReference));
- }
- }
- return singleValuedReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Node basicGetSingleValuedReference() {
- return singleValuedReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSingleValuedReference(Node newSingleValuedReference) {
- Node oldSingleValuedReference = singleValuedReference;
- singleValuedReference = newSingleValuedReference;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE, oldSingleValuedReference, singleValuedReference));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
- if (resolve) return getSingleValuedReference();
- return basicGetSingleValuedReference();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
- setSingleValuedReference((Node)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
- setSingleValuedReference((Node)null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
- return singleValuedReference != null;
- }
- return super.eIsSet(featureID);
- }
-
-} //NodeSingleValueReferenceImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Single Value Reference</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeSingleValueReferenceImpl#getSingleValuedReference <em>Single Valued Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodeSingleValueReferenceImpl extends NodeImpl implements NodeSingleValueReference {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getSingleValuedReference() <em>Single Valued Reference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSingleValuedReference()
+ * @generated
+ * @ordered
+ */
+ protected Node singleValuedReference;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeSingleValueReferenceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_SINGLE_VALUE_REFERENCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Node getSingleValuedReference() {
+ if (singleValuedReference != null && singleValuedReference.eIsProxy()) {
+ InternalEObject oldSingleValuedReference = (InternalEObject)singleValuedReference;
+ singleValuedReference = (Node)eResolveProxy(oldSingleValuedReference);
+ if (singleValuedReference != oldSingleValuedReference) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE, oldSingleValuedReference, singleValuedReference));
+ }
+ }
+ return singleValuedReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Node basicGetSingleValuedReference() {
+ return singleValuedReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSingleValuedReference(Node newSingleValuedReference) {
+ Node oldSingleValuedReference = singleValuedReference;
+ singleValuedReference = newSingleValuedReference;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE, oldSingleValuedReference, singleValuedReference));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
+ if (resolve) return getSingleValuedReference();
+ return basicGetSingleValuedReference();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
+ setSingleValuedReference((Node)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
+ setSingleValuedReference((Node)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE:
+ return singleValuedReference != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //NodeSingleValueReferenceImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
index ca9e5db12..2894e4dae 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
@@ -1,209 +1,209 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.compare.tests.nodes.*;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class NodesFactoryImpl extends EFactoryImpl implements NodesFactory {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static NodesFactory init() {
- try {
- NodesFactory theNodesFactory = (NodesFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/compare/tests/nodes"); //$NON-NLS-1$
- if (theNodesFactory != null) {
- return theNodesFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new NodesFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodesFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case NodesPackage.NODE: return createNode();
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT: return createNodeMultipleContainment();
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT: return createNodeSingleValueContainment();
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE: return createNodeSingleValueAttribute();
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE: return createNodeMultiValuedAttribute();
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE: return createNodeSingleValueReference();
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE: return createNodeMultiValueReference();
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE: return createNodeOppositeRefOneToOne();
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY: return createNodeOppositeRefOneToMany();
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY: return createNodeOppositeRefManyToMany();
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Node createNode() {
- NodeImpl node = new NodeImpl();
- return node;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeMultipleContainment createNodeMultipleContainment() {
- NodeMultipleContainmentImpl nodeMultipleContainment = new NodeMultipleContainmentImpl();
- return nodeMultipleContainment;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeSingleValueContainment createNodeSingleValueContainment() {
- NodeSingleValueContainmentImpl nodeSingleValueContainment = new NodeSingleValueContainmentImpl();
- return nodeSingleValueContainment;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeSingleValueAttribute createNodeSingleValueAttribute() {
- NodeSingleValueAttributeImpl nodeSingleValueAttribute = new NodeSingleValueAttributeImpl();
- return nodeSingleValueAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeMultiValuedAttribute createNodeMultiValuedAttribute() {
- NodeMultiValuedAttributeImpl nodeMultiValuedAttribute = new NodeMultiValuedAttributeImpl();
- return nodeMultiValuedAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeSingleValueReference createNodeSingleValueReference() {
- NodeSingleValueReferenceImpl nodeSingleValueReference = new NodeSingleValueReferenceImpl();
- return nodeSingleValueReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeMultiValueReference createNodeMultiValueReference() {
- NodeMultiValueReferenceImpl nodeMultiValueReference = new NodeMultiValueReferenceImpl();
- return nodeMultiValueReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToOne createNodeOppositeRefOneToOne() {
- NodeOppositeRefOneToOneImpl nodeOppositeRefOneToOne = new NodeOppositeRefOneToOneImpl();
- return nodeOppositeRefOneToOne;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefOneToMany createNodeOppositeRefOneToMany() {
- NodeOppositeRefOneToManyImpl nodeOppositeRefOneToMany = new NodeOppositeRefOneToManyImpl();
- return nodeOppositeRefOneToMany;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodeOppositeRefManyToMany createNodeOppositeRefManyToMany() {
- NodeOppositeRefManyToManyImpl nodeOppositeRefManyToMany = new NodeOppositeRefManyToManyImpl();
- return nodeOppositeRefManyToMany;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodesPackage getNodesPackage() {
- return (NodesPackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static NodesPackage getPackage() {
- return NodesPackage.eINSTANCE;
- }
-
-} //NodesFactoryImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.compare.tests.nodes.*;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class NodesFactoryImpl extends EFactoryImpl implements NodesFactory {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static NodesFactory init() {
+ try {
+ NodesFactory theNodesFactory = (NodesFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/compare/tests/nodes"); //$NON-NLS-1$
+ if (theNodesFactory != null) {
+ return theNodesFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new NodesFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case NodesPackage.NODE: return createNode();
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT: return createNodeMultipleContainment();
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT: return createNodeSingleValueContainment();
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE: return createNodeSingleValueAttribute();
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE: return createNodeMultiValuedAttribute();
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE: return createNodeSingleValueReference();
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE: return createNodeMultiValueReference();
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE: return createNodeOppositeRefOneToOne();
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY: return createNodeOppositeRefOneToMany();
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY: return createNodeOppositeRefManyToMany();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Node createNode() {
+ NodeImpl node = new NodeImpl();
+ return node;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeMultipleContainment createNodeMultipleContainment() {
+ NodeMultipleContainmentImpl nodeMultipleContainment = new NodeMultipleContainmentImpl();
+ return nodeMultipleContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeSingleValueContainment createNodeSingleValueContainment() {
+ NodeSingleValueContainmentImpl nodeSingleValueContainment = new NodeSingleValueContainmentImpl();
+ return nodeSingleValueContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeSingleValueAttribute createNodeSingleValueAttribute() {
+ NodeSingleValueAttributeImpl nodeSingleValueAttribute = new NodeSingleValueAttributeImpl();
+ return nodeSingleValueAttribute;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeMultiValuedAttribute createNodeMultiValuedAttribute() {
+ NodeMultiValuedAttributeImpl nodeMultiValuedAttribute = new NodeMultiValuedAttributeImpl();
+ return nodeMultiValuedAttribute;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeSingleValueReference createNodeSingleValueReference() {
+ NodeSingleValueReferenceImpl nodeSingleValueReference = new NodeSingleValueReferenceImpl();
+ return nodeSingleValueReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeMultiValueReference createNodeMultiValueReference() {
+ NodeMultiValueReferenceImpl nodeMultiValueReference = new NodeMultiValueReferenceImpl();
+ return nodeMultiValueReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToOne createNodeOppositeRefOneToOne() {
+ NodeOppositeRefOneToOneImpl nodeOppositeRefOneToOne = new NodeOppositeRefOneToOneImpl();
+ return nodeOppositeRefOneToOne;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefOneToMany createNodeOppositeRefOneToMany() {
+ NodeOppositeRefOneToManyImpl nodeOppositeRefOneToMany = new NodeOppositeRefOneToManyImpl();
+ return nodeOppositeRefOneToMany;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeOppositeRefManyToMany createNodeOppositeRefManyToMany() {
+ NodeOppositeRefManyToManyImpl nodeOppositeRefManyToMany = new NodeOppositeRefManyToManyImpl();
+ return nodeOppositeRefManyToMany;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesPackage getNodesPackage() {
+ return (NodesPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static NodesPackage getPackage() {
+ return NodesPackage.eINSTANCE;
+ }
+
+} //NodesFactoryImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
index 0972b6a16..4f02cf6cd 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
@@ -1,497 +1,497 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.impl;
-
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference;
-import org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute;
-import org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment;
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany;
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany;
-import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne;
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute;
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment;
-import org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference;
-import org.eclipse.emf.compare.tests.nodes.NodesFactory;
-import org.eclipse.emf.compare.tests.nodes.NodesPackage;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-
-/**
- * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
- * @generated
- */
-public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeMultipleContainmentEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeSingleValueContainmentEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeSingleValueAttributeEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeMultiValuedAttributeEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeSingleValueReferenceEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeMultiValueReferenceEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeOppositeRefOneToOneEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeOppositeRefOneToManyEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private EClass nodeOppositeRefManyToManyEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private NodesPackageImpl() {
- super(eNS_URI, NodesFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>This method is used to initialize {@link NodesPackage#eINSTANCE} when that field is accessed.
- * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static NodesPackage init() {
- if (isInited) return (NodesPackage)EPackage.Registry.INSTANCE.getEPackage(NodesPackage.eNS_URI);
-
- // Obtain or create and register package
- NodesPackageImpl theNodesPackage = (NodesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof NodesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new NodesPackageImpl());
-
- isInited = true;
-
- // Create package meta-data objects
- theNodesPackage.createPackageContents();
-
- // Initialize created meta-data
- theNodesPackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- theNodesPackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(NodesPackage.eNS_URI, theNodesPackage);
- return theNodesPackage;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNode() {
- return nodeEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getNode_Name() {
- return (EAttribute)nodeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNode_ContainmentRef1() {
- return (EReference)nodeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeMultipleContainment() {
- return nodeMultipleContainmentEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeMultipleContainment_ContainmentRef2() {
- return (EReference)nodeMultipleContainmentEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeMultipleContainment_ContainmentRef3() {
- return (EReference)nodeMultipleContainmentEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeSingleValueContainment() {
- return nodeSingleValueContainmentEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeSingleValueContainment_SingleValueContainment() {
- return (EReference)nodeSingleValueContainmentEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeSingleValueAttribute() {
- return nodeSingleValueAttributeEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getNodeSingleValueAttribute_SingleValuedAttribute() {
- return (EAttribute)nodeSingleValueAttributeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeMultiValuedAttribute() {
- return nodeMultiValuedAttributeEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getNodeMultiValuedAttribute_MultiValuedAttribute() {
- return (EAttribute)nodeMultiValuedAttributeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeSingleValueReference() {
- return nodeSingleValueReferenceEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeSingleValueReference_SingleValuedReference() {
- return (EReference)nodeSingleValueReferenceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeMultiValueReference() {
- return nodeMultiValueReferenceEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeMultiValueReference_MultiValuedReference() {
- return (EReference)nodeMultiValueReferenceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeOppositeRefOneToOne() {
- return nodeOppositeRefOneToOneEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefOneToOne_Source() {
- return (EReference)nodeOppositeRefOneToOneEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefOneToOne_Destination() {
- return (EReference)nodeOppositeRefOneToOneEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeOppositeRefOneToMany() {
- return nodeOppositeRefOneToManyEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefOneToMany_Source() {
- return (EReference)nodeOppositeRefOneToManyEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefOneToMany_Destination() {
- return (EReference)nodeOppositeRefOneToManyEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EClass getNodeOppositeRefManyToMany() {
- return nodeOppositeRefManyToManyEClass;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefManyToMany_Source() {
- return (EReference)nodeOppositeRefManyToManyEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public EReference getNodeOppositeRefManyToMany_Destination() {
- return (EReference)nodeOppositeRefManyToManyEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public NodesFactory getNodesFactory() {
- return (NodesFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- nodeEClass = createEClass(NODE);
- createEAttribute(nodeEClass, NODE__NAME);
- createEReference(nodeEClass, NODE__CONTAINMENT_REF1);
-
- nodeMultipleContainmentEClass = createEClass(NODE_MULTIPLE_CONTAINMENT);
- createEReference(nodeMultipleContainmentEClass, NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2);
- createEReference(nodeMultipleContainmentEClass, NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3);
-
- nodeSingleValueContainmentEClass = createEClass(NODE_SINGLE_VALUE_CONTAINMENT);
- createEReference(nodeSingleValueContainmentEClass, NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT);
-
- nodeSingleValueAttributeEClass = createEClass(NODE_SINGLE_VALUE_ATTRIBUTE);
- createEAttribute(nodeSingleValueAttributeEClass, NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE);
-
- nodeMultiValuedAttributeEClass = createEClass(NODE_MULTI_VALUED_ATTRIBUTE);
- createEAttribute(nodeMultiValuedAttributeEClass, NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE);
-
- nodeSingleValueReferenceEClass = createEClass(NODE_SINGLE_VALUE_REFERENCE);
- createEReference(nodeSingleValueReferenceEClass, NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE);
-
- nodeMultiValueReferenceEClass = createEClass(NODE_MULTI_VALUE_REFERENCE);
- createEReference(nodeMultiValueReferenceEClass, NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE);
-
- nodeOppositeRefOneToOneEClass = createEClass(NODE_OPPOSITE_REF_ONE_TO_ONE);
- createEReference(nodeOppositeRefOneToOneEClass, NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE);
- createEReference(nodeOppositeRefOneToOneEClass, NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION);
-
- nodeOppositeRefOneToManyEClass = createEClass(NODE_OPPOSITE_REF_ONE_TO_MANY);
- createEReference(nodeOppositeRefOneToManyEClass, NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE);
- createEReference(nodeOppositeRefOneToManyEClass, NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION);
-
- nodeOppositeRefManyToManyEClass = createEClass(NODE_OPPOSITE_REF_MANY_TO_MANY);
- createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE);
- createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Create type parameters
-
- // Set bounds for type parameters
-
- // Add supertypes to classes
- nodeMultipleContainmentEClass.getESuperTypes().add(this.getNode());
- nodeSingleValueContainmentEClass.getESuperTypes().add(this.getNode());
- nodeSingleValueAttributeEClass.getESuperTypes().add(this.getNode());
- nodeMultiValuedAttributeEClass.getESuperTypes().add(this.getNode());
- nodeSingleValueReferenceEClass.getESuperTypes().add(this.getNode());
- nodeMultiValueReferenceEClass.getESuperTypes().add(this.getNode());
- nodeOppositeRefOneToOneEClass.getESuperTypes().add(this.getNode());
- nodeOppositeRefOneToManyEClass.getESuperTypes().add(this.getNode());
- nodeOppositeRefManyToManyEClass.getESuperTypes().add(this.getNode());
-
- // Initialize classes and features; add operations and parameters
- initEClass(nodeEClass, Node.class, "Node", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEAttribute(getNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getNode_ContainmentRef1(), this.getNode(), null, "containmentRef1", null, 0, -1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeMultipleContainmentEClass, NodeMultipleContainment.class, "NodeMultipleContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeMultipleContainment_ContainmentRef2(), this.getNode(), null, "containmentRef2", null, 0, -1, NodeMultipleContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getNodeMultipleContainment_ContainmentRef3(), this.getNode(), null, "containmentRef3", null, 0, -1, NodeMultipleContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeSingleValueContainmentEClass, NodeSingleValueContainment.class, "NodeSingleValueContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeSingleValueContainment_SingleValueContainment(), this.getNode(), null, "singleValueContainment", null, 0, 1, NodeSingleValueContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeSingleValueAttributeEClass, NodeSingleValueAttribute.class, "NodeSingleValueAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEAttribute(getNodeSingleValueAttribute_SingleValuedAttribute(), ecorePackage.getEString(), "singleValuedAttribute", null, 0, 1, NodeSingleValueAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeMultiValuedAttributeEClass, NodeMultiValuedAttribute.class, "NodeMultiValuedAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEAttribute(getNodeMultiValuedAttribute_MultiValuedAttribute(), ecorePackage.getEString(), "multiValuedAttribute", null, 0, -1, NodeMultiValuedAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeSingleValueReferenceEClass, NodeSingleValueReference.class, "NodeSingleValueReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeSingleValueReference_SingleValuedReference(), this.getNode(), null, "singleValuedReference", null, 0, 1, NodeSingleValueReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeMultiValueReferenceEClass, NodeMultiValueReference.class, "NodeMultiValueReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeMultiValueReference_MultiValuedReference(), this.getNode(), null, "multiValuedReference", null, 0, -1, NodeMultiValueReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeOppositeRefOneToOneEClass, NodeOppositeRefOneToOne.class, "NodeOppositeRefOneToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeOppositeRefOneToOne_Source(), this.getNodeOppositeRefOneToOne(), this.getNodeOppositeRefOneToOne_Destination(), "source", null, 0, 1, NodeOppositeRefOneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getNodeOppositeRefOneToOne_Destination(), this.getNodeOppositeRefOneToOne(), this.getNodeOppositeRefOneToOne_Source(), "destination", null, 0, 1, NodeOppositeRefOneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeOppositeRefOneToManyEClass, NodeOppositeRefOneToMany.class, "NodeOppositeRefOneToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeOppositeRefOneToMany_Source(), this.getNodeOppositeRefOneToMany(), this.getNodeOppositeRefOneToMany_Destination(), "source", null, 0, 1, NodeOppositeRefOneToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getNodeOppositeRefOneToMany_Destination(), this.getNodeOppositeRefOneToMany(), this.getNodeOppositeRefOneToMany_Source(), "destination", null, 0, -1, NodeOppositeRefOneToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(nodeOppositeRefManyToManyEClass, NodeOppositeRefManyToMany.class, "NodeOppositeRefManyToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getNodeOppositeRefManyToMany_Source(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Destination(), "source", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getNodeOppositeRefManyToMany_Destination(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Source(), "destination", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- // Create resource
- createResource(eNS_URI);
- }
-
-} // NodesPackageImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference;
+import org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute;
+import org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment;
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany;
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany;
+import org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne;
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute;
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment;
+import org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference;
+import org.eclipse.emf.compare.tests.nodes.NodesFactory;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ * @generated
+ */
+public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeMultipleContainmentEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeSingleValueContainmentEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeSingleValueAttributeEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeMultiValuedAttributeEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeSingleValueReferenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeMultiValueReferenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeOppositeRefOneToOneEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeOppositeRefOneToManyEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeOppositeRefManyToManyEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private NodesPackageImpl() {
+ super(eNS_URI, NodesFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link NodesPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static NodesPackage init() {
+ if (isInited) return (NodesPackage)EPackage.Registry.INSTANCE.getEPackage(NodesPackage.eNS_URI);
+
+ // Obtain or create and register package
+ NodesPackageImpl theNodesPackage = (NodesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof NodesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new NodesPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theNodesPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theNodesPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theNodesPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(NodesPackage.eNS_URI, theNodesPackage);
+ return theNodesPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNode() {
+ return nodeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNode_Name() {
+ return (EAttribute)nodeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNode_ContainmentRef1() {
+ return (EReference)nodeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeMultipleContainment() {
+ return nodeMultipleContainmentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeMultipleContainment_ContainmentRef2() {
+ return (EReference)nodeMultipleContainmentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeMultipleContainment_ContainmentRef3() {
+ return (EReference)nodeMultipleContainmentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeSingleValueContainment() {
+ return nodeSingleValueContainmentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeSingleValueContainment_SingleValueContainment() {
+ return (EReference)nodeSingleValueContainmentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeSingleValueAttribute() {
+ return nodeSingleValueAttributeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNodeSingleValueAttribute_SingleValuedAttribute() {
+ return (EAttribute)nodeSingleValueAttributeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeMultiValuedAttribute() {
+ return nodeMultiValuedAttributeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNodeMultiValuedAttribute_MultiValuedAttribute() {
+ return (EAttribute)nodeMultiValuedAttributeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeSingleValueReference() {
+ return nodeSingleValueReferenceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeSingleValueReference_SingleValuedReference() {
+ return (EReference)nodeSingleValueReferenceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeMultiValueReference() {
+ return nodeMultiValueReferenceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeMultiValueReference_MultiValuedReference() {
+ return (EReference)nodeMultiValueReferenceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeOppositeRefOneToOne() {
+ return nodeOppositeRefOneToOneEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefOneToOne_Source() {
+ return (EReference)nodeOppositeRefOneToOneEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefOneToOne_Destination() {
+ return (EReference)nodeOppositeRefOneToOneEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeOppositeRefOneToMany() {
+ return nodeOppositeRefOneToManyEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefOneToMany_Source() {
+ return (EReference)nodeOppositeRefOneToManyEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefOneToMany_Destination() {
+ return (EReference)nodeOppositeRefOneToManyEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeOppositeRefManyToMany() {
+ return nodeOppositeRefManyToManyEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefManyToMany_Source() {
+ return (EReference)nodeOppositeRefManyToManyEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeOppositeRefManyToMany_Destination() {
+ return (EReference)nodeOppositeRefManyToManyEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesFactory getNodesFactory() {
+ return (NodesFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ nodeEClass = createEClass(NODE);
+ createEAttribute(nodeEClass, NODE__NAME);
+ createEReference(nodeEClass, NODE__CONTAINMENT_REF1);
+
+ nodeMultipleContainmentEClass = createEClass(NODE_MULTIPLE_CONTAINMENT);
+ createEReference(nodeMultipleContainmentEClass, NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF2);
+ createEReference(nodeMultipleContainmentEClass, NODE_MULTIPLE_CONTAINMENT__CONTAINMENT_REF3);
+
+ nodeSingleValueContainmentEClass = createEClass(NODE_SINGLE_VALUE_CONTAINMENT);
+ createEReference(nodeSingleValueContainmentEClass, NODE_SINGLE_VALUE_CONTAINMENT__SINGLE_VALUE_CONTAINMENT);
+
+ nodeSingleValueAttributeEClass = createEClass(NODE_SINGLE_VALUE_ATTRIBUTE);
+ createEAttribute(nodeSingleValueAttributeEClass, NODE_SINGLE_VALUE_ATTRIBUTE__SINGLE_VALUED_ATTRIBUTE);
+
+ nodeMultiValuedAttributeEClass = createEClass(NODE_MULTI_VALUED_ATTRIBUTE);
+ createEAttribute(nodeMultiValuedAttributeEClass, NODE_MULTI_VALUED_ATTRIBUTE__MULTI_VALUED_ATTRIBUTE);
+
+ nodeSingleValueReferenceEClass = createEClass(NODE_SINGLE_VALUE_REFERENCE);
+ createEReference(nodeSingleValueReferenceEClass, NODE_SINGLE_VALUE_REFERENCE__SINGLE_VALUED_REFERENCE);
+
+ nodeMultiValueReferenceEClass = createEClass(NODE_MULTI_VALUE_REFERENCE);
+ createEReference(nodeMultiValueReferenceEClass, NODE_MULTI_VALUE_REFERENCE__MULTI_VALUED_REFERENCE);
+
+ nodeOppositeRefOneToOneEClass = createEClass(NODE_OPPOSITE_REF_ONE_TO_ONE);
+ createEReference(nodeOppositeRefOneToOneEClass, NODE_OPPOSITE_REF_ONE_TO_ONE__SOURCE);
+ createEReference(nodeOppositeRefOneToOneEClass, NODE_OPPOSITE_REF_ONE_TO_ONE__DESTINATION);
+
+ nodeOppositeRefOneToManyEClass = createEClass(NODE_OPPOSITE_REF_ONE_TO_MANY);
+ createEReference(nodeOppositeRefOneToManyEClass, NODE_OPPOSITE_REF_ONE_TO_MANY__SOURCE);
+ createEReference(nodeOppositeRefOneToManyEClass, NODE_OPPOSITE_REF_ONE_TO_MANY__DESTINATION);
+
+ nodeOppositeRefManyToManyEClass = createEClass(NODE_OPPOSITE_REF_MANY_TO_MANY);
+ createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE);
+ createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ nodeMultipleContainmentEClass.getESuperTypes().add(this.getNode());
+ nodeSingleValueContainmentEClass.getESuperTypes().add(this.getNode());
+ nodeSingleValueAttributeEClass.getESuperTypes().add(this.getNode());
+ nodeMultiValuedAttributeEClass.getESuperTypes().add(this.getNode());
+ nodeSingleValueReferenceEClass.getESuperTypes().add(this.getNode());
+ nodeMultiValueReferenceEClass.getESuperTypes().add(this.getNode());
+ nodeOppositeRefOneToOneEClass.getESuperTypes().add(this.getNode());
+ nodeOppositeRefOneToManyEClass.getESuperTypes().add(this.getNode());
+ nodeOppositeRefManyToManyEClass.getESuperTypes().add(this.getNode());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(nodeEClass, Node.class, "Node", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNode_ContainmentRef1(), this.getNode(), null, "containmentRef1", null, 0, -1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeMultipleContainmentEClass, NodeMultipleContainment.class, "NodeMultipleContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeMultipleContainment_ContainmentRef2(), this.getNode(), null, "containmentRef2", null, 0, -1, NodeMultipleContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeMultipleContainment_ContainmentRef3(), this.getNode(), null, "containmentRef3", null, 0, -1, NodeMultipleContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeSingleValueContainmentEClass, NodeSingleValueContainment.class, "NodeSingleValueContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeSingleValueContainment_SingleValueContainment(), this.getNode(), null, "singleValueContainment", null, 0, 1, NodeSingleValueContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeSingleValueAttributeEClass, NodeSingleValueAttribute.class, "NodeSingleValueAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getNodeSingleValueAttribute_SingleValuedAttribute(), ecorePackage.getEString(), "singleValuedAttribute", null, 0, 1, NodeSingleValueAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeMultiValuedAttributeEClass, NodeMultiValuedAttribute.class, "NodeMultiValuedAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getNodeMultiValuedAttribute_MultiValuedAttribute(), ecorePackage.getEString(), "multiValuedAttribute", null, 0, -1, NodeMultiValuedAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeSingleValueReferenceEClass, NodeSingleValueReference.class, "NodeSingleValueReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeSingleValueReference_SingleValuedReference(), this.getNode(), null, "singleValuedReference", null, 0, 1, NodeSingleValueReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeMultiValueReferenceEClass, NodeMultiValueReference.class, "NodeMultiValueReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeMultiValueReference_MultiValuedReference(), this.getNode(), null, "multiValuedReference", null, 0, -1, NodeMultiValueReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeOppositeRefOneToOneEClass, NodeOppositeRefOneToOne.class, "NodeOppositeRefOneToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefOneToOne_Source(), this.getNodeOppositeRefOneToOne(), this.getNodeOppositeRefOneToOne_Destination(), "source", null, 0, 1, NodeOppositeRefOneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefOneToOne_Destination(), this.getNodeOppositeRefOneToOne(), this.getNodeOppositeRefOneToOne_Source(), "destination", null, 0, 1, NodeOppositeRefOneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeOppositeRefOneToManyEClass, NodeOppositeRefOneToMany.class, "NodeOppositeRefOneToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefOneToMany_Source(), this.getNodeOppositeRefOneToMany(), this.getNodeOppositeRefOneToMany_Destination(), "source", null, 0, 1, NodeOppositeRefOneToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefOneToMany_Destination(), this.getNodeOppositeRefOneToMany(), this.getNodeOppositeRefOneToMany_Source(), "destination", null, 0, -1, NodeOppositeRefOneToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeOppositeRefManyToManyEClass, NodeOppositeRefManyToMany.class, "NodeOppositeRefManyToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefManyToMany_Source(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Destination(), "source", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeOppositeRefManyToMany_Destination(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Source(), "destination", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // NodesPackageImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
index f9f233092..46337637a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
@@ -1,297 +1,297 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-
-import org.eclipse.emf.compare.tests.nodes.*;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
- * @generated
- */
-public class NodesAdapterFactory extends AdapterFactoryImpl {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static NodesPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodesAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = NodesPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch that delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NodesSwitch<Adapter> modelSwitch =
- new NodesSwitch<Adapter>() {
- @Override
- public Adapter caseNode(Node object) {
- return createNodeAdapter();
- }
- @Override
- public Adapter caseNodeMultipleContainment(NodeMultipleContainment object) {
- return createNodeMultipleContainmentAdapter();
- }
- @Override
- public Adapter caseNodeSingleValueContainment(NodeSingleValueContainment object) {
- return createNodeSingleValueContainmentAdapter();
- }
- @Override
- public Adapter caseNodeSingleValueAttribute(NodeSingleValueAttribute object) {
- return createNodeSingleValueAttributeAdapter();
- }
- @Override
- public Adapter caseNodeMultiValuedAttribute(NodeMultiValuedAttribute object) {
- return createNodeMultiValuedAttributeAdapter();
- }
- @Override
- public Adapter caseNodeSingleValueReference(NodeSingleValueReference object) {
- return createNodeSingleValueReferenceAdapter();
- }
- @Override
- public Adapter caseNodeMultiValueReference(NodeMultiValueReference object) {
- return createNodeMultiValueReferenceAdapter();
- }
- @Override
- public Adapter caseNodeOppositeRefOneToOne(NodeOppositeRefOneToOne object) {
- return createNodeOppositeRefOneToOneAdapter();
- }
- @Override
- public Adapter caseNodeOppositeRefOneToMany(NodeOppositeRefOneToMany object) {
- return createNodeOppositeRefOneToManyAdapter();
- }
- @Override
- public Adapter caseNodeOppositeRefManyToMany(NodeOppositeRefManyToMany object) {
- return createNodeOppositeRefManyToManyAdapter();
- }
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject)target);
- }
-
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.Node <em>Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.Node
- * @generated
- */
- public Adapter createNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment <em>Node Multiple Containment</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment
- * @generated
- */
- public Adapter createNodeMultipleContainmentAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment <em>Node Single Value Containment</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment
- * @generated
- */
- public Adapter createNodeSingleValueContainmentAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute <em>Node Single Value Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute
- * @generated
- */
- public Adapter createNodeSingleValueAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute <em>Node Multi Valued Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute
- * @generated
- */
- public Adapter createNodeMultiValuedAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference <em>Node Single Value Reference</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference
- * @generated
- */
- public Adapter createNodeSingleValueReferenceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference <em>Node Multi Value Reference</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference
- * @generated
- */
- public Adapter createNodeMultiValueReferenceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne <em>Node Opposite Ref One To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne
- * @generated
- */
- public Adapter createNodeOppositeRefOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany <em>Node Opposite Ref One To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany
- * @generated
- */
- public Adapter createNodeOppositeRefOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany <em>Node Opposite Ref Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany
- * @generated
- */
- public Adapter createNodeOppositeRefManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //NodesAdapterFactory
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.compare.tests.nodes.*;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
+ * @generated
+ */
+public class NodesAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static NodesPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = NodesPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodesSwitch<Adapter> modelSwitch =
+ new NodesSwitch<Adapter>() {
+ @Override
+ public Adapter caseNode(Node object) {
+ return createNodeAdapter();
+ }
+ @Override
+ public Adapter caseNodeMultipleContainment(NodeMultipleContainment object) {
+ return createNodeMultipleContainmentAdapter();
+ }
+ @Override
+ public Adapter caseNodeSingleValueContainment(NodeSingleValueContainment object) {
+ return createNodeSingleValueContainmentAdapter();
+ }
+ @Override
+ public Adapter caseNodeSingleValueAttribute(NodeSingleValueAttribute object) {
+ return createNodeSingleValueAttributeAdapter();
+ }
+ @Override
+ public Adapter caseNodeMultiValuedAttribute(NodeMultiValuedAttribute object) {
+ return createNodeMultiValuedAttributeAdapter();
+ }
+ @Override
+ public Adapter caseNodeSingleValueReference(NodeSingleValueReference object) {
+ return createNodeSingleValueReferenceAdapter();
+ }
+ @Override
+ public Adapter caseNodeMultiValueReference(NodeMultiValueReference object) {
+ return createNodeMultiValueReferenceAdapter();
+ }
+ @Override
+ public Adapter caseNodeOppositeRefOneToOne(NodeOppositeRefOneToOne object) {
+ return createNodeOppositeRefOneToOneAdapter();
+ }
+ @Override
+ public Adapter caseNodeOppositeRefOneToMany(NodeOppositeRefOneToMany object) {
+ return createNodeOppositeRefOneToManyAdapter();
+ }
+ @Override
+ public Adapter caseNodeOppositeRefManyToMany(NodeOppositeRefManyToMany object) {
+ return createNodeOppositeRefManyToManyAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.Node <em>Node</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.Node
+ * @generated
+ */
+ public Adapter createNodeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment <em>Node Multiple Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment
+ * @generated
+ */
+ public Adapter createNodeMultipleContainmentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment <em>Node Single Value Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueContainment
+ * @generated
+ */
+ public Adapter createNodeSingleValueContainmentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute <em>Node Single Value Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueAttribute
+ * @generated
+ */
+ public Adapter createNodeSingleValueAttributeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute <em>Node Multi Valued Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute
+ * @generated
+ */
+ public Adapter createNodeMultiValuedAttributeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference <em>Node Single Value Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeSingleValueReference
+ * @generated
+ */
+ public Adapter createNodeSingleValueReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference <em>Node Multi Value Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference
+ * @generated
+ */
+ public Adapter createNodeMultiValueReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne <em>Node Opposite Ref One To One</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToOne
+ * @generated
+ */
+ public Adapter createNodeOppositeRefOneToOneAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany <em>Node Opposite Ref One To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefOneToMany
+ * @generated
+ */
+ public Adapter createNodeOppositeRefOneToManyAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany <em>Node Opposite Ref Many To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeOppositeRefManyToMany
+ * @generated
+ */
+ public Adapter createNodeOppositeRefManyToManyAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //NodesAdapterFactory
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceFactoryImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceFactoryImpl.java
index 968e031cb..ca52fb024 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceFactoryImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceFactoryImpl.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.util;
-
-import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Resource Factory</b> associated with the package.
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.util.NodesResourceImpl
- * @generated
- */
-public class NodesResourceFactoryImpl extends ResourceFactoryImpl {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Creates an instance of the resource factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodesResourceFactoryImpl() {
- super();
- }
-
- /**
- * Creates an instance of the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Resource createResource(URI uri) {
- Resource result = new NodesResourceImpl(uri);
- return result;
- }
-
-} //NodesResourceFactoryImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.util;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource Factory</b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.util.NodesResourceImpl
+ * @generated
+ */
+public class NodesResourceFactoryImpl extends ResourceFactoryImpl {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Creates an instance of the resource factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesResourceFactoryImpl() {
+ super();
+ }
+
+ /**
+ * Creates an instance of the resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Resource createResource(URI uri) {
+ Resource result = new NodesResourceImpl(uri);
+ return result;
+ }
+
+} //NodesResourceFactoryImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceImpl.java
index e49d5655d..0ede9ccda 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesResourceImpl.java
@@ -1,54 +1,54 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.util;
-
-import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Resource </b> associated with the package.
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl
- * @generated
- */
-public class NodesResourceImpl extends XMIResourceImpl {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Creates an instance of the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param uri the URI of the new resource.
- * @generated
- */
- public NodesResourceImpl(URI uri) {
- super(uri);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#useUUIDs()
- * @generated NOT
- */
- @Override
- protected boolean useUUIDs() {
- return true;
- }
-
-} //NodesResourceImpl
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.util;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource </b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl
+ * @generated
+ */
+public class NodesResourceImpl extends XMIResourceImpl {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Creates an instance of the resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param uri the URI of the new resource.
+ * @generated
+ */
+ public NodesResourceImpl(URI uri) {
+ super(uri);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#useUUIDs()
+ * @generated NOT
+ */
+ @Override
+ protected boolean useUUIDs() {
+ return true;
+ }
+
+} //NodesResourceImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
index 88cae7b68..91ab17f99 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
@@ -1,341 +1,341 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.nodes.util;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.tests.nodes.*;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
- * @generated
- */
-//Generated code, suppressing all warnings
-@SuppressWarnings("all")
-public class NodesSwitch<T> {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static NodesPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NodesSwitch() {
- if (modelPackage == null) {
- modelPackage = NodesPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case NodesPackage.NODE: {
- Node node = (Node)theEObject;
- T result = caseNode(node);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_MULTIPLE_CONTAINMENT: {
- NodeMultipleContainment nodeMultipleContainment = (NodeMultipleContainment)theEObject;
- T result = caseNodeMultipleContainment(nodeMultipleContainment);
- if (result == null) result = caseNode(nodeMultipleContainment);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT: {
- NodeSingleValueContainment nodeSingleValueContainment = (NodeSingleValueContainment)theEObject;
- T result = caseNodeSingleValueContainment(nodeSingleValueContainment);
- if (result == null) result = caseNode(nodeSingleValueContainment);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE: {
- NodeSingleValueAttribute nodeSingleValueAttribute = (NodeSingleValueAttribute)theEObject;
- T result = caseNodeSingleValueAttribute(nodeSingleValueAttribute);
- if (result == null) result = caseNode(nodeSingleValueAttribute);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE: {
- NodeMultiValuedAttribute nodeMultiValuedAttribute = (NodeMultiValuedAttribute)theEObject;
- T result = caseNodeMultiValuedAttribute(nodeMultiValuedAttribute);
- if (result == null) result = caseNode(nodeMultiValuedAttribute);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_SINGLE_VALUE_REFERENCE: {
- NodeSingleValueReference nodeSingleValueReference = (NodeSingleValueReference)theEObject;
- T result = caseNodeSingleValueReference(nodeSingleValueReference);
- if (result == null) result = caseNode(nodeSingleValueReference);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_MULTI_VALUE_REFERENCE: {
- NodeMultiValueReference nodeMultiValueReference = (NodeMultiValueReference)theEObject;
- T result = caseNodeMultiValueReference(nodeMultiValueReference);
- if (result == null) result = caseNode(nodeMultiValueReference);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE: {
- NodeOppositeRefOneToOne nodeOppositeRefOneToOne = (NodeOppositeRefOneToOne)theEObject;
- T result = caseNodeOppositeRefOneToOne(nodeOppositeRefOneToOne);
- if (result == null) result = caseNode(nodeOppositeRefOneToOne);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY: {
- NodeOppositeRefOneToMany nodeOppositeRefOneToMany = (NodeOppositeRefOneToMany)theEObject;
- T result = caseNodeOppositeRefOneToMany(nodeOppositeRefOneToMany);
- if (result == null) result = caseNode(nodeOppositeRefOneToMany);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY: {
- NodeOppositeRefManyToMany nodeOppositeRefManyToMany = (NodeOppositeRefManyToMany)theEObject;
- T result = caseNodeOppositeRefManyToMany(nodeOppositeRefManyToMany);
- if (result == null) result = caseNode(nodeOppositeRefManyToMany);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNode(Node object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Multiple Containment</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Multiple Containment</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeMultipleContainment(NodeMultipleContainment object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Single Value Containment</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Single Value Containment</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeSingleValueContainment(NodeSingleValueContainment object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Single Value Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Single Value Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeSingleValueAttribute(NodeSingleValueAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Multi Valued Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Multi Valued Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeMultiValuedAttribute(NodeMultiValuedAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Single Value Reference</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Single Value Reference</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeSingleValueReference(NodeSingleValueReference object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Multi Value Reference</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Multi Value Reference</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeMultiValueReference(NodeMultiValueReference object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref One To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref One To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeOppositeRefOneToOne(NodeOppositeRefOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref One To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref One To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeOppositeRefOneToMany(NodeOppositeRefOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref Many To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref Many To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNodeOppositeRefManyToMany(NodeOppositeRefManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-
-} //NodesSwitch
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.util;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.tests.nodes.*;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage
+ * @generated
+ */
+//Generated code, suppressing all warnings
+@SuppressWarnings("all")
+public class NodesSwitch<T> {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static NodesPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodesSwitch() {
+ if (modelPackage == null) {
+ modelPackage = NodesPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case NodesPackage.NODE: {
+ Node node = (Node)theEObject;
+ T result = caseNode(node);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_MULTIPLE_CONTAINMENT: {
+ NodeMultipleContainment nodeMultipleContainment = (NodeMultipleContainment)theEObject;
+ T result = caseNodeMultipleContainment(nodeMultipleContainment);
+ if (result == null) result = caseNode(nodeMultipleContainment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_SINGLE_VALUE_CONTAINMENT: {
+ NodeSingleValueContainment nodeSingleValueContainment = (NodeSingleValueContainment)theEObject;
+ T result = caseNodeSingleValueContainment(nodeSingleValueContainment);
+ if (result == null) result = caseNode(nodeSingleValueContainment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_SINGLE_VALUE_ATTRIBUTE: {
+ NodeSingleValueAttribute nodeSingleValueAttribute = (NodeSingleValueAttribute)theEObject;
+ T result = caseNodeSingleValueAttribute(nodeSingleValueAttribute);
+ if (result == null) result = caseNode(nodeSingleValueAttribute);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_MULTI_VALUED_ATTRIBUTE: {
+ NodeMultiValuedAttribute nodeMultiValuedAttribute = (NodeMultiValuedAttribute)theEObject;
+ T result = caseNodeMultiValuedAttribute(nodeMultiValuedAttribute);
+ if (result == null) result = caseNode(nodeMultiValuedAttribute);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_SINGLE_VALUE_REFERENCE: {
+ NodeSingleValueReference nodeSingleValueReference = (NodeSingleValueReference)theEObject;
+ T result = caseNodeSingleValueReference(nodeSingleValueReference);
+ if (result == null) result = caseNode(nodeSingleValueReference);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_MULTI_VALUE_REFERENCE: {
+ NodeMultiValueReference nodeMultiValueReference = (NodeMultiValueReference)theEObject;
+ T result = caseNodeMultiValueReference(nodeMultiValueReference);
+ if (result == null) result = caseNode(nodeMultiValueReference);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE: {
+ NodeOppositeRefOneToOne nodeOppositeRefOneToOne = (NodeOppositeRefOneToOne)theEObject;
+ T result = caseNodeOppositeRefOneToOne(nodeOppositeRefOneToOne);
+ if (result == null) result = caseNode(nodeOppositeRefOneToOne);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY: {
+ NodeOppositeRefOneToMany nodeOppositeRefOneToMany = (NodeOppositeRefOneToMany)theEObject;
+ T result = caseNodeOppositeRefOneToMany(nodeOppositeRefOneToMany);
+ if (result == null) result = caseNode(nodeOppositeRefOneToMany);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY: {
+ NodeOppositeRefManyToMany nodeOppositeRefManyToMany = (NodeOppositeRefManyToMany)theEObject;
+ T result = caseNodeOppositeRefManyToMany(nodeOppositeRefManyToMany);
+ if (result == null) result = caseNode(nodeOppositeRefManyToMany);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNode(Node object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Multiple Containment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Multiple Containment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeMultipleContainment(NodeMultipleContainment object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Single Value Containment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Single Value Containment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeSingleValueContainment(NodeSingleValueContainment object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Single Value Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Single Value Attribute</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeSingleValueAttribute(NodeSingleValueAttribute object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Multi Valued Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Multi Valued Attribute</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeMultiValuedAttribute(NodeMultiValuedAttribute object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Single Value Reference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Single Value Reference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeSingleValueReference(NodeSingleValueReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Multi Value Reference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Multi Value Reference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeMultiValueReference(NodeMultiValueReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref One To One</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref One To One</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeOppositeRefOneToOne(NodeOppositeRefOneToOne object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref One To Many</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref One To Many</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeOppositeRefOneToMany(NodeOppositeRefOneToMany object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Opposite Ref Many To Many</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Opposite Ref Many To Many</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeOppositeRefManyToMany(NodeOppositeRefManyToMany object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //NodesSwitch
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/EMFCompareTestsPlugin.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/EMFCompareTestsPlugin.java
index 6ebd41542..177dd3b2f 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/EMFCompareTestsPlugin.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/EMFCompareTestsPlugin.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class EMFCompareTestsPlugin implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- EMFCompareTestsPlugin.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- EMFCompareTestsPlugin.context = null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class EMFCompareTestsPlugin implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ EMFCompareTestsPlugin.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ EMFCompareTestsPlugin.context = null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/AbstractTestCompareCommandStack.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/AbstractTestCompareCommandStack.java
index 15a3813e2..ee672e122 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/AbstractTestCompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/AbstractTestCompareCommandStack.java
@@ -1,556 +1,556 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.emf.compare.command.ICompareCommandStack;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public abstract class AbstractTestCompareCommandStack {
-
- private ICompareCommandStack commandStack;
-
- private MockCompareCommand leftToRight1;
-
- private MockCompareCommand leftToRight2;
-
- private MockCompareCommand leftToRight3;
-
- private MockCompareCommand rightToLeft1;
-
- private MockCompareCommand rightToLeft2;
-
- private MockCompareCommand rightToLeft3;
-
- @Before
- public void before() {
- commandStack = createCommandStack();
-
- leftToRight1 = new MockCompareCommand(true);
- leftToRight2 = new MockCompareCommand(true);
- leftToRight3 = new MockCompareCommand(true);
-
- rightToLeft1 = new MockCompareCommand(false);
- rightToLeft2 = new MockCompareCommand(false);
- rightToLeft3 = new MockCompareCommand(false);
- }
-
- /**
- * @return the commandStack
- */
- protected abstract ICompareCommandStack createCommandStack();
-
- @Test
- public void testInitState() {
- assertEquals(null, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTROnce() {
- commandStack.execute(leftToRight1);
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTROnceUndo() {
- commandStack.execute(leftToRight1);
- commandStack.undo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTROnceUndoRedo() {
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.redo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwice() {
- commandStack.execute(leftToRight2);
- commandStack.execute(leftToRight1);
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndo() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(leftToRight2, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndoTwice() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.undo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndoTwiceRedo() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.undo();
- commandStack.redo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight2, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndoTwiceRedoTwice() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.undo();
- commandStack.redo();
- commandStack.redo();
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight2, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndoExecuteLTR() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.execute(leftToRight3);
-
- assertEquals(leftToRight3, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight3, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRTwiceUndoExecuteLTRUndo() {
- commandStack.execute(leftToRight1);
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.execute(leftToRight3);
- commandStack.undo();
-
- assertEquals(leftToRight3, commandStack.getMostRecentCommand());
- assertEquals(leftToRight3, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLOnce() {
- commandStack.execute(rightToLeft1);
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLOnceUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLOnceUndoRedo() {
- commandStack.execute(rightToLeft1);
- commandStack.undo();
- commandStack.redo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwice() {
- commandStack.execute(rightToLeft2);
- commandStack.execute(rightToLeft1);
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
-
- assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft2, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndoTwice() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndoTwiceRedo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.undo();
- commandStack.redo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft2, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndoTwiceRedoTwice() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.undo();
- commandStack.redo();
- commandStack.redo();
-
- assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft2, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndoExecuteRTL() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.execute(rightToLeft3);
-
- assertEquals(rightToLeft3, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft3, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLTwiceUndoExecuteRTLUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.execute(rightToLeft3);
- commandStack.undo();
-
- assertEquals(rightToLeft3, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft3, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRExecuteRTL() {
- commandStack.execute(leftToRight1);
- commandStack.execute(rightToLeft1);
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteLTRExecuteRTLUndo() {
- commandStack.execute(leftToRight1);
- commandStack.execute(rightToLeft1);
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight1, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoRedo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.redo();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteLTR() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(leftToRight2);
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight2, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertTrue(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteRTL() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(rightToLeft2);
-
- assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(rightToLeft2, commandStack.getUndoCommand());
- assertFalse(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteRTLUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(rightToLeft2);
- commandStack.undo();
-
- assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft2, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteRTLUndoUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(rightToLeft2);
- commandStack.undo();
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteLTRUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(leftToRight2);
- commandStack.undo();
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(leftToRight2, commandStack.getRedoCommand());
- assertEquals(rightToLeft1, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertTrue(commandStack.canUndo());
- assertTrue(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-
- @Test
- public void testExecuteRTLExecuteLTRUndoExecuteLTRUndoUndo() {
- commandStack.execute(rightToLeft1);
- commandStack.execute(leftToRight1);
- commandStack.undo();
- commandStack.execute(leftToRight2);
- commandStack.undo();
- commandStack.undo();
-
- assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
- assertEquals(rightToLeft1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertTrue(commandStack.canRedo());
- assertFalse(commandStack.canUndo());
- assertFalse(commandStack.isLeftSaveNeeded());
- assertFalse(commandStack.isRightSaveNeeded());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.emf.compare.command.ICompareCommandStack;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public abstract class AbstractTestCompareCommandStack {
+
+ private ICompareCommandStack commandStack;
+
+ private MockCompareCommand leftToRight1;
+
+ private MockCompareCommand leftToRight2;
+
+ private MockCompareCommand leftToRight3;
+
+ private MockCompareCommand rightToLeft1;
+
+ private MockCompareCommand rightToLeft2;
+
+ private MockCompareCommand rightToLeft3;
+
+ @Before
+ public void before() {
+ commandStack = createCommandStack();
+
+ leftToRight1 = new MockCompareCommand(true);
+ leftToRight2 = new MockCompareCommand(true);
+ leftToRight3 = new MockCompareCommand(true);
+
+ rightToLeft1 = new MockCompareCommand(false);
+ rightToLeft2 = new MockCompareCommand(false);
+ rightToLeft3 = new MockCompareCommand(false);
+ }
+
+ /**
+ * @return the commandStack
+ */
+ protected abstract ICompareCommandStack createCommandStack();
+
+ @Test
+ public void testInitState() {
+ assertEquals(null, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTROnce() {
+ commandStack.execute(leftToRight1);
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTROnceUndo() {
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTROnceUndoRedo() {
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.redo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwice() {
+ commandStack.execute(leftToRight2);
+ commandStack.execute(leftToRight1);
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndo() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight2, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndoTwice() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.undo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndoTwiceRedo() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.undo();
+ commandStack.redo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight2, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndoTwiceRedoTwice() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.undo();
+ commandStack.redo();
+ commandStack.redo();
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight2, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndoExecuteLTR() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.execute(leftToRight3);
+
+ assertEquals(leftToRight3, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight3, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRTwiceUndoExecuteLTRUndo() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.execute(leftToRight3);
+ commandStack.undo();
+
+ assertEquals(leftToRight3, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight3, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLOnce() {
+ commandStack.execute(rightToLeft1);
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLOnceUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLOnceUndoRedo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.undo();
+ commandStack.redo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwice() {
+ commandStack.execute(rightToLeft2);
+ commandStack.execute(rightToLeft1);
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+
+ assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft2, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndoTwice() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndoTwiceRedo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.undo();
+ commandStack.redo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft2, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndoTwiceRedoTwice() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.undo();
+ commandStack.redo();
+ commandStack.redo();
+
+ assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft2, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndoExecuteRTL() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.execute(rightToLeft3);
+
+ assertEquals(rightToLeft3, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft3, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLTwiceUndoExecuteRTLUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.execute(rightToLeft3);
+ commandStack.undo();
+
+ assertEquals(rightToLeft3, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft3, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRExecuteRTL() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(rightToLeft1);
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteLTRExecuteRTLUndo() {
+ commandStack.execute(leftToRight1);
+ commandStack.execute(rightToLeft1);
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight1, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoRedo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.redo();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteLTR() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(leftToRight2);
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight2, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertTrue(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteRTL() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(rightToLeft2);
+
+ assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(rightToLeft2, commandStack.getUndoCommand());
+ assertFalse(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteRTLUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+
+ assertEquals(rightToLeft2, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft2, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteRTLUndoUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(rightToLeft2);
+ commandStack.undo();
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteLTRUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight2, commandStack.getRedoCommand());
+ assertEquals(rightToLeft1, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertTrue(commandStack.canUndo());
+ assertTrue(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+
+ @Test
+ public void testExecuteRTLExecuteLTRUndoExecuteLTRUndoUndo() {
+ commandStack.execute(rightToLeft1);
+ commandStack.execute(leftToRight1);
+ commandStack.undo();
+ commandStack.execute(leftToRight2);
+ commandStack.undo();
+ commandStack.undo();
+
+ assertEquals(rightToLeft1, commandStack.getMostRecentCommand());
+ assertEquals(rightToLeft1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertTrue(commandStack.canRedo());
+ assertFalse(commandStack.canUndo());
+ assertFalse(commandStack.isLeftSaveNeeded());
+ assertFalse(commandStack.isRightSaveNeeded());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/CommandStackTestSuite.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/CommandStackTestSuite.java
index 4aea29309..d5373f800 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/CommandStackTestSuite.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/CommandStackTestSuite.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-@RunWith(Suite.class)
-@SuiteClasses(value = {TestCompareCommandStack.class, TestCompareSideCommandStack.class,
- TestDualCompareCommandStack.class, })
-public class CommandStackTestSuite {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+@RunWith(Suite.class)
+@SuiteClasses(value = {TestCompareCommandStack.class, TestCompareSideCommandStack.class,
+ TestDualCompareCommandStack.class, })
+public class CommandStackTestSuite {
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/MockCompareCommand.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/MockCompareCommand.java
index cafc0bc35..93615ccfb 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/MockCompareCommand.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/MockCompareCommand.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.command.ICompareCopyCommand;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class MockCompareCommand implements ICompareCopyCommand {
-
- private final boolean leftToRight;
-
- public MockCompareCommand(boolean leftToRight) {
- this.leftToRight = leftToRight;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#canExecute()
- */
- public boolean canExecute() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#execute()
- */
- public void execute() {
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#canUndo()
- */
- public boolean canUndo() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#undo()
- */
- public void undo() {
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#redo()
- */
- public void redo() {
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#getResult()
- */
- public Collection<?> getResult() {
- return new ArrayList<Object>();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#getAffectedObjects()
- */
- public Collection<?> getAffectedObjects() {
- return new ArrayList<Object>();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#getLabel()
- */
- public String getLabel() {
- return MockCompareCommand.class.getName();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#getDescription()
- */
- public String getDescription() {
- return MockCompareCommand.class.getName();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#dispose()
- */
- public void dispose() {
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.common.command.Command#chain(org.eclipse.emf.common.command.Command)
- */
- public Command chain(Command command) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.command.ICompareCopyCommand#isLeftToRight()
- */
- public boolean isLeftToRight() {
- return leftToRight;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.command.ICompareCopyCommand;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class MockCompareCommand implements ICompareCopyCommand {
+
+ private final boolean leftToRight;
+
+ public MockCompareCommand(boolean leftToRight) {
+ this.leftToRight = leftToRight;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#canExecute()
+ */
+ public boolean canExecute() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ */
+ public void execute() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#canUndo()
+ */
+ public boolean canUndo() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#undo()
+ */
+ public void undo() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ public void redo() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#getResult()
+ */
+ public Collection<?> getResult() {
+ return new ArrayList<Object>();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#getAffectedObjects()
+ */
+ public Collection<?> getAffectedObjects() {
+ return new ArrayList<Object>();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#getLabel()
+ */
+ public String getLabel() {
+ return MockCompareCommand.class.getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#getDescription()
+ */
+ public String getDescription() {
+ return MockCompareCommand.class.getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#dispose()
+ */
+ public void dispose() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#chain(org.eclipse.emf.common.command.Command)
+ */
+ public Command chain(Command command) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.command.ICompareCopyCommand#isLeftToRight()
+ */
+ public boolean isLeftToRight() {
+ return leftToRight;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareCommandStack.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareCommandStack.java
index 4227834b6..c6531d0f3 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareCommandStack.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.compare.command.ICompareCommandStack;
-import org.eclipse.emf.compare.command.impl.CompareCommandStack;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class TestCompareCommandStack extends AbstractTestCompareCommandStack {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.tests.command.AbstractTestCompareCommandStack#createCommandStack()
- */
- @Override
- protected ICompareCommandStack createCommandStack() {
- return new CompareCommandStack(new BasicCommandStack());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.compare.command.ICompareCommandStack;
+import org.eclipse.emf.compare.command.impl.CompareCommandStack;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class TestCompareCommandStack extends AbstractTestCompareCommandStack {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.tests.command.AbstractTestCompareCommandStack#createCommandStack()
+ */
+ @Override
+ protected ICompareCommandStack createCommandStack() {
+ return new CompareCommandStack(new BasicCommandStack());
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareSideCommandStack.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareSideCommandStack.java
index 951bbe9ae..302b3e3b2 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareSideCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestCompareSideCommandStack.java
@@ -1,190 +1,190 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.emf.compare.command.impl.CompareCommandStack.CompareSideCommandStack;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class TestCompareSideCommandStack {
-
- private MockCompareCommand leftToRight1;
-
- private MockCompareCommand leftToRight2;
-
- private CompareSideCommandStack commandStack;
-
- private MockCompareCommand leftToRight3;
-
- @Before
- public void before() {
- commandStack = new CompareSideCommandStack();
- leftToRight1 = new MockCompareCommand(true);
- leftToRight2 = new MockCompareCommand(true);
- leftToRight3 = new MockCompareCommand(true);
- }
-
- @Test
- public void testInitState() {
- assertEquals(null, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertFalse(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedOnce() {
- commandStack.executed(leftToRight1);
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedOnceUndo() {
- commandStack.executed(leftToRight1);
- commandStack.undone();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertFalse(commandStack.isSaveNeeded());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testExecutedOnceUndoTwice() {
- commandStack.executed(leftToRight1);
- commandStack.undone();
- commandStack.undone();
- }
-
- @Test
- public void testExecutedOnceUndoRedo() {
- commandStack.executed(leftToRight1);
- commandStack.undone();
- commandStack.redone();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwice() {
- commandStack.executed(leftToRight2);
- commandStack.executed(leftToRight1);
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwiceUndo() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(leftToRight2, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwiceUndoTwice() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.undone();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight1, commandStack.getRedoCommand());
- assertEquals(null, commandStack.getUndoCommand());
- assertFalse(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwiceUndoTwiceRedo() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.undone();
- commandStack.redone();
-
- assertEquals(leftToRight1, commandStack.getMostRecentCommand());
- assertEquals(leftToRight2, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwiceUndoTwiceRedoTwice() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.undone();
- commandStack.redone();
- commandStack.redone();
-
- assertEquals(leftToRight2, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight2, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test
- public void testExecutedTwiceUndoExecuted() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.executed(leftToRight3);
-
- assertEquals(leftToRight3, commandStack.getMostRecentCommand());
- assertEquals(null, commandStack.getRedoCommand());
- assertEquals(leftToRight3, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testExecutedTwiceUndoExecutedRedo() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.executed(leftToRight3);
- commandStack.redone();
- }
-
- @Test
- public void testExecutedTwiceUndoExecutedUndo() {
- commandStack.executed(leftToRight1);
- commandStack.executed(leftToRight2);
- commandStack.undone();
- commandStack.executed(leftToRight3);
- commandStack.undone();
-
- assertEquals(leftToRight3, commandStack.getMostRecentCommand());
- assertEquals(leftToRight3, commandStack.getRedoCommand());
- assertEquals(leftToRight1, commandStack.getUndoCommand());
- assertTrue(commandStack.isSaveNeeded());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.emf.compare.command.impl.CompareCommandStack.CompareSideCommandStack;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class TestCompareSideCommandStack {
+
+ private MockCompareCommand leftToRight1;
+
+ private MockCompareCommand leftToRight2;
+
+ private CompareSideCommandStack commandStack;
+
+ private MockCompareCommand leftToRight3;
+
+ @Before
+ public void before() {
+ commandStack = new CompareSideCommandStack();
+ leftToRight1 = new MockCompareCommand(true);
+ leftToRight2 = new MockCompareCommand(true);
+ leftToRight3 = new MockCompareCommand(true);
+ }
+
+ @Test
+ public void testInitState() {
+ assertEquals(null, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertFalse(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedOnce() {
+ commandStack.executed(leftToRight1);
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedOnceUndo() {
+ commandStack.executed(leftToRight1);
+ commandStack.undone();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertFalse(commandStack.isSaveNeeded());
+ }
+
+ @Test(expected = IndexOutOfBoundsException.class)
+ public void testExecutedOnceUndoTwice() {
+ commandStack.executed(leftToRight1);
+ commandStack.undone();
+ commandStack.undone();
+ }
+
+ @Test
+ public void testExecutedOnceUndoRedo() {
+ commandStack.executed(leftToRight1);
+ commandStack.undone();
+ commandStack.redone();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwice() {
+ commandStack.executed(leftToRight2);
+ commandStack.executed(leftToRight1);
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwiceUndo() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight2, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwiceUndoTwice() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.undone();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight1, commandStack.getRedoCommand());
+ assertEquals(null, commandStack.getUndoCommand());
+ assertFalse(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwiceUndoTwiceRedo() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.undone();
+ commandStack.redone();
+
+ assertEquals(leftToRight1, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight2, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwiceUndoTwiceRedoTwice() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.undone();
+ commandStack.redone();
+ commandStack.redone();
+
+ assertEquals(leftToRight2, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight2, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test
+ public void testExecutedTwiceUndoExecuted() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.executed(leftToRight3);
+
+ assertEquals(leftToRight3, commandStack.getMostRecentCommand());
+ assertEquals(null, commandStack.getRedoCommand());
+ assertEquals(leftToRight3, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+
+ @Test(expected = IndexOutOfBoundsException.class)
+ public void testExecutedTwiceUndoExecutedRedo() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.executed(leftToRight3);
+ commandStack.redone();
+ }
+
+ @Test
+ public void testExecutedTwiceUndoExecutedUndo() {
+ commandStack.executed(leftToRight1);
+ commandStack.executed(leftToRight2);
+ commandStack.undone();
+ commandStack.executed(leftToRight3);
+ commandStack.undone();
+
+ assertEquals(leftToRight3, commandStack.getMostRecentCommand());
+ assertEquals(leftToRight3, commandStack.getRedoCommand());
+ assertEquals(leftToRight1, commandStack.getUndoCommand());
+ assertTrue(commandStack.isSaveNeeded());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestDualCompareCommandStack.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestDualCompareCommandStack.java
index 13d4d3913..87ad0b687 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestDualCompareCommandStack.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/command/TestDualCompareCommandStack.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.command;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.compare.command.ICompareCommandStack;
-import org.eclipse.emf.compare.command.impl.DualCompareCommandStack;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class TestDualCompareCommandStack extends AbstractTestCompareCommandStack {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.tests.command.AbstractTestCompareCommandStack#createCommandStack()
- */
- @Override
- protected ICompareCommandStack createCommandStack() {
- return new DualCompareCommandStack(new BasicCommandStack(), new BasicCommandStack());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.command;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.compare.command.ICompareCommandStack;
+import org.eclipse.emf.compare.command.impl.DualCompareCommandStack;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class TestDualCompareCommandStack extends AbstractTestCompareCommandStack {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.tests.command.AbstractTestCompareCommandStack#createCommandStack()
+ */
+ @Override
+ protected ICompareCommandStack createCommandStack() {
+ return new DualCompareCommandStack(new BasicCommandStack(), new BasicCommandStack());
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
index ce82aa58e..5fad59357 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
@@ -1,2168 +1,2168 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.conflict;
-
-import static com.google.common.base.Predicates.and;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Conflict;
-import org.eclipse.emf.compare.ConflictKind;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.conflict.data.ConflictInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ConflictDetectionTest {
- private ConflictInputData input = new ConflictInputData();
-
- @Test
- public void testA1UseCaseForAttribute() throws IOException {
- final Resource left = input.getA1AttributeLeft();
- final Resource origin = input.getA1AttributeOrigin();
- final Resource right = input.getA1AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", "left");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testA1UseCaseForReference() throws IOException {
- final Resource left = input.getA1ReferenceLeft();
- final Resource origin = input.getA1ReferenceOrigin();
- final Resource right = input.getA1ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We have three diffs here : an object has been deleted on the right side, its reference has been
- * unset, and that same reference has been changed on the left to a new value. The two diffs on the
- * right are in conflict with the only diff on the left.
- */
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", "root.left");
- final Predicate<? super Diff> rightReferenceDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightReferenceDiff);
- assertNotNull(rightDeleteDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testA2UseCaseForAttribute() throws IOException {
- final Resource left = input.getA2AttributeLeft();
- final Resource origin = input.getA2AttributeOrigin();
- final Resource right = input.getA2AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", null, "left");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testA2UseCaseForReference() throws IOException {
- final Resource left = input.getA2ReferenceLeft();
- final Resource origin = input.getA2ReferenceOrigin();
- final Resource right = input.getA2ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.left");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testA3UseCaseForAttribute() throws IOException {
- final Resource left = input.getA3AttributeLeft();
- final Resource origin = input.getA3AttributeOrigin();
- final Resource right = input.getA3AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", null);
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testA3UseCaseForReference() throws IOException {
- final Resource left = input.getA3ReferenceLeft();
- final Resource origin = input.getA3ReferenceOrigin();
- final Resource right = input.getA3ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect three differences here : an object has been deleted on the right, its reference has been
- * unset, and that same reference has been unset on the left. All three diffs are in pseudo-conflict
- * with each other.
- */
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
- final Predicate<? super Diff> rightReferenceDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightReferenceDiff);
- assertNotNull(rightDeleteDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testB1UseCaseForAttribute() throws IOException {
- final Resource left = input.getB1AttributeLeft();
- final Resource origin = input.getB1AttributeOrigin();
- final Resource right = input.getB1AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", "left");
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", "right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB1UseCaseForReference() throws IOException {
- final Resource left = input.getB1ReferenceLeft();
- final Resource origin = input.getB1ReferenceOrigin();
- final Resource right = input.getB1ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", "root.left");
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", "root.right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB2UseCaseForAttribute() throws IOException {
- final Resource left = input.getB2AttributeLeft();
- final Resource origin = input.getB2AttributeOrigin();
- final Resource right = input.getB2AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", "left");
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", null);
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB2UseCaseForReference() throws IOException {
- final Resource left = input.getB2ReferenceLeft();
- final Resource origin = input.getB2ReferenceOrigin();
- final Resource right = input.getB2ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", "root.left");
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB3UseCaseForAttribute() throws IOException {
- final Resource left = input.getB3AttributeLeft();
- final Resource origin = input.getB3AttributeOrigin();
- final Resource right = input.getB3AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", null, "left");
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", null, "right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB3UseCaseForReference() throws IOException {
- final Resource left = input.getB3ReferenceLeft();
- final Resource origin = input.getB3ReferenceOrigin();
- final Resource right = input.getB3ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.left");
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB4UseCaseForAttribute() throws IOException {
- final Resource left = input.getB4AttributeLeft();
- final Resource origin = input.getB4AttributeOrigin();
- final Resource right = input.getB4AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", null);
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", "right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB4UseCaseForReference() throws IOException {
- final Resource left = input.getB4ReferenceLeft();
- final Resource origin = input.getB4ReferenceOrigin();
- final Resource right = input.getB4ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", "root.right");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testB5UseCaseForAttribute() throws IOException {
- final Resource left = input.getB5AttributeLeft();
- final Resource origin = input.getB5AttributeOrigin();
- final Resource right = input.getB5AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", null, "leftAndRight");
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", null, "leftAndRight");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testB5UseCaseForReference() throws IOException {
- final Resource left = input.getB5ReferenceLeft();
- final Resource origin = input.getB5ReferenceOrigin();
- final Resource right = input.getB5ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.leftAndRight");
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.leftAndRight");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testB6UseCaseForAttribute() throws IOException {
- final Resource left = input.getB6AttributeLeft();
- final Resource origin = input.getB6AttributeOrigin();
- final Resource right = input.getB6AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", null);
- final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
- "singleValuedAttribute", "origin", null);
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testB6UseCaseForReference() throws IOException {
- final Resource left = input.getB6ReferenceLeft();
- final Resource origin = input.getB6ReferenceOrigin();
- final Resource right = input.getB6ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
- final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", "root.origin", null);
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testC1UseCaseForAttribute() throws IOException {
- final Resource left = input.getC1AttributeLeft();
- final Resource origin = input.getC1AttributeOrigin();
- final Resource right = input.getC1AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = addedToAttribute("root.conflictHolder",
- "multiValuedAttribute", "left1");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testC1UseCaseForReference() throws IOException {
- final Resource left = input.getC1ReferenceLeft();
- final Resource origin = input.getC1ReferenceOrigin();
- final Resource right = input.getC1ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We should have 5 differences here. An element has been deleted from the right side, all three of
- * its reference's values have been deleted, and finally a value has been added into that same
- * reference on the left side. The addition of a value into the reference conflicts with the removal
- * of the container from the right. The three other diffs do not conflict.
- */
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = addedToReference("root.conflictHolder",
- "multiValuedReference", "root.left1");
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
- final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin2");
- final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin3");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
- final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
- final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
- final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightDeleteDiff);
- assertNotNull(rightReferenceDiff1);
- assertNotNull(rightReferenceDiff2);
- assertNotNull(rightReferenceDiff3);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testC2UseCaseForAttribute() throws IOException {
- final Resource left = input.getC2AttributeLeft();
- final Resource origin = input.getC2AttributeOrigin();
- final Resource right = input.getC2AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testC2UseCaseForReference() throws IOException {
- final Resource left = input.getC2ReferenceLeft();
- final Resource origin = input.getC2ReferenceOrigin();
- final Resource right = input.getC2ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We should have 5 differences here. An element has been deleted from the right side, all three of
- * its reference's values have been deleted, and finally a value has been removed from that same
- * reference on the left side. The deletion of a value into the left reference conflicts with the
- * removal of the container from the right. It is also in pseudo-conflict with the deletion of this
- * same value on the right.
- */
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
- final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin2");
- final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin3");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
- final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
- final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
- final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightDeleteDiff);
- assertNotNull(rightReferenceDiff1);
- assertNotNull(rightReferenceDiff2);
- assertNotNull(rightReferenceDiff3);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertTrue(conflictDiff.contains(rightReferenceDiff1));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testC3UseCaseForAttribute() throws IOException {
- final Resource left = input.getC3AttributeLeft();
- final Resource origin = input.getC3AttributeOrigin();
- final Resource right = input.getC3AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = addedToAttribute("root.conflictHolder",
- "multiValuedAttribute", "left1");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testC3UseCaseForReference() throws IOException {
- final Resource left = input.getC3ReferenceLeft();
- final Resource origin = input.getC3ReferenceOrigin();
- final Resource right = input.getC3ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = addedToReference("root.conflictHolder",
- "multiValuedReference", "root.left1");
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightDeleteDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testC4UseCaseForAttribute() throws IOException {
- final Resource left = input.getC4AttributeLeft();
- final Resource origin = input.getC4AttributeOrigin();
- final Resource right = input.getC4AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect 4 differences here. On the right side, an element has been deleted. On the left side, all
- * three values of one of this element's features have been removed. All three diffs on the left are
- * in conflict with the right diff.
- */
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftAttributeDiff1Description = removedFromAttribute(
- "root.conflictHolder", "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> leftAttributeDiff2Description = removedFromAttribute(
- "root.conflictHolder", "multiValuedAttribute", "origin2");
- final Predicate<? super Diff> leftAttributeDiff3Description = removedFromAttribute(
- "root.conflictHolder", "multiValuedAttribute", "origin3");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftAttributeDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftAttributeDiff1Description));
- final Diff leftAttributeDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftAttributeDiff2Description));
- final Diff leftAttributeDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftAttributeDiff3Description));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftAttributeDiff1);
- assertNotNull(leftAttributeDiff2);
- assertNotNull(leftAttributeDiff3);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(4), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftAttributeDiff1));
- assertTrue(conflictDiff.contains(leftAttributeDiff2));
- assertTrue(conflictDiff.contains(leftAttributeDiff3));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testC4UseCaseForReference() throws IOException {
- final Resource left = input.getC4ReferenceLeft();
- final Resource origin = input.getC4ReferenceOrigin();
- final Resource right = input.getC4ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect 7 differences here. On the right, an element has been deleted. All three values of this
- * element's reference have been removed. On the left, we've also removed all three values of that
- * same reference. All 7 differences are in pseudo-conflict with each other.
- */
- assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> referenceDiff1Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> referenceDiff2Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin2");
- final Predicate<? super Diff> referenceDiff3Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin3");
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
-
- final Diff leftReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff1Description));
- final Diff leftReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff2Description));
- final Diff leftReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff3Description));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
- final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff1Description));
- final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff2Description));
- final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff3Description));
-
- assertNotNull(leftReferenceDiff1);
- assertNotNull(leftReferenceDiff2);
- assertNotNull(leftReferenceDiff3);
- assertNotNull(rightDeleteDiff);
- assertNotNull(rightReferenceDiff1);
- assertNotNull(rightReferenceDiff2);
- assertNotNull(rightReferenceDiff3);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(7), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff1));
- assertTrue(conflictDiff.contains(leftReferenceDiff2));
- assertTrue(conflictDiff.contains(leftReferenceDiff3));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertTrue(conflictDiff.contains(rightReferenceDiff1));
- assertTrue(conflictDiff.contains(rightReferenceDiff2));
- assertTrue(conflictDiff.contains(rightReferenceDiff3));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testC5UseCaseForAttribute() throws IOException {
- final Resource left = input.getC5AttributeLeft();
- final Resource origin = input.getC5AttributeOrigin();
- final Resource right = input.getC5AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testC5UseCaseForReference() throws IOException {
- final Resource left = input.getC5ReferenceLeft();
- final Resource origin = input.getC5ReferenceOrigin();
- final Resource right = input.getC5ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect five differences here. An element has been deleted from the right side, all three values
- * of its reference have been deleted too. In the left, we've moved one of these values to another
- * index. The MOVE conflicts with both the container deletion and the value's removal.
- */
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftReferenceDiffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
- final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin2");
- final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
- "root.conflictHolder", "multiValuedReference", "root.origin2");
-
- final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
- final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
- final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
- final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
- final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
-
- assertNotNull(leftReferenceDiff);
- assertNotNull(rightDeleteDiff);
- assertNotNull(rightReferenceDiff1);
- assertNotNull(rightReferenceDiff2);
- assertNotNull(rightReferenceDiff3);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftReferenceDiff));
- assertTrue(conflictDiff.contains(rightDeleteDiff));
- assertTrue(conflictDiff.contains(rightReferenceDiff1));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD1UseCaseForAttribute() throws IOException {
- final Resource left = input.getD1AttributeLeft();
- final Resource origin = input.getD1AttributeOrigin();
- final Resource right = input.getD1AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> rightDiffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD1UseCaseForReference() throws IOException {
- final Resource left = input.getD1ReferenceLeft();
- final Resource origin = input.getD1ReferenceOrigin();
- final Resource right = input.getD1ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightDiffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD2UseCaseForAttribute() throws IOException {
- final Resource left = input.getD2AttributeLeft();
- final Resource origin = input.getD2AttributeOrigin();
- final Resource right = input.getD2AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> rightDiffDescription = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD2UseCaseForReference() throws IOException {
- final Resource left = input.getD2ReferenceLeft();
- final Resource origin = input.getD2ReferenceOrigin();
- final Resource right = input.getD2ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightDiffDescription = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD3UseCaseForAttribute() throws IOException {
- final Resource left = input.getD3AttributeLeft();
- final Resource origin = input.getD3AttributeOrigin();
- final Resource right = input.getD3AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> rightDiffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD3UseCaseForReference() throws IOException {
- final Resource left = input.getD3ReferenceLeft();
- final Resource origin = input.getD3ReferenceOrigin();
- final Resource right = input.getD3ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> rightDiffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testD4UseCaseForAttribute() throws IOException {
- final Resource left = input.getD4AttributeLeft();
- final Resource origin = input.getD4AttributeOrigin();
- final Resource right = input.getD4AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect 6 differences here. On both right and left, we've emptied an attribute from its 3 values.
- * This should give use 3 pseudo-conflict, each removal conflicting with its other side.
- */
- assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(3), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> AttributeDiff1Description = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
- final Predicate<? super Diff> AttributeDiff2Description = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin2");
- final Predicate<? super Diff> AttributeDiff3Description = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin3");
-
- final Diff leftAttributeDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), AttributeDiff1Description));
- final Diff leftAttributeDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), AttributeDiff2Description));
- final Diff leftAttributeDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), AttributeDiff3Description));
-
- final Diff rightAttributeDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), AttributeDiff1Description));
- final Diff rightAttributeDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), AttributeDiff2Description));
- final Diff rightAttributeDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), AttributeDiff3Description));
-
- assertNotNull(leftAttributeDiff1);
- assertNotNull(leftAttributeDiff2);
- assertNotNull(leftAttributeDiff3);
- assertNotNull(rightAttributeDiff1);
- assertNotNull(rightAttributeDiff2);
- assertNotNull(rightAttributeDiff3);
-
- // We know we have three conflicts
- final Conflict conflict1 = conflicts.get(0);
-
- final List<Diff> conflictDiffs1 = conflict1.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs1.size()));
- assertTrue(conflictDiffs1.contains(leftAttributeDiff1));
- assertTrue(conflictDiffs1.contains(rightAttributeDiff1));
- assertSame(ConflictKind.PSEUDO, conflict1.getKind());
-
- final Conflict conflict2 = conflicts.get(1);
-
- final List<Diff> conflictDiffs2 = conflict2.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs2.size()));
- assertTrue(conflictDiffs2.contains(leftAttributeDiff2));
- assertTrue(conflictDiffs2.contains(rightAttributeDiff2));
- assertSame(ConflictKind.PSEUDO, conflict2.getKind());
-
- final Conflict conflict3 = conflicts.get(2);
-
- final List<Diff> conflictDiffs3 = conflict3.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs3.size()));
- assertTrue(conflictDiffs3.contains(leftAttributeDiff3));
- assertTrue(conflictDiffs3.contains(rightAttributeDiff3));
- assertSame(ConflictKind.PSEUDO, conflict3.getKind());
- }
-
- @Test
- public void testD4UseCaseForReference() throws IOException {
- final Resource left = input.getD4ReferenceLeft();
- final Resource origin = input.getD4ReferenceOrigin();
- final Resource right = input.getD4ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * We expect 6 differences here. On both right and left, we've emptied a reference from its 3 values.
- * This should give use 3 pseudo-conflict, each removal conflicting with its other side.
- */
- assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(3), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> referenceDiff1Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
- final Predicate<? super Diff> referenceDiff2Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin2");
- final Predicate<? super Diff> referenceDiff3Description = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin3");
-
- final Diff leftReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff1Description));
- final Diff leftReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff2Description));
- final Diff leftReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), referenceDiff3Description));
-
- final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff1Description));
- final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff2Description));
- final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), referenceDiff3Description));
-
- assertNotNull(leftReferenceDiff1);
- assertNotNull(leftReferenceDiff2);
- assertNotNull(leftReferenceDiff3);
- assertNotNull(rightReferenceDiff1);
- assertNotNull(rightReferenceDiff2);
- assertNotNull(rightReferenceDiff3);
-
- // We know we have three conflicts
- final Conflict conflict1 = conflicts.get(0);
-
- final List<Diff> conflictDiffs1 = conflict1.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs1.size()));
- assertTrue(conflictDiffs1.contains(leftReferenceDiff1));
- assertTrue(conflictDiffs1.contains(rightReferenceDiff1));
- assertSame(ConflictKind.PSEUDO, conflict1.getKind());
-
- final Conflict conflict2 = conflicts.get(1);
-
- final List<Diff> conflictDiffs2 = conflict2.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs2.size()));
- assertTrue(conflictDiffs2.contains(leftReferenceDiff2));
- assertTrue(conflictDiffs2.contains(rightReferenceDiff2));
- assertSame(ConflictKind.PSEUDO, conflict2.getKind());
-
- final Conflict conflict3 = conflicts.get(2);
-
- final List<Diff> conflictDiffs3 = conflict3.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs3.size()));
- assertTrue(conflictDiffs3.contains(leftReferenceDiff3));
- assertTrue(conflictDiffs3.contains(rightReferenceDiff3));
- assertSame(ConflictKind.PSEUDO, conflict3.getKind());
- }
-
- @Test
- public void testD5UseCaseForAttribute() throws IOException {
- final Resource left = input.getD5AttributeLeft();
- final Resource origin = input.getD5AttributeOrigin();
- final Resource right = input.getD5AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> diffDescription = removedFromAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- diffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- diffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testD5UseCaseForReference() throws IOException {
- final Resource left = input.getD5ReferenceLeft();
- final Resource origin = input.getD5ReferenceOrigin();
- final Resource right = input.getD5ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> diffDescription = removedFromReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- diffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- diffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testD6UseCaseForAttribute() throws IOException {
- final Resource left = input.getD6AttributeLeft();
- final Resource origin = input.getD6AttributeOrigin();
- final Resource right = input.getD6AttributeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> diffDescription = movedInAttribute("root.conflictHolder",
- "multiValuedAttribute", "origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- diffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- diffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testD6UseCaseForReference() throws IOException {
- final Resource left = input.getD6ReferenceLeft();
- final Resource origin = input.getD6ReferenceOrigin();
- final Resource right = input.getD6ReferenceRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> diffDescription = movedInReference("root.conflictHolder",
- "multiValuedReference", "root.origin1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- diffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- diffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- }
-
- @Test
- public void testE1UseCase() throws IOException {
- final Resource left = input.getE1Left();
- final Resource origin = input.getE1Origin();
- final Resource right = input.getE1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
- "singleValuedReference", null, "root.origin");
- final Predicate<? super Diff> rightDiffDescription = removed("root.origin");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testE2UseCase() throws IOException {
- final Resource left = input.getE2Left();
- final Resource origin = input.getE2Origin();
- final Resource right = input.getE2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = addedToReference("root.conflictHolder",
- "multiValuedReference", "root.origin");
- final Predicate<? super Diff> rightDiffDescription = removed("root.origin");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testFUseCase() throws IOException {
- final Resource left = input.getFLeft();
- final Resource origin = input.getFOrigin();
- final Resource right = input.getFRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = moved("root.conflictHolder.origin",
- "containmentRef2");
- final Predicate<? super Diff> rightDiffDescription = moved("root.conflictHolder.origin",
- "containmentRef3");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testGUseCase() throws IOException {
- final Resource left = input.getGLeft();
- final Resource origin = input.getGOrigin();
- final Resource right = input.getGRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = moved("root.leftContainer.conflictNode",
- "containmentRef1");
- final Predicate<? super Diff> rightDiffDescription = moved("root.rightContainer.conflictNode",
- "containmentRef1");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testH1UseCase() throws IOException {
- final Resource left = input.getH1Left();
- final Resource origin = input.getH1Origin();
- final Resource right = input.getH1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = moved("root.left.conflictNode",
- "singleValueContainment");
- final Predicate<? super Diff> rightDiffDescription = removed("root.left");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testH2UseCase() throws IOException {
- final Resource left = input.getH2Left();
- final Resource origin = input.getH2Origin();
- final Resource right = input.getH2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- // We should have no less and no more than 2 differences, composing a single conflict
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiffDescription = moved("root.leftContainer.conflictNode",
- "containmentRef1");
- final Predicate<? super Diff> rightDiffDescription = removed("root.leftContainer");
-
- final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiffDescription));
- final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiffDescription));
-
- assertNotNull(leftDiff);
- assertNotNull(rightDiff);
-
- // We know there's only one conflict
- final Conflict conflict = conflicts.get(0);
-
- final List<Diff> conflictDiff = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
- assertTrue(conflictDiff.contains(leftDiff));
- assertTrue(conflictDiff.contains(rightDiff));
- assertSame(ConflictKind.REAL, conflict.getKind());
- }
-
- @Test
- public void testIUseCase() throws IOException {
- final Resource left = input.getILeft();
- final Resource origin = input.getIOrigin();
- final Resource right = input.getIRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- Conflict soleConflict = conflicts.get(0);
- assertSame(ConflictKind.PSEUDO, soleConflict.getKind());
- }
-
- @Test
- public void testJUseCase() throws IOException {
- final Resource left = input.getJLeft();
- final Resource origin = input.getJOrigin();
- final Resource right = input.getJRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
-
- Conflict soleConflict = conflicts.get(0);
- assertSame(ConflictKind.PSEUDO, soleConflict.getKind());
- }
-
- @Test
- public void testComplexUseCase() throws IOException {
- final Resource left = input.getComplexLeft();
- final Resource origin = input.getComplexOrigin();
- final Resource right = input.getComplexRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final List<Conflict> conflicts = comparison.getConflicts();
-
- /*
- * This use case features 12 distinct differences of all types, adding up to 4 real conflict and 1
- * pseudo conflicts.
- */
- // 1 - Left : Node8 added
- // 2 - Left : Node9 added
- // 3 - Left : Node1 moved
- // 4 - Left : Node0 added
- // 5 - Left : Node5 removed
- // 6 - Left : Node6 removed
- // 7 - Left : Node7 removed
-
- // 8 - Right : Node6 moved
- // 9 - Right : Node9 added
- // 10 - Right : Node0 added
- // 11 - Right : Node1 moved
- // 12 - Right : Node5 removed
-
- // Real conflict : 6 and 8 (Moving and deleting the same value)
- // Real conflict : 2 and 9 (Adding the same value at different indices)
- // Real conflict : 4 and 10 (Adding the same value at different indices)
- // Real conflict : 3 and 11 (Moving the same value to different indices)
-
- // Pseudo conflict : 5 and 12 (Removing the same value on both sides)
-
- assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
- assertSame(Integer.valueOf(5), Integer.valueOf(conflicts.size()));
-
- final Predicate<? super Diff> leftDiff1Description = added("Root.Node8");
- final Predicate<? super Diff> leftDiff2Description = added("Root.Node9");
- final Predicate<? super Diff> leftDiff3Description = moved("Root.Node1", "containmentRef1");
- final Predicate<? super Diff> leftDiff4Description = added("Root.Node0");
- final Predicate<? super Diff> leftDiff5Description = removed("Root.Node5");
- final Predicate<? super Diff> leftDiff6Description = removed("Root.Node6");
- final Predicate<? super Diff> leftDiff7Description = removed("Root.Node7");
-
- final Predicate<? super Diff> rightDiff8Description = moved("Root.Node6", "containmentRef1");
- final Predicate<? super Diff> rightDiff9Description = added("Root.Node9");
- final Predicate<? super Diff> rightDiff10Description = added("Root.Node0");
- final Predicate<? super Diff> rightDiff11Description = moved("Root.Node1", "containmentRef1");
- final Predicate<? super Diff> rightDiff12Description = removed("Root.Node5");
-
- final Diff leftDiff1 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff1Description));
- final Diff leftDiff2 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff2Description));
- final Diff leftDiff3 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff3Description));
- final Diff leftDiff4 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff4Description));
- final Diff leftDiff5 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff5Description));
- final Diff leftDiff6 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff6Description));
- final Diff leftDiff7 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- leftDiff7Description));
-
- final Diff rightDiff8 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiff8Description));
- final Diff rightDiff9 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiff9Description));
- final Diff rightDiff10 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiff10Description));
- final Diff rightDiff11 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiff11Description));
- final Diff rightDiff12 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- rightDiff12Description));
-
- assertNotNull(leftDiff1);
- assertNotNull(leftDiff2);
- assertNotNull(leftDiff3);
- assertNotNull(leftDiff4);
- assertNotNull(leftDiff5);
- assertNotNull(leftDiff6);
- assertNotNull(leftDiff7);
-
- assertNotNull(rightDiff8);
- assertNotNull(rightDiff9);
- assertNotNull(rightDiff10);
- assertNotNull(rightDiff11);
- assertNotNull(rightDiff12);
-
- // We know there are 5 conflicts here
- for (Conflict conflict : conflicts) {
- final List<Diff> conflictDiffs = conflict.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs.size()));
- if (conflictDiffs.contains(leftDiff6)) {
- assertTrue(conflictDiffs.contains(rightDiff8));
- assertSame(ConflictKind.REAL, conflict.getKind());
- } else if (conflictDiffs.contains(leftDiff2)) {
- assertTrue(conflictDiffs.contains(rightDiff9));
- assertSame(ConflictKind.REAL, conflict.getKind());
- } else if (conflictDiffs.contains(leftDiff4)) {
- assertTrue(conflictDiffs.contains(rightDiff10));
- assertSame(ConflictKind.REAL, conflict.getKind());
- } else if (conflictDiffs.contains(leftDiff3)) {
- assertTrue(conflictDiffs.contains(rightDiff11));
- assertSame(ConflictKind.REAL, conflict.getKind());
- } else if (conflictDiffs.contains(leftDiff5)) {
- assertTrue(conflictDiffs.contains(rightDiff12));
- assertSame(ConflictKind.PSEUDO, conflict.getKind());
- } else {
- fail("unexpected conflict");
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.conflict;
+
+import static com.google.common.base.Predicates.and;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.conflict.data.ConflictInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ConflictDetectionTest {
+ private ConflictInputData input = new ConflictInputData();
+
+ @Test
+ public void testA1UseCaseForAttribute() throws IOException {
+ final Resource left = input.getA1AttributeLeft();
+ final Resource origin = input.getA1AttributeOrigin();
+ final Resource right = input.getA1AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", "left");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testA1UseCaseForReference() throws IOException {
+ final Resource left = input.getA1ReferenceLeft();
+ final Resource origin = input.getA1ReferenceOrigin();
+ final Resource right = input.getA1ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We have three diffs here : an object has been deleted on the right side, its reference has been
+ * unset, and that same reference has been changed on the left to a new value. The two diffs on the
+ * right are in conflict with the only diff on the left.
+ */
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", "root.left");
+ final Predicate<? super Diff> rightReferenceDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testA2UseCaseForAttribute() throws IOException {
+ final Resource left = input.getA2AttributeLeft();
+ final Resource origin = input.getA2AttributeOrigin();
+ final Resource right = input.getA2AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", null, "left");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testA2UseCaseForReference() throws IOException {
+ final Resource left = input.getA2ReferenceLeft();
+ final Resource origin = input.getA2ReferenceOrigin();
+ final Resource right = input.getA2ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.left");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testA3UseCaseForAttribute() throws IOException {
+ final Resource left = input.getA3AttributeLeft();
+ final Resource origin = input.getA3AttributeOrigin();
+ final Resource right = input.getA3AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", null);
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testA3UseCaseForReference() throws IOException {
+ final Resource left = input.getA3ReferenceLeft();
+ final Resource origin = input.getA3ReferenceOrigin();
+ final Resource right = input.getA3ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect three differences here : an object has been deleted on the right, its reference has been
+ * unset, and that same reference has been unset on the left. All three diffs are in pseudo-conflict
+ * with each other.
+ */
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+ final Predicate<? super Diff> rightReferenceDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testB1UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB1AttributeLeft();
+ final Resource origin = input.getB1AttributeOrigin();
+ final Resource right = input.getB1AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", "left");
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", "right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB1UseCaseForReference() throws IOException {
+ final Resource left = input.getB1ReferenceLeft();
+ final Resource origin = input.getB1ReferenceOrigin();
+ final Resource right = input.getB1ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", "root.left");
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", "root.right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB2UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB2AttributeLeft();
+ final Resource origin = input.getB2AttributeOrigin();
+ final Resource right = input.getB2AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", "left");
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", null);
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB2UseCaseForReference() throws IOException {
+ final Resource left = input.getB2ReferenceLeft();
+ final Resource origin = input.getB2ReferenceOrigin();
+ final Resource right = input.getB2ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", "root.left");
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB3UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB3AttributeLeft();
+ final Resource origin = input.getB3AttributeOrigin();
+ final Resource right = input.getB3AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", null, "left");
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", null, "right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB3UseCaseForReference() throws IOException {
+ final Resource left = input.getB3ReferenceLeft();
+ final Resource origin = input.getB3ReferenceOrigin();
+ final Resource right = input.getB3ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.left");
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB4UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB4AttributeLeft();
+ final Resource origin = input.getB4AttributeOrigin();
+ final Resource right = input.getB4AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", null);
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", "right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB4UseCaseForReference() throws IOException {
+ final Resource left = input.getB4ReferenceLeft();
+ final Resource origin = input.getB4ReferenceOrigin();
+ final Resource right = input.getB4ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", "root.right");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testB5UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB5AttributeLeft();
+ final Resource origin = input.getB5AttributeOrigin();
+ final Resource right = input.getB5AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", null, "leftAndRight");
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", null, "leftAndRight");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testB5UseCaseForReference() throws IOException {
+ final Resource left = input.getB5ReferenceLeft();
+ final Resource origin = input.getB5ReferenceOrigin();
+ final Resource right = input.getB5ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.leftAndRight");
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.leftAndRight");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testB6UseCaseForAttribute() throws IOException {
+ final Resource left = input.getB6AttributeLeft();
+ final Resource origin = input.getB6AttributeOrigin();
+ final Resource right = input.getB6AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", null);
+ final Predicate<? super Diff> rightDiffDescription = changedAttribute("root.conflictHolder",
+ "singleValuedAttribute", "origin", null);
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testB6UseCaseForReference() throws IOException {
+ final Resource left = input.getB6ReferenceLeft();
+ final Resource origin = input.getB6ReferenceOrigin();
+ final Resource right = input.getB6ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+ final Predicate<? super Diff> rightDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", "root.origin", null);
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testC1UseCaseForAttribute() throws IOException {
+ final Resource left = input.getC1AttributeLeft();
+ final Resource origin = input.getC1AttributeOrigin();
+ final Resource right = input.getC1AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = addedToAttribute("root.conflictHolder",
+ "multiValuedAttribute", "left1");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testC1UseCaseForReference() throws IOException {
+ final Resource left = input.getC1ReferenceLeft();
+ final Resource origin = input.getC1ReferenceOrigin();
+ final Resource right = input.getC1ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We should have 5 differences here. An element has been deleted from the right side, all three of
+ * its reference's values have been deleted, and finally a value has been added into that same
+ * reference on the left side. The addition of a value into the reference conflicts with the removal
+ * of the container from the right. The three other diffs do not conflict.
+ */
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = addedToReference("root.conflictHolder",
+ "multiValuedReference", "root.left1");
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+ final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin2");
+ final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin3");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+ final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
+ final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
+ final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+ assertNotNull(rightReferenceDiff1);
+ assertNotNull(rightReferenceDiff2);
+ assertNotNull(rightReferenceDiff3);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testC2UseCaseForAttribute() throws IOException {
+ final Resource left = input.getC2AttributeLeft();
+ final Resource origin = input.getC2AttributeOrigin();
+ final Resource right = input.getC2AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testC2UseCaseForReference() throws IOException {
+ final Resource left = input.getC2ReferenceLeft();
+ final Resource origin = input.getC2ReferenceOrigin();
+ final Resource right = input.getC2ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We should have 5 differences here. An element has been deleted from the right side, all three of
+ * its reference's values have been deleted, and finally a value has been removed from that same
+ * reference on the left side. The deletion of a value into the left reference conflicts with the
+ * removal of the container from the right. It is also in pseudo-conflict with the deletion of this
+ * same value on the right.
+ */
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+ final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin2");
+ final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin3");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+ final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
+ final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
+ final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+ assertNotNull(rightReferenceDiff1);
+ assertNotNull(rightReferenceDiff2);
+ assertNotNull(rightReferenceDiff3);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertTrue(conflictDiff.contains(rightReferenceDiff1));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testC3UseCaseForAttribute() throws IOException {
+ final Resource left = input.getC3AttributeLeft();
+ final Resource origin = input.getC3AttributeOrigin();
+ final Resource right = input.getC3AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = addedToAttribute("root.conflictHolder",
+ "multiValuedAttribute", "left1");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testC3UseCaseForReference() throws IOException {
+ final Resource left = input.getC3ReferenceLeft();
+ final Resource origin = input.getC3ReferenceOrigin();
+ final Resource right = input.getC3ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = addedToReference("root.conflictHolder",
+ "multiValuedReference", "root.left1");
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testC4UseCaseForAttribute() throws IOException {
+ final Resource left = input.getC4AttributeLeft();
+ final Resource origin = input.getC4AttributeOrigin();
+ final Resource right = input.getC4AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect 4 differences here. On the right side, an element has been deleted. On the left side, all
+ * three values of one of this element's features have been removed. All three diffs on the left are
+ * in conflict with the right diff.
+ */
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftAttributeDiff1Description = removedFromAttribute(
+ "root.conflictHolder", "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> leftAttributeDiff2Description = removedFromAttribute(
+ "root.conflictHolder", "multiValuedAttribute", "origin2");
+ final Predicate<? super Diff> leftAttributeDiff3Description = removedFromAttribute(
+ "root.conflictHolder", "multiValuedAttribute", "origin3");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftAttributeDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftAttributeDiff1Description));
+ final Diff leftAttributeDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftAttributeDiff2Description));
+ final Diff leftAttributeDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftAttributeDiff3Description));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftAttributeDiff1);
+ assertNotNull(leftAttributeDiff2);
+ assertNotNull(leftAttributeDiff3);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftAttributeDiff1));
+ assertTrue(conflictDiff.contains(leftAttributeDiff2));
+ assertTrue(conflictDiff.contains(leftAttributeDiff3));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testC4UseCaseForReference() throws IOException {
+ final Resource left = input.getC4ReferenceLeft();
+ final Resource origin = input.getC4ReferenceOrigin();
+ final Resource right = input.getC4ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect 7 differences here. On the right, an element has been deleted. All three values of this
+ * element's reference have been removed. On the left, we've also removed all three values of that
+ * same reference. All 7 differences are in pseudo-conflict with each other.
+ */
+ assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> referenceDiff1Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> referenceDiff2Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin2");
+ final Predicate<? super Diff> referenceDiff3Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin3");
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff1Description));
+ final Diff leftReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff2Description));
+ final Diff leftReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff3Description));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+ final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff1Description));
+ final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff2Description));
+ final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff3Description));
+
+ assertNotNull(leftReferenceDiff1);
+ assertNotNull(leftReferenceDiff2);
+ assertNotNull(leftReferenceDiff3);
+ assertNotNull(rightDeleteDiff);
+ assertNotNull(rightReferenceDiff1);
+ assertNotNull(rightReferenceDiff2);
+ assertNotNull(rightReferenceDiff3);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(7), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff1));
+ assertTrue(conflictDiff.contains(leftReferenceDiff2));
+ assertTrue(conflictDiff.contains(leftReferenceDiff3));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertTrue(conflictDiff.contains(rightReferenceDiff1));
+ assertTrue(conflictDiff.contains(rightReferenceDiff2));
+ assertTrue(conflictDiff.contains(rightReferenceDiff3));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testC5UseCaseForAttribute() throws IOException {
+ final Resource left = input.getC5AttributeLeft();
+ final Resource origin = input.getC5AttributeOrigin();
+ final Resource right = input.getC5AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.conflictHolder");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testC5UseCaseForReference() throws IOException {
+ final Resource left = input.getC5ReferenceLeft();
+ final Resource origin = input.getC5ReferenceOrigin();
+ final Resource right = input.getC5ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect five differences here. An element has been deleted from the right side, all three values
+ * of its reference have been deleted too. In the left, we've moved one of these values to another
+ * index. The MOVE conflicts with both the container deletion and the value's removal.
+ */
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftReferenceDiffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightDeleteDiffDescription = removed("root.conflictHolder");
+ final Predicate<? super Diff> rightReferenceDiff1Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightReferenceDiff2Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin2");
+ final Predicate<? super Diff> rightReferenceDiff3Description = removedFromReference(
+ "root.conflictHolder", "multiValuedReference", "root.origin2");
+
+ final Diff leftReferenceDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), leftReferenceDiffDescription));
+ final Diff rightDeleteDiff = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightDeleteDiffDescription));
+ final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff1Description));
+ final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff2Description));
+ final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), rightReferenceDiff3Description));
+
+ assertNotNull(leftReferenceDiff);
+ assertNotNull(rightDeleteDiff);
+ assertNotNull(rightReferenceDiff1);
+ assertNotNull(rightReferenceDiff2);
+ assertNotNull(rightReferenceDiff3);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftReferenceDiff));
+ assertTrue(conflictDiff.contains(rightDeleteDiff));
+ assertTrue(conflictDiff.contains(rightReferenceDiff1));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD1UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD1AttributeLeft();
+ final Resource origin = input.getD1AttributeOrigin();
+ final Resource right = input.getD1AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> rightDiffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD1UseCaseForReference() throws IOException {
+ final Resource left = input.getD1ReferenceLeft();
+ final Resource origin = input.getD1ReferenceOrigin();
+ final Resource right = input.getD1ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightDiffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD2UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD2AttributeLeft();
+ final Resource origin = input.getD2AttributeOrigin();
+ final Resource right = input.getD2AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> rightDiffDescription = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD2UseCaseForReference() throws IOException {
+ final Resource left = input.getD2ReferenceLeft();
+ final Resource origin = input.getD2ReferenceOrigin();
+ final Resource right = input.getD2ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightDiffDescription = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD3UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD3AttributeLeft();
+ final Resource origin = input.getD3AttributeOrigin();
+ final Resource right = input.getD3AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> rightDiffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD3UseCaseForReference() throws IOException {
+ final Resource left = input.getD3ReferenceLeft();
+ final Resource origin = input.getD3ReferenceOrigin();
+ final Resource right = input.getD3ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> rightDiffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testD4UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD4AttributeLeft();
+ final Resource origin = input.getD4AttributeOrigin();
+ final Resource right = input.getD4AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect 6 differences here. On both right and left, we've emptied an attribute from its 3 values.
+ * This should give use 3 pseudo-conflict, each removal conflicting with its other side.
+ */
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> AttributeDiff1Description = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+ final Predicate<? super Diff> AttributeDiff2Description = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin2");
+ final Predicate<? super Diff> AttributeDiff3Description = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin3");
+
+ final Diff leftAttributeDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), AttributeDiff1Description));
+ final Diff leftAttributeDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), AttributeDiff2Description));
+ final Diff leftAttributeDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), AttributeDiff3Description));
+
+ final Diff rightAttributeDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), AttributeDiff1Description));
+ final Diff rightAttributeDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), AttributeDiff2Description));
+ final Diff rightAttributeDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), AttributeDiff3Description));
+
+ assertNotNull(leftAttributeDiff1);
+ assertNotNull(leftAttributeDiff2);
+ assertNotNull(leftAttributeDiff3);
+ assertNotNull(rightAttributeDiff1);
+ assertNotNull(rightAttributeDiff2);
+ assertNotNull(rightAttributeDiff3);
+
+ // We know we have three conflicts
+ final Conflict conflict1 = conflicts.get(0);
+
+ final List<Diff> conflictDiffs1 = conflict1.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs1.size()));
+ assertTrue(conflictDiffs1.contains(leftAttributeDiff1));
+ assertTrue(conflictDiffs1.contains(rightAttributeDiff1));
+ assertSame(ConflictKind.PSEUDO, conflict1.getKind());
+
+ final Conflict conflict2 = conflicts.get(1);
+
+ final List<Diff> conflictDiffs2 = conflict2.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs2.size()));
+ assertTrue(conflictDiffs2.contains(leftAttributeDiff2));
+ assertTrue(conflictDiffs2.contains(rightAttributeDiff2));
+ assertSame(ConflictKind.PSEUDO, conflict2.getKind());
+
+ final Conflict conflict3 = conflicts.get(2);
+
+ final List<Diff> conflictDiffs3 = conflict3.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs3.size()));
+ assertTrue(conflictDiffs3.contains(leftAttributeDiff3));
+ assertTrue(conflictDiffs3.contains(rightAttributeDiff3));
+ assertSame(ConflictKind.PSEUDO, conflict3.getKind());
+ }
+
+ @Test
+ public void testD4UseCaseForReference() throws IOException {
+ final Resource left = input.getD4ReferenceLeft();
+ final Resource origin = input.getD4ReferenceOrigin();
+ final Resource right = input.getD4ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * We expect 6 differences here. On both right and left, we've emptied a reference from its 3 values.
+ * This should give use 3 pseudo-conflict, each removal conflicting with its other side.
+ */
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(3), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> referenceDiff1Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+ final Predicate<? super Diff> referenceDiff2Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin2");
+ final Predicate<? super Diff> referenceDiff3Description = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin3");
+
+ final Diff leftReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff1Description));
+ final Diff leftReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff2Description));
+ final Diff leftReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), referenceDiff3Description));
+
+ final Diff rightReferenceDiff1 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff1Description));
+ final Diff rightReferenceDiff2 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff2Description));
+ final Diff rightReferenceDiff3 = Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), referenceDiff3Description));
+
+ assertNotNull(leftReferenceDiff1);
+ assertNotNull(leftReferenceDiff2);
+ assertNotNull(leftReferenceDiff3);
+ assertNotNull(rightReferenceDiff1);
+ assertNotNull(rightReferenceDiff2);
+ assertNotNull(rightReferenceDiff3);
+
+ // We know we have three conflicts
+ final Conflict conflict1 = conflicts.get(0);
+
+ final List<Diff> conflictDiffs1 = conflict1.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs1.size()));
+ assertTrue(conflictDiffs1.contains(leftReferenceDiff1));
+ assertTrue(conflictDiffs1.contains(rightReferenceDiff1));
+ assertSame(ConflictKind.PSEUDO, conflict1.getKind());
+
+ final Conflict conflict2 = conflicts.get(1);
+
+ final List<Diff> conflictDiffs2 = conflict2.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs2.size()));
+ assertTrue(conflictDiffs2.contains(leftReferenceDiff2));
+ assertTrue(conflictDiffs2.contains(rightReferenceDiff2));
+ assertSame(ConflictKind.PSEUDO, conflict2.getKind());
+
+ final Conflict conflict3 = conflicts.get(2);
+
+ final List<Diff> conflictDiffs3 = conflict3.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs3.size()));
+ assertTrue(conflictDiffs3.contains(leftReferenceDiff3));
+ assertTrue(conflictDiffs3.contains(rightReferenceDiff3));
+ assertSame(ConflictKind.PSEUDO, conflict3.getKind());
+ }
+
+ @Test
+ public void testD5UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD5AttributeLeft();
+ final Resource origin = input.getD5AttributeOrigin();
+ final Resource right = input.getD5AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> diffDescription = removedFromAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ diffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ diffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testD5UseCaseForReference() throws IOException {
+ final Resource left = input.getD5ReferenceLeft();
+ final Resource origin = input.getD5ReferenceOrigin();
+ final Resource right = input.getD5ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> diffDescription = removedFromReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ diffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ diffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testD6UseCaseForAttribute() throws IOException {
+ final Resource left = input.getD6AttributeLeft();
+ final Resource origin = input.getD6AttributeOrigin();
+ final Resource right = input.getD6AttributeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> diffDescription = movedInAttribute("root.conflictHolder",
+ "multiValuedAttribute", "origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ diffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ diffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testD6UseCaseForReference() throws IOException {
+ final Resource left = input.getD6ReferenceLeft();
+ final Resource origin = input.getD6ReferenceOrigin();
+ final Resource right = input.getD6ReferenceRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> diffDescription = movedInReference("root.conflictHolder",
+ "multiValuedReference", "root.origin1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ diffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ diffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ }
+
+ @Test
+ public void testE1UseCase() throws IOException {
+ final Resource left = input.getE1Left();
+ final Resource origin = input.getE1Origin();
+ final Resource right = input.getE1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = changedReference("root.conflictHolder",
+ "singleValuedReference", null, "root.origin");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.origin");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testE2UseCase() throws IOException {
+ final Resource left = input.getE2Left();
+ final Resource origin = input.getE2Origin();
+ final Resource right = input.getE2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = addedToReference("root.conflictHolder",
+ "multiValuedReference", "root.origin");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.origin");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testFUseCase() throws IOException {
+ final Resource left = input.getFLeft();
+ final Resource origin = input.getFOrigin();
+ final Resource right = input.getFRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = moved("root.conflictHolder.origin",
+ "containmentRef2");
+ final Predicate<? super Diff> rightDiffDescription = moved("root.conflictHolder.origin",
+ "containmentRef3");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testGUseCase() throws IOException {
+ final Resource left = input.getGLeft();
+ final Resource origin = input.getGOrigin();
+ final Resource right = input.getGRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = moved("root.leftContainer.conflictNode",
+ "containmentRef1");
+ final Predicate<? super Diff> rightDiffDescription = moved("root.rightContainer.conflictNode",
+ "containmentRef1");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testH1UseCase() throws IOException {
+ final Resource left = input.getH1Left();
+ final Resource origin = input.getH1Origin();
+ final Resource right = input.getH1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = moved("root.left.conflictNode",
+ "singleValueContainment");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.left");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testH2UseCase() throws IOException {
+ final Resource left = input.getH2Left();
+ final Resource origin = input.getH2Origin();
+ final Resource right = input.getH2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ // We should have no less and no more than 2 differences, composing a single conflict
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiffDescription = moved("root.leftContainer.conflictNode",
+ "containmentRef1");
+ final Predicate<? super Diff> rightDiffDescription = removed("root.leftContainer");
+
+ final Diff leftDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiffDescription));
+ final Diff rightDiff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiffDescription));
+
+ assertNotNull(leftDiff);
+ assertNotNull(rightDiff);
+
+ // We know there's only one conflict
+ final Conflict conflict = conflicts.get(0);
+
+ final List<Diff> conflictDiff = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiff.size()));
+ assertTrue(conflictDiff.contains(leftDiff));
+ assertTrue(conflictDiff.contains(rightDiff));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ }
+
+ @Test
+ public void testIUseCase() throws IOException {
+ final Resource left = input.getILeft();
+ final Resource origin = input.getIOrigin();
+ final Resource right = input.getIRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ Conflict soleConflict = conflicts.get(0);
+ assertSame(ConflictKind.PSEUDO, soleConflict.getKind());
+ }
+
+ @Test
+ public void testJUseCase() throws IOException {
+ final Resource left = input.getJLeft();
+ final Resource origin = input.getJOrigin();
+ final Resource right = input.getJRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ Conflict soleConflict = conflicts.get(0);
+ assertSame(ConflictKind.PSEUDO, soleConflict.getKind());
+ }
+
+ @Test
+ public void testComplexUseCase() throws IOException {
+ final Resource left = input.getComplexLeft();
+ final Resource origin = input.getComplexOrigin();
+ final Resource right = input.getComplexRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ /*
+ * This use case features 12 distinct differences of all types, adding up to 4 real conflict and 1
+ * pseudo conflicts.
+ */
+ // 1 - Left : Node8 added
+ // 2 - Left : Node9 added
+ // 3 - Left : Node1 moved
+ // 4 - Left : Node0 added
+ // 5 - Left : Node5 removed
+ // 6 - Left : Node6 removed
+ // 7 - Left : Node7 removed
+
+ // 8 - Right : Node6 moved
+ // 9 - Right : Node9 added
+ // 10 - Right : Node0 added
+ // 11 - Right : Node1 moved
+ // 12 - Right : Node5 removed
+
+ // Real conflict : 6 and 8 (Moving and deleting the same value)
+ // Real conflict : 2 and 9 (Adding the same value at different indices)
+ // Real conflict : 4 and 10 (Adding the same value at different indices)
+ // Real conflict : 3 and 11 (Moving the same value to different indices)
+
+ // Pseudo conflict : 5 and 12 (Removing the same value on both sides)
+
+ assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(5), Integer.valueOf(conflicts.size()));
+
+ final Predicate<? super Diff> leftDiff1Description = added("Root.Node8");
+ final Predicate<? super Diff> leftDiff2Description = added("Root.Node9");
+ final Predicate<? super Diff> leftDiff3Description = moved("Root.Node1", "containmentRef1");
+ final Predicate<? super Diff> leftDiff4Description = added("Root.Node0");
+ final Predicate<? super Diff> leftDiff5Description = removed("Root.Node5");
+ final Predicate<? super Diff> leftDiff6Description = removed("Root.Node6");
+ final Predicate<? super Diff> leftDiff7Description = removed("Root.Node7");
+
+ final Predicate<? super Diff> rightDiff8Description = moved("Root.Node6", "containmentRef1");
+ final Predicate<? super Diff> rightDiff9Description = added("Root.Node9");
+ final Predicate<? super Diff> rightDiff10Description = added("Root.Node0");
+ final Predicate<? super Diff> rightDiff11Description = moved("Root.Node1", "containmentRef1");
+ final Predicate<? super Diff> rightDiff12Description = removed("Root.Node5");
+
+ final Diff leftDiff1 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff1Description));
+ final Diff leftDiff2 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff2Description));
+ final Diff leftDiff3 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff3Description));
+ final Diff leftDiff4 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff4Description));
+ final Diff leftDiff5 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff5Description));
+ final Diff leftDiff6 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff6Description));
+ final Diff leftDiff7 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ leftDiff7Description));
+
+ final Diff rightDiff8 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiff8Description));
+ final Diff rightDiff9 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiff9Description));
+ final Diff rightDiff10 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiff10Description));
+ final Diff rightDiff11 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiff11Description));
+ final Diff rightDiff12 = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ rightDiff12Description));
+
+ assertNotNull(leftDiff1);
+ assertNotNull(leftDiff2);
+ assertNotNull(leftDiff3);
+ assertNotNull(leftDiff4);
+ assertNotNull(leftDiff5);
+ assertNotNull(leftDiff6);
+ assertNotNull(leftDiff7);
+
+ assertNotNull(rightDiff8);
+ assertNotNull(rightDiff9);
+ assertNotNull(rightDiff10);
+ assertNotNull(rightDiff11);
+ assertNotNull(rightDiff12);
+
+ // We know there are 5 conflicts here
+ for (Conflict conflict : conflicts) {
+ final List<Diff> conflictDiffs = conflict.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(conflictDiffs.size()));
+ if (conflictDiffs.contains(leftDiff6)) {
+ assertTrue(conflictDiffs.contains(rightDiff8));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ } else if (conflictDiffs.contains(leftDiff2)) {
+ assertTrue(conflictDiffs.contains(rightDiff9));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ } else if (conflictDiffs.contains(leftDiff4)) {
+ assertTrue(conflictDiffs.contains(rightDiff10));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ } else if (conflictDiffs.contains(leftDiff3)) {
+ assertTrue(conflictDiffs.contains(rightDiff11));
+ assertSame(ConflictKind.REAL, conflict.getKind());
+ } else if (conflictDiffs.contains(leftDiff5)) {
+ assertTrue(conflictDiffs.contains(rightDiff12));
+ assertSame(ConflictKind.PSEUDO, conflict.getKind());
+ } else {
+ fail("unexpected conflict");
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
index bff50a27c..5740abe3d 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
@@ -1,612 +1,612 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.conflict.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- * This will provide the input model for all of our "conflict detection" tests.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("nls")
-public class ConflictInputData extends AbstractInputData {
- public Resource getA1AttributeLeft() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_attribute_left.nodes");
- }
-
- public Resource getA1AttributeOrigin() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_attribute_origin.nodes");
- }
-
- public Resource getA1AttributeRight() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_attribute_right.nodes");
- }
-
- public Resource getA1ReferenceLeft() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_reference_left.nodes");
- }
-
- public Resource getA1ReferenceOrigin() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_reference_origin.nodes");
- }
-
- public Resource getA1ReferenceRight() throws IOException {
- return loadFromClassLoader("a1/conflict_a1_reference_right.nodes");
- }
-
- public Resource getA2AttributeLeft() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_attribute_left.nodes");
- }
-
- public Resource getA2AttributeOrigin() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_attribute_origin.nodes");
- }
-
- public Resource getA2AttributeRight() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_attribute_right.nodes");
- }
-
- public Resource getA2ReferenceLeft() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_reference_left.nodes");
- }
-
- public Resource getA2ReferenceOrigin() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_reference_origin.nodes");
- }
-
- public Resource getA2ReferenceRight() throws IOException {
- return loadFromClassLoader("a2/conflict_a2_reference_right.nodes");
- }
-
- public Resource getA3AttributeLeft() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_attribute_left.nodes");
- }
-
- public Resource getA3AttributeOrigin() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_attribute_origin.nodes");
- }
-
- public Resource getA3AttributeRight() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_attribute_right.nodes");
- }
-
- public Resource getA3ReferenceLeft() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_reference_left.nodes");
- }
-
- public Resource getA3ReferenceOrigin() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_reference_origin.nodes");
- }
-
- public Resource getA3ReferenceRight() throws IOException {
- return loadFromClassLoader("a3/conflict_a3_reference_right.nodes");
- }
-
- public Resource getB1AttributeLeft() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_attribute_left.nodes");
- }
-
- public Resource getB1AttributeOrigin() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_attribute_origin.nodes");
- }
-
- public Resource getB1AttributeRight() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_attribute_right.nodes");
- }
-
- public Resource getB1ReferenceLeft() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_reference_left.nodes");
- }
-
- public Resource getB1ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_reference_origin.nodes");
- }
-
- public Resource getB1ReferenceRight() throws IOException {
- return loadFromClassLoader("b1/conflict_b1_reference_right.nodes");
- }
-
- public Resource getB2AttributeLeft() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_attribute_left.nodes");
- }
-
- public Resource getB2AttributeOrigin() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_attribute_origin.nodes");
- }
-
- public Resource getB2AttributeRight() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_attribute_right.nodes");
- }
-
- public Resource getB2ReferenceLeft() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_reference_left.nodes");
- }
-
- public Resource getB2ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_reference_origin.nodes");
- }
-
- public Resource getB2ReferenceRight() throws IOException {
- return loadFromClassLoader("b2/conflict_b2_reference_right.nodes");
- }
-
- public Resource getB3AttributeLeft() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_attribute_left.nodes");
- }
-
- public Resource getB3AttributeOrigin() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_attribute_origin.nodes");
- }
-
- public Resource getB3AttributeRight() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_attribute_right.nodes");
- }
-
- public Resource getB3ReferenceLeft() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_reference_left.nodes");
- }
-
- public Resource getB3ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_reference_origin.nodes");
- }
-
- public Resource getB3ReferenceRight() throws IOException {
- return loadFromClassLoader("b3/conflict_b3_reference_right.nodes");
- }
-
- public Resource getB4AttributeLeft() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_attribute_left.nodes");
- }
-
- public Resource getB4AttributeOrigin() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_attribute_origin.nodes");
- }
-
- public Resource getB4AttributeRight() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_attribute_right.nodes");
- }
-
- public Resource getB4ReferenceLeft() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_reference_left.nodes");
- }
-
- public Resource getB4ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_reference_origin.nodes");
- }
-
- public Resource getB4ReferenceRight() throws IOException {
- return loadFromClassLoader("b4/conflict_b4_reference_right.nodes");
- }
-
- public Resource getB5AttributeLeft() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_attribute_left.nodes");
- }
-
- public Resource getB5AttributeOrigin() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_attribute_origin.nodes");
- }
-
- public Resource getB5AttributeRight() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_attribute_right.nodes");
- }
-
- public Resource getB5ReferenceLeft() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_reference_left.nodes");
- }
-
- public Resource getB5ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_reference_origin.nodes");
- }
-
- public Resource getB5ReferenceRight() throws IOException {
- return loadFromClassLoader("b5/conflict_b5_reference_right.nodes");
- }
-
- public Resource getB6AttributeLeft() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_attribute_left.nodes");
- }
-
- public Resource getB6AttributeOrigin() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_attribute_origin.nodes");
- }
-
- public Resource getB6AttributeRight() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_attribute_right.nodes");
- }
-
- public Resource getB6ReferenceLeft() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_reference_left.nodes");
- }
-
- public Resource getB6ReferenceOrigin() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_reference_origin.nodes");
- }
-
- public Resource getB6ReferenceRight() throws IOException {
- return loadFromClassLoader("b6/conflict_b6_reference_right.nodes");
- }
-
- public Resource getC1AttributeLeft() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_attribute_left.nodes");
- }
-
- public Resource getC1AttributeOrigin() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_attribute_origin.nodes");
- }
-
- public Resource getC1AttributeRight() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_attribute_right.nodes");
- }
-
- public Resource getC1ReferenceLeft() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_reference_left.nodes");
- }
-
- public Resource getC1ReferenceOrigin() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_reference_origin.nodes");
- }
-
- public Resource getC1ReferenceRight() throws IOException {
- return loadFromClassLoader("c1/conflict_c1_reference_right.nodes");
- }
-
- public Resource getC2AttributeLeft() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_attribute_left.nodes");
- }
-
- public Resource getC2AttributeOrigin() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_attribute_origin.nodes");
- }
-
- public Resource getC2AttributeRight() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_attribute_right.nodes");
- }
-
- public Resource getC2ReferenceLeft() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_reference_left.nodes");
- }
-
- public Resource getC2ReferenceOrigin() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_reference_origin.nodes");
- }
-
- public Resource getC2ReferenceRight() throws IOException {
- return loadFromClassLoader("c2/conflict_c2_reference_right.nodes");
- }
-
- public Resource getC3AttributeLeft() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_attribute_left.nodes");
- }
-
- public Resource getC3AttributeOrigin() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_attribute_origin.nodes");
- }
-
- public Resource getC3AttributeRight() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_attribute_right.nodes");
- }
-
- public Resource getC3ReferenceLeft() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_reference_left.nodes");
- }
-
- public Resource getC3ReferenceOrigin() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_reference_origin.nodes");
- }
-
- public Resource getC3ReferenceRight() throws IOException {
- return loadFromClassLoader("c3/conflict_c3_reference_right.nodes");
- }
-
- public Resource getC4AttributeLeft() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_attribute_left.nodes");
- }
-
- public Resource getC4AttributeOrigin() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_attribute_origin.nodes");
- }
-
- public Resource getC4AttributeRight() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_attribute_right.nodes");
- }
-
- public Resource getC4ReferenceLeft() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_reference_left.nodes");
- }
-
- public Resource getC4ReferenceOrigin() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_reference_origin.nodes");
- }
-
- public Resource getC4ReferenceRight() throws IOException {
- return loadFromClassLoader("c4/conflict_c4_reference_right.nodes");
- }
-
- public Resource getC5AttributeLeft() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_attribute_left.nodes");
- }
-
- public Resource getC5AttributeOrigin() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_attribute_origin.nodes");
- }
-
- public Resource getC5AttributeRight() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_attribute_right.nodes");
- }
-
- public Resource getC5ReferenceLeft() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_reference_left.nodes");
- }
-
- public Resource getC5ReferenceOrigin() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_reference_origin.nodes");
- }
-
- public Resource getC5ReferenceRight() throws IOException {
- return loadFromClassLoader("c5/conflict_c5_reference_right.nodes");
- }
-
- public Resource getD1AttributeLeft() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_attribute_left.nodes");
- }
-
- public Resource getD1AttributeOrigin() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_attribute_origin.nodes");
- }
-
- public Resource getD1AttributeRight() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_attribute_right.nodes");
- }
-
- public Resource getD1ReferenceLeft() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_reference_left.nodes");
- }
-
- public Resource getD1ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_reference_origin.nodes");
- }
-
- public Resource getD1ReferenceRight() throws IOException {
- return loadFromClassLoader("d1/conflict_d1_reference_right.nodes");
- }
-
- public Resource getD2AttributeLeft() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_attribute_left.nodes");
- }
-
- public Resource getD2AttributeOrigin() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_attribute_origin.nodes");
- }
-
- public Resource getD2AttributeRight() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_attribute_right.nodes");
- }
-
- public Resource getD2ReferenceLeft() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_reference_left.nodes");
- }
-
- public Resource getD2ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_reference_origin.nodes");
- }
-
- public Resource getD2ReferenceRight() throws IOException {
- return loadFromClassLoader("d2/conflict_d2_reference_right.nodes");
- }
-
- public Resource getD3AttributeLeft() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_attribute_left.nodes");
- }
-
- public Resource getD3AttributeOrigin() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_attribute_origin.nodes");
- }
-
- public Resource getD3AttributeRight() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_attribute_right.nodes");
- }
-
- public Resource getD3ReferenceLeft() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_reference_left.nodes");
- }
-
- public Resource getD3ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_reference_origin.nodes");
- }
-
- public Resource getD3ReferenceRight() throws IOException {
- return loadFromClassLoader("d3/conflict_d3_reference_right.nodes");
- }
-
- public Resource getD4AttributeLeft() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_attribute_left.nodes");
- }
-
- public Resource getD4AttributeOrigin() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_attribute_origin.nodes");
- }
-
- public Resource getD4AttributeRight() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_attribute_right.nodes");
- }
-
- public Resource getD4ReferenceLeft() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_reference_left.nodes");
- }
-
- public Resource getD4ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_reference_origin.nodes");
- }
-
- public Resource getD4ReferenceRight() throws IOException {
- return loadFromClassLoader("d4/conflict_d4_reference_right.nodes");
- }
-
- public Resource getD5AttributeLeft() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_attribute_left.nodes");
- }
-
- public Resource getD5AttributeOrigin() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_attribute_origin.nodes");
- }
-
- public Resource getD5AttributeRight() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_attribute_right.nodes");
- }
-
- public Resource getD5ReferenceLeft() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_reference_left.nodes");
- }
-
- public Resource getD5ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_reference_origin.nodes");
- }
-
- public Resource getD5ReferenceRight() throws IOException {
- return loadFromClassLoader("d5/conflict_d5_reference_right.nodes");
- }
-
- public Resource getD6AttributeLeft() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_attribute_left.nodes");
- }
-
- public Resource getD6AttributeOrigin() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_attribute_origin.nodes");
- }
-
- public Resource getD6AttributeRight() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_attribute_right.nodes");
- }
-
- public Resource getD6ReferenceLeft() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_reference_left.nodes");
- }
-
- public Resource getD6ReferenceOrigin() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_reference_origin.nodes");
- }
-
- public Resource getD6ReferenceRight() throws IOException {
- return loadFromClassLoader("d6/conflict_d6_reference_right.nodes");
- }
-
- public Resource getE1Left() throws IOException {
- return loadFromClassLoader("e1/conflict_e1_left.nodes");
- }
-
- public Resource getE1Origin() throws IOException {
- return loadFromClassLoader("e1/conflict_e1_origin.nodes");
- }
-
- public Resource getE1Right() throws IOException {
- return loadFromClassLoader("e1/conflict_e1_right.nodes");
- }
-
- public Resource getE2Left() throws IOException {
- return loadFromClassLoader("e2/conflict_e2_left.nodes");
- }
-
- public Resource getE2Origin() throws IOException {
- return loadFromClassLoader("e2/conflict_e2_origin.nodes");
- }
-
- public Resource getE2Right() throws IOException {
- return loadFromClassLoader("e2/conflict_e2_right.nodes");
- }
-
- public Resource getFLeft() throws IOException {
- return loadFromClassLoader("f/conflict_f_left.nodes");
- }
-
- public Resource getFOrigin() throws IOException {
- return loadFromClassLoader("f/conflict_f_origin.nodes");
- }
-
- public Resource getFRight() throws IOException {
- return loadFromClassLoader("f/conflict_f_right.nodes");
- }
-
- public Resource getGLeft() throws IOException {
- return loadFromClassLoader("g/conflict_g_left.nodes");
- }
-
- public Resource getGOrigin() throws IOException {
- return loadFromClassLoader("g/conflict_g_origin.nodes");
- }
-
- public Resource getGRight() throws IOException {
- return loadFromClassLoader("g/conflict_g_right.nodes");
- }
-
- public Resource getH1Left() throws IOException {
- return loadFromClassLoader("h1/conflict_h1_left.nodes");
- }
-
- public Resource getH1Origin() throws IOException {
- return loadFromClassLoader("h1/conflict_h1_origin.nodes");
- }
-
- public Resource getH1Right() throws IOException {
- return loadFromClassLoader("h1/conflict_h1_right.nodes");
- }
-
- public Resource getH2Left() throws IOException {
- return loadFromClassLoader("h2/conflict_h2_left.nodes");
- }
-
- public Resource getH2Origin() throws IOException {
- return loadFromClassLoader("h2/conflict_h2_origin.nodes");
- }
-
- public Resource getH2Right() throws IOException {
- return loadFromClassLoader("h2/conflict_h2_right.nodes");
- }
-
- public Resource getILeft() throws IOException {
- return loadFromClassLoader("i/conflict_i_left.nodes");
- }
-
- public Resource getIOrigin() throws IOException {
- return loadFromClassLoader("i/conflict_i_origin.nodes");
- }
-
- public Resource getIRight() throws IOException {
- return loadFromClassLoader("i/conflict_i_right.nodes");
- }
-
- public Resource getJLeft() throws IOException {
- return loadFromClassLoader("j/conflict_j_left.nodes");
- }
-
- public Resource getJOrigin() throws IOException {
- return loadFromClassLoader("j/conflict_j_origin.nodes");
- }
-
- public Resource getJRight() throws IOException {
- return loadFromClassLoader("j/conflict_j_right.nodes");
- }
-
- public Resource getComplexLeft() throws IOException {
- return loadFromClassLoader("complex/conflict_complex_left.nodes");
- }
-
- public Resource getComplexOrigin() throws IOException {
- return loadFromClassLoader("complex/conflict_complex_origin.nodes");
- }
-
- public Resource getComplexRight() throws IOException {
- return loadFromClassLoader("complex/conflict_complex_right.nodes");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.conflict.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * This will provide the input model for all of our "conflict detection" tests.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@SuppressWarnings("nls")
+public class ConflictInputData extends AbstractInputData {
+ public Resource getA1AttributeLeft() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_attribute_left.nodes");
+ }
+
+ public Resource getA1AttributeOrigin() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_attribute_origin.nodes");
+ }
+
+ public Resource getA1AttributeRight() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_attribute_right.nodes");
+ }
+
+ public Resource getA1ReferenceLeft() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_reference_left.nodes");
+ }
+
+ public Resource getA1ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_reference_origin.nodes");
+ }
+
+ public Resource getA1ReferenceRight() throws IOException {
+ return loadFromClassLoader("a1/conflict_a1_reference_right.nodes");
+ }
+
+ public Resource getA2AttributeLeft() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_attribute_left.nodes");
+ }
+
+ public Resource getA2AttributeOrigin() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_attribute_origin.nodes");
+ }
+
+ public Resource getA2AttributeRight() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_attribute_right.nodes");
+ }
+
+ public Resource getA2ReferenceLeft() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_reference_left.nodes");
+ }
+
+ public Resource getA2ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_reference_origin.nodes");
+ }
+
+ public Resource getA2ReferenceRight() throws IOException {
+ return loadFromClassLoader("a2/conflict_a2_reference_right.nodes");
+ }
+
+ public Resource getA3AttributeLeft() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_attribute_left.nodes");
+ }
+
+ public Resource getA3AttributeOrigin() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_attribute_origin.nodes");
+ }
+
+ public Resource getA3AttributeRight() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_attribute_right.nodes");
+ }
+
+ public Resource getA3ReferenceLeft() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_reference_left.nodes");
+ }
+
+ public Resource getA3ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_reference_origin.nodes");
+ }
+
+ public Resource getA3ReferenceRight() throws IOException {
+ return loadFromClassLoader("a3/conflict_a3_reference_right.nodes");
+ }
+
+ public Resource getB1AttributeLeft() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_attribute_left.nodes");
+ }
+
+ public Resource getB1AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_attribute_origin.nodes");
+ }
+
+ public Resource getB1AttributeRight() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_attribute_right.nodes");
+ }
+
+ public Resource getB1ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_reference_left.nodes");
+ }
+
+ public Resource getB1ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_reference_origin.nodes");
+ }
+
+ public Resource getB1ReferenceRight() throws IOException {
+ return loadFromClassLoader("b1/conflict_b1_reference_right.nodes");
+ }
+
+ public Resource getB2AttributeLeft() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_attribute_left.nodes");
+ }
+
+ public Resource getB2AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_attribute_origin.nodes");
+ }
+
+ public Resource getB2AttributeRight() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_attribute_right.nodes");
+ }
+
+ public Resource getB2ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_reference_left.nodes");
+ }
+
+ public Resource getB2ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_reference_origin.nodes");
+ }
+
+ public Resource getB2ReferenceRight() throws IOException {
+ return loadFromClassLoader("b2/conflict_b2_reference_right.nodes");
+ }
+
+ public Resource getB3AttributeLeft() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_attribute_left.nodes");
+ }
+
+ public Resource getB3AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_attribute_origin.nodes");
+ }
+
+ public Resource getB3AttributeRight() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_attribute_right.nodes");
+ }
+
+ public Resource getB3ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_reference_left.nodes");
+ }
+
+ public Resource getB3ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_reference_origin.nodes");
+ }
+
+ public Resource getB3ReferenceRight() throws IOException {
+ return loadFromClassLoader("b3/conflict_b3_reference_right.nodes");
+ }
+
+ public Resource getB4AttributeLeft() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_attribute_left.nodes");
+ }
+
+ public Resource getB4AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_attribute_origin.nodes");
+ }
+
+ public Resource getB4AttributeRight() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_attribute_right.nodes");
+ }
+
+ public Resource getB4ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_reference_left.nodes");
+ }
+
+ public Resource getB4ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_reference_origin.nodes");
+ }
+
+ public Resource getB4ReferenceRight() throws IOException {
+ return loadFromClassLoader("b4/conflict_b4_reference_right.nodes");
+ }
+
+ public Resource getB5AttributeLeft() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_attribute_left.nodes");
+ }
+
+ public Resource getB5AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_attribute_origin.nodes");
+ }
+
+ public Resource getB5AttributeRight() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_attribute_right.nodes");
+ }
+
+ public Resource getB5ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_reference_left.nodes");
+ }
+
+ public Resource getB5ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_reference_origin.nodes");
+ }
+
+ public Resource getB5ReferenceRight() throws IOException {
+ return loadFromClassLoader("b5/conflict_b5_reference_right.nodes");
+ }
+
+ public Resource getB6AttributeLeft() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_attribute_left.nodes");
+ }
+
+ public Resource getB6AttributeOrigin() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_attribute_origin.nodes");
+ }
+
+ public Resource getB6AttributeRight() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_attribute_right.nodes");
+ }
+
+ public Resource getB6ReferenceLeft() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_reference_left.nodes");
+ }
+
+ public Resource getB6ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_reference_origin.nodes");
+ }
+
+ public Resource getB6ReferenceRight() throws IOException {
+ return loadFromClassLoader("b6/conflict_b6_reference_right.nodes");
+ }
+
+ public Resource getC1AttributeLeft() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_attribute_left.nodes");
+ }
+
+ public Resource getC1AttributeOrigin() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_attribute_origin.nodes");
+ }
+
+ public Resource getC1AttributeRight() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_attribute_right.nodes");
+ }
+
+ public Resource getC1ReferenceLeft() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_reference_left.nodes");
+ }
+
+ public Resource getC1ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_reference_origin.nodes");
+ }
+
+ public Resource getC1ReferenceRight() throws IOException {
+ return loadFromClassLoader("c1/conflict_c1_reference_right.nodes");
+ }
+
+ public Resource getC2AttributeLeft() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_attribute_left.nodes");
+ }
+
+ public Resource getC2AttributeOrigin() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_attribute_origin.nodes");
+ }
+
+ public Resource getC2AttributeRight() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_attribute_right.nodes");
+ }
+
+ public Resource getC2ReferenceLeft() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_reference_left.nodes");
+ }
+
+ public Resource getC2ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_reference_origin.nodes");
+ }
+
+ public Resource getC2ReferenceRight() throws IOException {
+ return loadFromClassLoader("c2/conflict_c2_reference_right.nodes");
+ }
+
+ public Resource getC3AttributeLeft() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_attribute_left.nodes");
+ }
+
+ public Resource getC3AttributeOrigin() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_attribute_origin.nodes");
+ }
+
+ public Resource getC3AttributeRight() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_attribute_right.nodes");
+ }
+
+ public Resource getC3ReferenceLeft() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_reference_left.nodes");
+ }
+
+ public Resource getC3ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_reference_origin.nodes");
+ }
+
+ public Resource getC3ReferenceRight() throws IOException {
+ return loadFromClassLoader("c3/conflict_c3_reference_right.nodes");
+ }
+
+ public Resource getC4AttributeLeft() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_attribute_left.nodes");
+ }
+
+ public Resource getC4AttributeOrigin() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_attribute_origin.nodes");
+ }
+
+ public Resource getC4AttributeRight() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_attribute_right.nodes");
+ }
+
+ public Resource getC4ReferenceLeft() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_reference_left.nodes");
+ }
+
+ public Resource getC4ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_reference_origin.nodes");
+ }
+
+ public Resource getC4ReferenceRight() throws IOException {
+ return loadFromClassLoader("c4/conflict_c4_reference_right.nodes");
+ }
+
+ public Resource getC5AttributeLeft() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_attribute_left.nodes");
+ }
+
+ public Resource getC5AttributeOrigin() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_attribute_origin.nodes");
+ }
+
+ public Resource getC5AttributeRight() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_attribute_right.nodes");
+ }
+
+ public Resource getC5ReferenceLeft() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_reference_left.nodes");
+ }
+
+ public Resource getC5ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_reference_origin.nodes");
+ }
+
+ public Resource getC5ReferenceRight() throws IOException {
+ return loadFromClassLoader("c5/conflict_c5_reference_right.nodes");
+ }
+
+ public Resource getD1AttributeLeft() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_attribute_left.nodes");
+ }
+
+ public Resource getD1AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_attribute_origin.nodes");
+ }
+
+ public Resource getD1AttributeRight() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_attribute_right.nodes");
+ }
+
+ public Resource getD1ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_reference_left.nodes");
+ }
+
+ public Resource getD1ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_reference_origin.nodes");
+ }
+
+ public Resource getD1ReferenceRight() throws IOException {
+ return loadFromClassLoader("d1/conflict_d1_reference_right.nodes");
+ }
+
+ public Resource getD2AttributeLeft() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_attribute_left.nodes");
+ }
+
+ public Resource getD2AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_attribute_origin.nodes");
+ }
+
+ public Resource getD2AttributeRight() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_attribute_right.nodes");
+ }
+
+ public Resource getD2ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_reference_left.nodes");
+ }
+
+ public Resource getD2ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_reference_origin.nodes");
+ }
+
+ public Resource getD2ReferenceRight() throws IOException {
+ return loadFromClassLoader("d2/conflict_d2_reference_right.nodes");
+ }
+
+ public Resource getD3AttributeLeft() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_attribute_left.nodes");
+ }
+
+ public Resource getD3AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_attribute_origin.nodes");
+ }
+
+ public Resource getD3AttributeRight() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_attribute_right.nodes");
+ }
+
+ public Resource getD3ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_reference_left.nodes");
+ }
+
+ public Resource getD3ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_reference_origin.nodes");
+ }
+
+ public Resource getD3ReferenceRight() throws IOException {
+ return loadFromClassLoader("d3/conflict_d3_reference_right.nodes");
+ }
+
+ public Resource getD4AttributeLeft() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_attribute_left.nodes");
+ }
+
+ public Resource getD4AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_attribute_origin.nodes");
+ }
+
+ public Resource getD4AttributeRight() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_attribute_right.nodes");
+ }
+
+ public Resource getD4ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_reference_left.nodes");
+ }
+
+ public Resource getD4ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_reference_origin.nodes");
+ }
+
+ public Resource getD4ReferenceRight() throws IOException {
+ return loadFromClassLoader("d4/conflict_d4_reference_right.nodes");
+ }
+
+ public Resource getD5AttributeLeft() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_attribute_left.nodes");
+ }
+
+ public Resource getD5AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_attribute_origin.nodes");
+ }
+
+ public Resource getD5AttributeRight() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_attribute_right.nodes");
+ }
+
+ public Resource getD5ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_reference_left.nodes");
+ }
+
+ public Resource getD5ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_reference_origin.nodes");
+ }
+
+ public Resource getD5ReferenceRight() throws IOException {
+ return loadFromClassLoader("d5/conflict_d5_reference_right.nodes");
+ }
+
+ public Resource getD6AttributeLeft() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_attribute_left.nodes");
+ }
+
+ public Resource getD6AttributeOrigin() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_attribute_origin.nodes");
+ }
+
+ public Resource getD6AttributeRight() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_attribute_right.nodes");
+ }
+
+ public Resource getD6ReferenceLeft() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_reference_left.nodes");
+ }
+
+ public Resource getD6ReferenceOrigin() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_reference_origin.nodes");
+ }
+
+ public Resource getD6ReferenceRight() throws IOException {
+ return loadFromClassLoader("d6/conflict_d6_reference_right.nodes");
+ }
+
+ public Resource getE1Left() throws IOException {
+ return loadFromClassLoader("e1/conflict_e1_left.nodes");
+ }
+
+ public Resource getE1Origin() throws IOException {
+ return loadFromClassLoader("e1/conflict_e1_origin.nodes");
+ }
+
+ public Resource getE1Right() throws IOException {
+ return loadFromClassLoader("e1/conflict_e1_right.nodes");
+ }
+
+ public Resource getE2Left() throws IOException {
+ return loadFromClassLoader("e2/conflict_e2_left.nodes");
+ }
+
+ public Resource getE2Origin() throws IOException {
+ return loadFromClassLoader("e2/conflict_e2_origin.nodes");
+ }
+
+ public Resource getE2Right() throws IOException {
+ return loadFromClassLoader("e2/conflict_e2_right.nodes");
+ }
+
+ public Resource getFLeft() throws IOException {
+ return loadFromClassLoader("f/conflict_f_left.nodes");
+ }
+
+ public Resource getFOrigin() throws IOException {
+ return loadFromClassLoader("f/conflict_f_origin.nodes");
+ }
+
+ public Resource getFRight() throws IOException {
+ return loadFromClassLoader("f/conflict_f_right.nodes");
+ }
+
+ public Resource getGLeft() throws IOException {
+ return loadFromClassLoader("g/conflict_g_left.nodes");
+ }
+
+ public Resource getGOrigin() throws IOException {
+ return loadFromClassLoader("g/conflict_g_origin.nodes");
+ }
+
+ public Resource getGRight() throws IOException {
+ return loadFromClassLoader("g/conflict_g_right.nodes");
+ }
+
+ public Resource getH1Left() throws IOException {
+ return loadFromClassLoader("h1/conflict_h1_left.nodes");
+ }
+
+ public Resource getH1Origin() throws IOException {
+ return loadFromClassLoader("h1/conflict_h1_origin.nodes");
+ }
+
+ public Resource getH1Right() throws IOException {
+ return loadFromClassLoader("h1/conflict_h1_right.nodes");
+ }
+
+ public Resource getH2Left() throws IOException {
+ return loadFromClassLoader("h2/conflict_h2_left.nodes");
+ }
+
+ public Resource getH2Origin() throws IOException {
+ return loadFromClassLoader("h2/conflict_h2_origin.nodes");
+ }
+
+ public Resource getH2Right() throws IOException {
+ return loadFromClassLoader("h2/conflict_h2_right.nodes");
+ }
+
+ public Resource getILeft() throws IOException {
+ return loadFromClassLoader("i/conflict_i_left.nodes");
+ }
+
+ public Resource getIOrigin() throws IOException {
+ return loadFromClassLoader("i/conflict_i_origin.nodes");
+ }
+
+ public Resource getIRight() throws IOException {
+ return loadFromClassLoader("i/conflict_i_right.nodes");
+ }
+
+ public Resource getJLeft() throws IOException {
+ return loadFromClassLoader("j/conflict_j_left.nodes");
+ }
+
+ public Resource getJOrigin() throws IOException {
+ return loadFromClassLoader("j/conflict_j_origin.nodes");
+ }
+
+ public Resource getJRight() throws IOException {
+ return loadFromClassLoader("j/conflict_j_right.nodes");
+ }
+
+ public Resource getComplexLeft() throws IOException {
+ return loadFromClassLoader("complex/conflict_complex_left.nodes");
+ }
+
+ public Resource getComplexOrigin() throws IOException {
+ return loadFromClassLoader("complex/conflict_complex_origin.nodes");
+ }
+
+ public Resource getComplexRight() throws IOException {
+ return loadFromClassLoader("complex/conflict_complex_right.nodes");
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/ComparisonUtilTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/ComparisonUtilTest.java
index 098875513..c7b3e85df 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/ComparisonUtilTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/ComparisonUtilTest.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.diff;
-
-import static com.google.common.base.Predicates.and;
-import static junit.framework.Assert.assertEquals;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.referenceValueMatch;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.internal.utils.ComparisonUtil;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("all")
-public class ComparisonUtilTest {
- @Test
- public void testSubDiffs() throws IOException {
- IdentifierMatchInputData inputData = new IdentifierMatchInputData();
-
- final Resource left = inputData.getExtlibraryLeft();
- final Resource origin = inputData.getExtlibraryOrigin();
- final Resource right = inputData.getExtlibraryRight();
-
- // 2-way
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
- List<Diff> differences = comparison.getDifferences();
-
- // Right to left on a deleted element
- final Predicate<? super Diff> leftPeriodical = and(fromSide(DifferenceSource.LEFT),
- ofKind(DifferenceKind.DELETE), referenceValueMatch("eClassifiers", "extlibrary.Periodical",
- true));
- final Diff leftPeriodicalDiff = Iterators.find(differences.iterator(), leftPeriodical);
- boolean leftToRight = false;
- Iterable<Diff> subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff);
-
- assertEquals(7, Iterables.size(subDiffs));
-
- // Left to right on a deleted element
- leftToRight = true;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff);
-
- assertEquals(4, Iterables.size(subDiffs));
-
- // Right to left on an added element
- final Predicate<? super Diff> leftMagazine = and(fromSide(DifferenceSource.LEFT),
- ofKind(DifferenceKind.ADD), referenceValueMatch("eClassifiers", "extlibrary.Magazine", true));
- final Diff leftMagazineDiff = Iterators.find(differences.iterator(), leftMagazine);
- leftToRight = false;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff);
-
- assertEquals(5, Iterables.size(subDiffs));
-
- // Left to right on an added element
- leftToRight = true;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff);
-
- assertEquals(5, Iterables.size(subDiffs));
-
- // 3-way
- scope = new DefaultComparisonScope(left, right, origin);
- comparison = EMFCompare.builder().build().compare(scope);
- differences = comparison.getDifferences();
-
- // Right to left on a deleted element
- final Predicate<? super Diff> leftPeriodical3Way = and(fromSide(DifferenceSource.LEFT),
- ofKind(DifferenceKind.DELETE), referenceValueMatch("eClassifiers", "extlibrary.Periodical",
- true));
- final Diff leftPeriodicalDiff3Way = Iterators.find(differences.iterator(), leftPeriodical3Way);
- leftToRight = false;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff3Way);
-
- assertEquals(11, Iterables.size(subDiffs));
-
- // Left to right on a deleted element
- leftToRight = true;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff3Way);
-
- assertEquals(8, Iterables.size(subDiffs));
-
- // Right to left on a added element
- final Predicate<? super Diff> leftMagazine3Way = and(fromSide(DifferenceSource.LEFT),
- ofKind(DifferenceKind.ADD), referenceValueMatch("eClassifiers", "extlibrary.Magazine", true));
- final Diff leftMagazineDiff3Way = Iterators.find(differences.iterator(), leftMagazine3Way);
- leftToRight = false;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff3Way);
-
- assertEquals(5, Iterables.size(subDiffs));
-
- // Left to right on an added element
- leftToRight = true;
- subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff3Way);
-
- assertEquals(5, Iterables.size(subDiffs));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.diff;
+
+import static com.google.common.base.Predicates.and;
+import static junit.framework.Assert.assertEquals;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.referenceValueMatch;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.internal.utils.ComparisonUtil;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("all")
+public class ComparisonUtilTest {
+ @Test
+ public void testSubDiffs() throws IOException {
+ IdentifierMatchInputData inputData = new IdentifierMatchInputData();
+
+ final Resource left = inputData.getExtlibraryLeft();
+ final Resource origin = inputData.getExtlibraryOrigin();
+ final Resource right = inputData.getExtlibraryRight();
+
+ // 2-way
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+ List<Diff> differences = comparison.getDifferences();
+
+ // Right to left on a deleted element
+ final Predicate<? super Diff> leftPeriodical = and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), referenceValueMatch("eClassifiers", "extlibrary.Periodical",
+ true));
+ final Diff leftPeriodicalDiff = Iterators.find(differences.iterator(), leftPeriodical);
+ boolean leftToRight = false;
+ Iterable<Diff> subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff);
+
+ assertEquals(7, Iterables.size(subDiffs));
+
+ // Left to right on a deleted element
+ leftToRight = true;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff);
+
+ assertEquals(4, Iterables.size(subDiffs));
+
+ // Right to left on an added element
+ final Predicate<? super Diff> leftMagazine = and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), referenceValueMatch("eClassifiers", "extlibrary.Magazine", true));
+ final Diff leftMagazineDiff = Iterators.find(differences.iterator(), leftMagazine);
+ leftToRight = false;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff);
+
+ assertEquals(5, Iterables.size(subDiffs));
+
+ // Left to right on an added element
+ leftToRight = true;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff);
+
+ assertEquals(5, Iterables.size(subDiffs));
+
+ // 3-way
+ scope = new DefaultComparisonScope(left, right, origin);
+ comparison = EMFCompare.builder().build().compare(scope);
+ differences = comparison.getDifferences();
+
+ // Right to left on a deleted element
+ final Predicate<? super Diff> leftPeriodical3Way = and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), referenceValueMatch("eClassifiers", "extlibrary.Periodical",
+ true));
+ final Diff leftPeriodicalDiff3Way = Iterators.find(differences.iterator(), leftPeriodical3Way);
+ leftToRight = false;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff3Way);
+
+ assertEquals(11, Iterables.size(subDiffs));
+
+ // Left to right on a deleted element
+ leftToRight = true;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftPeriodicalDiff3Way);
+
+ assertEquals(8, Iterables.size(subDiffs));
+
+ // Right to left on a added element
+ final Predicate<? super Diff> leftMagazine3Way = and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), referenceValueMatch("eClassifiers", "extlibrary.Magazine", true));
+ final Diff leftMagazineDiff3Way = Iterators.find(differences.iterator(), leftMagazine3Way);
+ leftToRight = false;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff3Way);
+
+ assertEquals(5, Iterables.size(subDiffs));
+
+ // Left to right on an added element
+ leftToRight = true;
+ subDiffs = ComparisonUtil.getSubDiffs(leftToRight).apply(leftMagazineDiff3Way);
+
+ assertEquals(5, Iterables.size(subDiffs));
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/LCSPerformanceTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/LCSPerformanceTest.java
index ca7cbc688..56a728ec0 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/LCSPerformanceTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/LCSPerformanceTest.java
@@ -1,161 +1,161 @@
-/**
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.diff;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.EMFCompare;
-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.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.nodes.Node;
-import org.eclipse.emf.compare.tests.nodes.NodesFactory;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * This will specifically make sure that merging two large lists never takes more than a set amount of time.
- * <p>
- * I have a list (S1) on the left side that contains 2000 elements. Its counterpart on the right side (S2) has
- * 200 elements, only 100 of which are not differences (i.e. : also present in S1). We'll make sure that
- * merging these two lists is fast enough (through test timeouts).
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("nls")
-public class LCSPerformanceTest {
- private XMIResource left;
-
- private XMIResource right;
-
- @Before
- public void setup() {
- left = new XMIResourceImpl(URI.createURI("left.xmi"));
- right = new XMIResourceImpl(URI.createURI("right.xmi"));
-
- createNode(left, 2000, 0, 1);
- createNode(right, 200, 0, 1901);
- }
-
- @Test
- public void checkTestData() {
- assertTrue(left.getContents().size() == 1);
- final Node leftRoot = (Node)left.getContents().get(0);
- assertTrue(leftRoot.eContents().size() == 2000);
-
- assertTrue(right.getContents().size() == 1);
- final Node rightRoot = (Node)right.getContents().get(0);
- assertTrue(rightRoot.eContents().size() == 200);
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> additions = Lists.newArrayList();
- final List<Diff> deletions = Lists.newArrayList();
-
- for (Diff difference : comparison.getDifferences()) {
- if (difference.getKind() == DifferenceKind.ADD) {
- additions.add(difference);
- } else {
- deletions.add(difference);
- }
- }
-
- assertEquals(Integer.valueOf(1900), Integer.valueOf(additions.size()));
- assertEquals(Integer.valueOf(100), Integer.valueOf(deletions.size()));
- }
-
- /**
- * Will fail if {@link #checkTestData()} does.
- * <p>
- * The real assertion here is that this should never take more than 40 seconds to execute. We have 1900
- * additions to merge, accounting for as many LCS computations.
- * </p>
- * <p>
- * Note that this test should run in less than 30 seconds... we give it a little leeway with a 40 seconds
- * time out.
- * </p>
- * <p>
- * Ignored for now : the build machine is much too slow and does not execute this even when left 60s to do
- * so.
- * </p>
- */
- @Ignore
- @Test(timeout = 40000)
- public void copyLeftToRight() {
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final IMerger.Registry registry = IMerger.RegistryImpl.createStandaloneInstance();
- final IBatchMerger merger = new BatchMerger(registry);
- merger.copyAllLeftToRight(comparison.getDifferences(), new BasicMonitor());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- /**
- * Will fail if {@link #checkTestData()} does.
- * <p>
- * The real assertion here is that this should never take more than 3 seconds to execute : we're resetting
- * all differences so there are only 100 "slow" ones : resetting deletions need the LCS computation.
- * </p>
- * <p>
- * Ignored for now : the build machine is much too slow.
- * </p>
- */
- @Ignore
- @Test(timeout = 3000)
- public void copyRightToLeft() {
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final IMerger.Registry registry = IMerger.RegistryImpl.createStandaloneInstance();
- final IBatchMerger merger = new BatchMerger(registry);
- merger.copyAllRightToLeft(comparison.getDifferences(), new BasicMonitor());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- private void createNode(XMIResource resource, int childCount, int nodeId, int idGap) {
- resource.eSetDeliver(false);
- Node node = NodesFactory.eINSTANCE.createNode();
- node.setName("node" + nodeId);
- resource.getContents().add(node);
- resource.setID(node, Integer.toString(nodeId));
- int childId = nodeId + Math.max(1, idGap);
- for (int i = 0; i < childCount; i++) {
- Node child = NodesFactory.eINSTANCE.createNode();
- child.setName("node" + childId);
- node.getContainmentRef1().add(child);
- resource.setID(child, Integer.toString(childId));
- childId++;
- }
- resource.eSetDeliver(true);
- }
-}
+/**
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.diff;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.EMFCompare;
+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.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodesFactory;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This will specifically make sure that merging two large lists never takes more than a set amount of time.
+ * <p>
+ * I have a list (S1) on the left side that contains 2000 elements. Its counterpart on the right side (S2) has
+ * 200 elements, only 100 of which are not differences (i.e. : also present in S1). We'll make sure that
+ * merging these two lists is fast enough (through test timeouts).
+ * </p>
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@SuppressWarnings("nls")
+public class LCSPerformanceTest {
+ private XMIResource left;
+
+ private XMIResource right;
+
+ @Before
+ public void setup() {
+ left = new XMIResourceImpl(URI.createURI("left.xmi"));
+ right = new XMIResourceImpl(URI.createURI("right.xmi"));
+
+ createNode(left, 2000, 0, 1);
+ createNode(right, 200, 0, 1901);
+ }
+
+ @Test
+ public void checkTestData() {
+ assertTrue(left.getContents().size() == 1);
+ final Node leftRoot = (Node)left.getContents().get(0);
+ assertTrue(leftRoot.eContents().size() == 2000);
+
+ assertTrue(right.getContents().size() == 1);
+ final Node rightRoot = (Node)right.getContents().get(0);
+ assertTrue(rightRoot.eContents().size() == 200);
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> additions = Lists.newArrayList();
+ final List<Diff> deletions = Lists.newArrayList();
+
+ for (Diff difference : comparison.getDifferences()) {
+ if (difference.getKind() == DifferenceKind.ADD) {
+ additions.add(difference);
+ } else {
+ deletions.add(difference);
+ }
+ }
+
+ assertEquals(Integer.valueOf(1900), Integer.valueOf(additions.size()));
+ assertEquals(Integer.valueOf(100), Integer.valueOf(deletions.size()));
+ }
+
+ /**
+ * Will fail if {@link #checkTestData()} does.
+ * <p>
+ * The real assertion here is that this should never take more than 40 seconds to execute. We have 1900
+ * additions to merge, accounting for as many LCS computations.
+ * </p>
+ * <p>
+ * Note that this test should run in less than 30 seconds... we give it a little leeway with a 40 seconds
+ * time out.
+ * </p>
+ * <p>
+ * Ignored for now : the build machine is much too slow and does not execute this even when left 60s to do
+ * so.
+ * </p>
+ */
+ @Ignore
+ @Test(timeout = 40000)
+ public void copyLeftToRight() {
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final IMerger.Registry registry = IMerger.RegistryImpl.createStandaloneInstance();
+ final IBatchMerger merger = new BatchMerger(registry);
+ merger.copyAllLeftToRight(comparison.getDifferences(), new BasicMonitor());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ /**
+ * Will fail if {@link #checkTestData()} does.
+ * <p>
+ * The real assertion here is that this should never take more than 3 seconds to execute : we're resetting
+ * all differences so there are only 100 "slow" ones : resetting deletions need the LCS computation.
+ * </p>
+ * <p>
+ * Ignored for now : the build machine is much too slow.
+ * </p>
+ */
+ @Ignore
+ @Test(timeout = 3000)
+ public void copyRightToLeft() {
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final IMerger.Registry registry = IMerger.RegistryImpl.createStandaloneInstance();
+ final IBatchMerger merger = new BatchMerger(registry);
+ merger.copyAllRightToLeft(comparison.getDifferences(), new BasicMonitor());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ private void createNode(XMIResource resource, int childCount, int nodeId, int idGap) {
+ resource.eSetDeliver(false);
+ Node node = NodesFactory.eINSTANCE.createNode();
+ node.setName("node" + nodeId);
+ resource.getContents().add(node);
+ resource.setID(node, Integer.toString(nodeId));
+ int childId = nodeId + Math.max(1, idGap);
+ for (int i = 0; i < childCount; i++) {
+ Node child = NodesFactory.eINSTANCE.createNode();
+ child.setName("node" + childId);
+ node.getContainmentRef1().add(child);
+ resource.setID(child, Integer.toString(childId));
+ childId++;
+ }
+ resource.eSetDeliver(true);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/URIDistanceTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/URIDistanceTest.java
index b172370df..a0548fb94 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/URIDistanceTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/diff/URIDistanceTest.java
@@ -1,158 +1,158 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.diff;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.compare.match.eobject.URIDistance;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class URIDistanceTest {
-
- private URIDistance meter = new URIDistance();
-
- @Test
- public void moreOrLessTheSame() throws Exception {
- String origin = "/root/a/b";
- String closest = "/root/a/c";
- String farthest = "/root/d/c";
- assertTrue(proximity(origin, closest) < proximity(origin, farthest));
- }
-
- @Test
- public void moreOrLessTheSame2() throws Exception {
- String origin = "/root/a/b";
- String closest = "/root/a/b/c/d";
- String farthest = "/root/d/c/d";
- assertTrue(proximity(origin, closest) < proximity(origin, farthest));
- }
-
- @Test
- public void moreOrLessTheSame3() throws Exception {
- String origin = "/root/a/b";
- String closest = "/root/";
- String farthest = "/";
- assertTrue(proximity(origin, closest) < proximity(origin, farthest));
- }
-
- @Test
- public void moreOrLessTheSame4() throws Exception {
- String origin = "/root/a/b";
- String closest = "/root/";
- String farthest = "/otherRoot/";
- assertTrue(proximity(origin, closest) < proximity(origin, farthest));
- }
-
- @Test
- public void sameNumberOfFragments() throws Exception {
- assertEquals(1, proximity("/root/a/b", "/root/a/b/c"));
- assertEquals(1, proximity("/root/a/b/", "/root/a/b/c/"));
- assertEquals(2, proximity("/root/a/b/", "/root/a/b/c/d/"));
- assertEquals(0, proximity("/root/a/b", "/root/a/b"));
- assertEquals(7, proximity("/root/a/a2/a3", "/root/b/b2/a3"));
- assertEquals(7, proximity("/root/a/a2/a3", "/root/b/a2/b3"));
- }
-
- @Test
- public void identics() throws Exception {
- assertEquals(0, proximity("/root/a/b/", "/root/a/b/"));
- assertEquals(0, proximity("/root/", "/root/"));
- assertEquals(0, proximity("", ""));
- }
-
- @Test
- public void limitCases() throws Exception {
- assertEquals(0, proximity("", ""));
- assertEquals(10, proximity("/", "/a/very/long/path/just/to/check/we/wont/ends/up/with/a/weird/thing"));
- assertEquals(10, proximity("/a/very/long/path/just/to/check/we/wont/ends/up/with/a/weird/thing", "/"));
- }
-
- @Test
- public void completelyDifferent() throws Exception {
- assertEquals(10, proximity("/c/d/e/", "/root/a/b/"));
- assertEquals(10, proximity("/c/", "/root/a/b/"));
- assertEquals(10, proximity("/c/d/e", "/root/"));
- assertEquals(10, proximity("/c/d/e/f", "/a/b/e/f"));
- assertEquals(10, proximity("/a", "/b"));
- }
-
- @Test
- public void orderMatters() throws Exception {
- assertEquals(10, proximity("/c/d/e/f", "/f/d/c/e"));
- }
-
- @Test
- public void idLikeURIs() throws Exception {
- assertEquals(10, proximity("#131233", "#azeazezae"));
- assertEquals(2, proximity("/c/d/e/f", "/c/d/e/f?#azeaze"));
- }
-
- @Test
- public void traillingSlashes() throws Exception {
- assertEquals(1, proximity("/root/a/b/", "/root/a/b/c/"));
- assertEquals(1, proximity("root/a/b/", "/root/a/b/c/"));
- assertEquals(1, proximity("/root/a/b/", "/root/a/b/c"));
- assertEquals(10, proximity("///root/a/b/", "/root/a/b/c"));
- }
-
- @Test
- public void nullDistanceForSameModel() throws Exception {
- Iterator<? extends EObject> it = EcorePackage.eINSTANCE.eAllContents();
- Iterator<? extends EObject> it2 = EcorePackage.eINSTANCE.eAllContents();
- while (it.hasNext() && it2.hasNext()) {
- EObject a = it.next();
- EObject b = it2.next();
- // System.out.println(meter.apply(a));
- assertEquals(0, meter.proximity(a, b));
- }
- }
-
- /**
- * Return a metric result URI similarities. It compares 2 strings splitting those by "/" and return an int
- * representing the level of similarity. 0 - they are exactly the same to 10 - they are completely
- * different. "adding a fragment", "removing a fragment".
- *
- * @param aPath
- * First of the two {@link String}s to compare.
- * @param bPath
- * Second of the two {@link String}s to compare.
- * @return The number of changes to transform one uri to another one.
- */
- public int proximity(String aPath, String bPath) {
- if (aPath.equals(bPath)) {
- return 0;
- } else {
- CharMatcher slash = CharMatcher.is('/');
- Splitter splitter = Splitter.on('/');
- String actualAPath = aPath;
- String actualBPath = bPath;
- if (slash.indexIn(actualAPath) == 0) {
- actualAPath = aPath.substring(1);
- }
- if (slash.indexIn(actualBPath) == 0) {
- actualBPath = bPath.substring(1);
- }
- Iterable<String> aString = splitter.split(slash.trimTrailingFrom(actualAPath));
- Iterable<String> bString = splitter.split(slash.trimTrailingFrom(actualBPath));
- return meter.proximity(ImmutableList.copyOf(aString), ImmutableList.copyOf(bString));
- }
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.diff;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.base.CharMatcher;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.compare.match.eobject.URIDistance;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class URIDistanceTest {
+
+ private URIDistance meter = new URIDistance();
+
+ @Test
+ public void moreOrLessTheSame() throws Exception {
+ String origin = "/root/a/b";
+ String closest = "/root/a/c";
+ String farthest = "/root/d/c";
+ assertTrue(proximity(origin, closest) < proximity(origin, farthest));
+ }
+
+ @Test
+ public void moreOrLessTheSame2() throws Exception {
+ String origin = "/root/a/b";
+ String closest = "/root/a/b/c/d";
+ String farthest = "/root/d/c/d";
+ assertTrue(proximity(origin, closest) < proximity(origin, farthest));
+ }
+
+ @Test
+ public void moreOrLessTheSame3() throws Exception {
+ String origin = "/root/a/b";
+ String closest = "/root/";
+ String farthest = "/";
+ assertTrue(proximity(origin, closest) < proximity(origin, farthest));
+ }
+
+ @Test
+ public void moreOrLessTheSame4() throws Exception {
+ String origin = "/root/a/b";
+ String closest = "/root/";
+ String farthest = "/otherRoot/";
+ assertTrue(proximity(origin, closest) < proximity(origin, farthest));
+ }
+
+ @Test
+ public void sameNumberOfFragments() throws Exception {
+ assertEquals(1, proximity("/root/a/b", "/root/a/b/c"));
+ assertEquals(1, proximity("/root/a/b/", "/root/a/b/c/"));
+ assertEquals(2, proximity("/root/a/b/", "/root/a/b/c/d/"));
+ assertEquals(0, proximity("/root/a/b", "/root/a/b"));
+ assertEquals(7, proximity("/root/a/a2/a3", "/root/b/b2/a3"));
+ assertEquals(7, proximity("/root/a/a2/a3", "/root/b/a2/b3"));
+ }
+
+ @Test
+ public void identics() throws Exception {
+ assertEquals(0, proximity("/root/a/b/", "/root/a/b/"));
+ assertEquals(0, proximity("/root/", "/root/"));
+ assertEquals(0, proximity("", ""));
+ }
+
+ @Test
+ public void limitCases() throws Exception {
+ assertEquals(0, proximity("", ""));
+ assertEquals(10, proximity("/", "/a/very/long/path/just/to/check/we/wont/ends/up/with/a/weird/thing"));
+ assertEquals(10, proximity("/a/very/long/path/just/to/check/we/wont/ends/up/with/a/weird/thing", "/"));
+ }
+
+ @Test
+ public void completelyDifferent() throws Exception {
+ assertEquals(10, proximity("/c/d/e/", "/root/a/b/"));
+ assertEquals(10, proximity("/c/", "/root/a/b/"));
+ assertEquals(10, proximity("/c/d/e", "/root/"));
+ assertEquals(10, proximity("/c/d/e/f", "/a/b/e/f"));
+ assertEquals(10, proximity("/a", "/b"));
+ }
+
+ @Test
+ public void orderMatters() throws Exception {
+ assertEquals(10, proximity("/c/d/e/f", "/f/d/c/e"));
+ }
+
+ @Test
+ public void idLikeURIs() throws Exception {
+ assertEquals(10, proximity("#131233", "#azeazezae"));
+ assertEquals(2, proximity("/c/d/e/f", "/c/d/e/f?#azeaze"));
+ }
+
+ @Test
+ public void traillingSlashes() throws Exception {
+ assertEquals(1, proximity("/root/a/b/", "/root/a/b/c/"));
+ assertEquals(1, proximity("root/a/b/", "/root/a/b/c/"));
+ assertEquals(1, proximity("/root/a/b/", "/root/a/b/c"));
+ assertEquals(10, proximity("///root/a/b/", "/root/a/b/c"));
+ }
+
+ @Test
+ public void nullDistanceForSameModel() throws Exception {
+ Iterator<? extends EObject> it = EcorePackage.eINSTANCE.eAllContents();
+ Iterator<? extends EObject> it2 = EcorePackage.eINSTANCE.eAllContents();
+ while (it.hasNext() && it2.hasNext()) {
+ EObject a = it.next();
+ EObject b = it2.next();
+ // System.out.println(meter.apply(a));
+ assertEquals(0, meter.proximity(a, b));
+ }
+ }
+
+ /**
+ * Return a metric result URI similarities. It compares 2 strings splitting those by "/" and return an int
+ * representing the level of similarity. 0 - they are exactly the same to 10 - they are completely
+ * different. "adding a fragment", "removing a fragment".
+ *
+ * @param aPath
+ * First of the two {@link String}s to compare.
+ * @param bPath
+ * Second of the two {@link String}s to compare.
+ * @return The number of changes to transform one uri to another one.
+ */
+ public int proximity(String aPath, String bPath) {
+ if (aPath.equals(bPath)) {
+ return 0;
+ } else {
+ CharMatcher slash = CharMatcher.is('/');
+ Splitter splitter = Splitter.on('/');
+ String actualAPath = aPath;
+ String actualBPath = bPath;
+ if (slash.indexIn(actualAPath) == 0) {
+ actualAPath = aPath.substring(1);
+ }
+ if (slash.indexIn(actualBPath) == 0) {
+ actualBPath = bPath.substring(1);
+ }
+ Iterable<String> aString = splitter.split(slash.trimTrailingFrom(actualAPath));
+ Iterable<String> bString = splitter.split(slash.trimTrailingFrom(actualBPath));
+ return meter.proximity(ImmutableList.copyOf(aString), ImmutableList.copyOf(bString));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/AllEditTests.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/AllEditTests.java
index fd44ab880..a74290abe 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/AllEditTests.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/AllEditTests.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.edit;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-@RunWith(Suite.class)
-@SuiteClasses({TestComparisonItemProviderSpec.class, TestMatchItemProviderSpec.class,
- TestAttributeChangeItemProviderSpec.class, TestReferenceChangeItemProviderSpec.class })
-public class AllEditTests {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.edit;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+@RunWith(Suite.class)
+@SuiteClasses({TestComparisonItemProviderSpec.class, TestMatchItemProviderSpec.class,
+ TestAttributeChangeItemProviderSpec.class, TestReferenceChangeItemProviderSpec.class })
+public class AllEditTests {
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestAttributeChangeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestAttributeChangeItemProviderSpec.java
index adb46c237..a24b97270 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestAttributeChangeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestAttributeChangeItemProviderSpec.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.edit;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterators.filter;
-import static com.google.common.collect.Lists.newArrayList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.AttributeChange;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.tests.edit.data.ecore.a1.EcoreA1InputData;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class TestAttributeChangeItemProviderSpec extends AbstractTestCompareItemProviderAdapter {
-
- @Test
- public void testGetChildren_EcoreA1() throws IOException {
- Comparison comparison = getComparison(new EcoreA1InputData());
-
- List<AttributeChange> eAllContent_AttributeChange = newArrayList(filter(comparison.eAllContents(),
- AttributeChange.class));
- List<AttributeChange> eAllChildren_AttributeChange = newArrayList(filter(eAllChildren(comparison),
- AttributeChange.class));
-
- assertEquals(eAllContent_AttributeChange.size(), eAllChildren_AttributeChange.size());
- assertTrue(eAllChildren_AttributeChange.containsAll(eAllContent_AttributeChange));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.edit;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterators.filter;
+import static com.google.common.collect.Lists.newArrayList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.AttributeChange;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.tests.edit.data.ecore.a1.EcoreA1InputData;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class TestAttributeChangeItemProviderSpec extends AbstractTestCompareItemProviderAdapter {
+
+ @Test
+ public void testGetChildren_EcoreA1() throws IOException {
+ Comparison comparison = getComparison(new EcoreA1InputData());
+
+ List<AttributeChange> eAllContent_AttributeChange = newArrayList(filter(comparison.eAllContents(),
+ AttributeChange.class));
+ List<AttributeChange> eAllChildren_AttributeChange = newArrayList(filter(eAllChildren(comparison),
+ AttributeChange.class));
+
+ assertEquals(eAllContent_AttributeChange.size(), eAllChildren_AttributeChange.size());
+ assertTrue(eAllChildren_AttributeChange.containsAll(eAllContent_AttributeChange));
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ResourceScopeProvider.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ResourceScopeProvider.java
index b3fe1515e..7b8ad2d4c 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ResourceScopeProvider.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ResourceScopeProvider.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.edit.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public interface ResourceScopeProvider {
-
- Resource getLeft() throws IOException;
-
- Resource getRight() throws IOException;
-
- Resource getOrigin() throws IOException;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.edit.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public interface ResourceScopeProvider {
+
+ Resource getLeft() throws IOException;
+
+ Resource getRight() throws IOException;
+
+ Resource getOrigin() throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryLeft.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryLeft.ecore
index 65e2fb1e1..b26cef279 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryLeft.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryLeft.ecore
@@ -1,109 +1,109 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- <eLiterals xmi:id="_XID4MG9IEeG7V_vNzpYwOw" name="Encyclopedia" value="3" literal="Encyclopedia"/>
- <eLiterals xmi:id="_XIEfQG9IEeG7V_vNzpYwOw" name="Dictionary" value="4"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Borrowable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="length" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIJ-0G9IEeG7V_vNzpYwOw" name="fullName">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_XIKl4W9IEeG7V_vNzpYwOw" name="Magazine" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl429IEeG7V_vNzpYwOw" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl5W9IEeG7V_vNzpYwOw" name="pages">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ <eLiterals xmi:id="_XID4MG9IEeG7V_vNzpYwOw" name="Encyclopedia" value="3" literal="Encyclopedia"/>
+ <eLiterals xmi:id="_XIEfQG9IEeG7V_vNzpYwOw" name="Dictionary" value="4"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Borrowable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="length" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIJ-0G9IEeG7V_vNzpYwOw" name="fullName">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_XIKl4W9IEeG7V_vNzpYwOw" name="Magazine" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl429IEeG7V_vNzpYwOw" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl5W9IEeG7V_vNzpYwOw" name="pages">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryOrigin.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryOrigin.ecore
index 980acf487..c891aa81b 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryOrigin.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryOrigin.ecore
@@ -1,111 +1,111 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbRW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutesLength" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpY260EeGkd4g88tZXfA" name="reader" eType="_15N3gm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="lastName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbRW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutesLength" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpY260EeGkd4g88tZXfA" name="reader" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="lastName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryRight.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryRight.ecore
index f9cd2e823..09d5b0720 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryRight.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/data/ecore/a1/extlibraryRight.ecore
@@ -1,112 +1,112 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9MlYMG9IEeGekPcBm25hwQ" name="subtitle">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- <eLiterals xmi:id="_9Mw-YG9IEeGekPcBm25hwQ" name="Manga" value="3" literal="Manga"/>
- <eLiterals xmi:id="_9Mw-YW9IEeGekPcBm25hwQ" name="Manhwa" value="5"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutes" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="familyName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ysW9IEeGekPcBm25hwQ" name="Magazine" eSuperTypes="_15LbQ260EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ys29IEeGekPcBm25hwQ" name="TitledItem">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9M9ytG9IEeGekPcBm25hwQ" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9MlYMG9IEeGekPcBm25hwQ" name="subtitle">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ <eLiterals xmi:id="_9Mw-YG9IEeGekPcBm25hwQ" name="Manga" value="3" literal="Manga"/>
+ <eLiterals xmi:id="_9Mw-YW9IEeGekPcBm25hwQ" name="Manhwa" value="5"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutes" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="familyName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ysW9IEeGekPcBm25hwQ" name="Magazine" eSuperTypes="_15LbQ260EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ys29IEeGekPcBm25hwQ" name="TitledItem">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9M9ytG9IEeGekPcBm25hwQ" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/EquiComputingTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/EquiComputingTest.java
index f4f539bac..993c0a2fe 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/EquiComputingTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/EquiComputingTest.java
@@ -1,1113 +1,1113 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.equi;
-
-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 static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-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.notify.Notifier;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.equi.data.EquiInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings({"nls", "boxing" })
-public class EquiComputingTest {
-
- enum TestKind {
- LEFT, RIGHT;
- }
-
- private EquiInputData input = new EquiInputData();
-
- @Test
- public void testA1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
- final Comparison comparison = compare(left, right);
- testA1(TestKind.LEFT, comparison);
- }
-
- private static void testA1(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 6 differences
- assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2BDiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- Predicate<? super Diff> changeRefC2DDiffDescription = null;
- Predicate<? super Diff> changeRefD2CDiffDescription = null;
- Predicate<? super Diff> changeRefE2FDiffDescription = null;
- Predicate<? super Diff> changeRefF2EDiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", null,
- "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- changeRefC2DDiffDescription = addedToReference("Requirements.C", "destination", "Requirements.D");
- changeRefD2CDiffDescription = changedReference("Requirements.D", "source", null, "Requirements.C");
- changeRefE2FDiffDescription = addedToReference("Requirements.E", "destination", "Requirements.F");
- changeRefF2EDiffDescription = addedToReference("Requirements.F", "source", "Requirements.E");
- } else {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- null);
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- changeRefC2DDiffDescription = removedFromReference("Requirements.C", "destination",
- "Requirements.D");
- changeRefD2CDiffDescription = changedReference("Requirements.D", "source", "Requirements.C", null);
- changeRefE2FDiffDescription = removedFromReference("Requirements.E", "destination",
- "Requirements.F");
- changeRefF2EDiffDescription = removedFromReference("Requirements.F", "source", "Requirements.E");
- }
-
- final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
- final Diff changeRefC2DDiff = Iterators.find(differences.iterator(), changeRefC2DDiffDescription);
- final Diff changeRefD2CDiff = Iterators.find(differences.iterator(), changeRefD2CDiffDescription);
- final Diff changeRefE2FDiff = Iterators.find(differences.iterator(), changeRefE2FDiffDescription);
- final Diff changeRefF2EDiff = Iterators.find(differences.iterator(), changeRefF2EDiffDescription);
-
- assertNotNull(changeRefA2BDiff);
- assertNotNull(changeRefB2ADiff);
- assertNotNull(changeRefC2DDiff);
- assertNotNull(changeRefD2CDiff);
- assertNotNull(changeRefE2FDiff);
- assertNotNull(changeRefF2EDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(3), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2BDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefA2BDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
-
- assertNotNull(changeRefC2DDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefC2DDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefC2DDiff));
- assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefD2CDiff));
-
- assertNotNull(changeRefE2FDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefE2FDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefE2FDiff));
- assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefF2EDiff));
- }
-
- @Test
- public void testA2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right);
-
- testA2(TestKind.LEFT, comparison);
-
- }
-
- private static void testA2(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 8 differences
- assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefC2D1DiffDescription = null;
- Predicate<? super Diff> changeRefC2D2DiffDescription = null;
- Predicate<? super Diff> changeRefD12CDiffDescription = null;
- Predicate<? super Diff> changeRefD22CDiffDescription = null;
- Predicate<? super Diff> changeRefE2F1DiffDescription = null;
- Predicate<? super Diff> changeRefE2F2DiffDescription = null;
- Predicate<? super Diff> changeRefF12EDiffDescription = null;
- Predicate<? super Diff> changeRefF22EDiffDescription = null;
-
- if (kind.equals(TestKind.LEFT)) {
- changeRefC2D1DiffDescription = addedToReference("Requirements.C", "destination",
- "Requirements.D1");
- changeRefC2D2DiffDescription = addedToReference("Requirements.C", "destination",
- "Requirements.D2");
- changeRefD12CDiffDescription = changedReference("Requirements.D1", "source", null,
- "Requirements.C");
- changeRefD22CDiffDescription = changedReference("Requirements.D2", "source", null,
- "Requirements.C");
- changeRefE2F1DiffDescription = addedToReference("Requirements.E", "destination",
- "Requirements.F1");
- changeRefE2F2DiffDescription = addedToReference("Requirements.E", "destination",
- "Requirements.F2");
- changeRefF12EDiffDescription = addedToReference("Requirements.F1", "source", "Requirements.E");
- changeRefF22EDiffDescription = addedToReference("Requirements.F2", "source", "Requirements.E");
- } else {
- changeRefC2D1DiffDescription = removedFromReference("Requirements.C", "destination",
- "Requirements.D1");
- changeRefC2D2DiffDescription = removedFromReference("Requirements.C", "destination",
- "Requirements.D2");
- changeRefD12CDiffDescription = changedReference("Requirements.D1", "source", "Requirements.C",
- null);
- changeRefD22CDiffDescription = changedReference("Requirements.D2", "source", "Requirements.C",
- null);
- changeRefE2F1DiffDescription = removedFromReference("Requirements.E", "destination",
- "Requirements.F1");
- changeRefE2F2DiffDescription = removedFromReference("Requirements.E", "destination",
- "Requirements.F2");
- changeRefF12EDiffDescription = removedFromReference("Requirements.F1", "source", "Requirements.E");
- changeRefF22EDiffDescription = removedFromReference("Requirements.F2", "source", "Requirements.E");
- }
-
- final Diff changeRefC2D1Diff = Iterators.find(differences.iterator(), changeRefC2D1DiffDescription);
- final Diff changeRefC2D2Diff = Iterators.find(differences.iterator(), changeRefC2D2DiffDescription);
- final Diff changeRefD12CDiff = Iterators.find(differences.iterator(), changeRefD12CDiffDescription);
- final Diff changeRefD22CDiff = Iterators.find(differences.iterator(), changeRefD22CDiffDescription);
- final Diff changeRefE2F1Diff = Iterators.find(differences.iterator(), changeRefE2F1DiffDescription);
- final Diff changeRefE2F2Diff = Iterators.find(differences.iterator(), changeRefE2F2DiffDescription);
- final Diff changeRefF12EDiff = Iterators.find(differences.iterator(), changeRefF12EDiffDescription);
- final Diff changeRefF22EDiff = Iterators.find(differences.iterator(), changeRefF22EDiffDescription);
-
- assertNotNull(changeRefC2D1Diff);
- assertNotNull(changeRefC2D2Diff);
- assertNotNull(changeRefD12CDiff);
- assertNotNull(changeRefD22CDiff);
- assertNotNull(changeRefE2F1Diff);
- assertNotNull(changeRefE2F2Diff);
- assertNotNull(changeRefF12EDiff);
- assertNotNull(changeRefF22EDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(4), comparison.getEquivalences().size());
-
- assertNotNull(changeRefC2D1Diff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefC2D1Diff.getEquivalence().getDifferences().size());
- assertTrue(changeRefC2D1Diff.getEquivalence().getDifferences().contains(changeRefC2D1Diff));
- assertTrue(changeRefC2D1Diff.getEquivalence().getDifferences().contains(changeRefD12CDiff));
-
- assertNotNull(changeRefC2D2Diff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefC2D2Diff.getEquivalence().getDifferences().size());
- assertTrue(changeRefC2D2Diff.getEquivalence().getDifferences().contains(changeRefC2D2Diff));
- assertTrue(changeRefC2D2Diff.getEquivalence().getDifferences().contains(changeRefD22CDiff));
-
- assertNotNull(changeRefE2F1Diff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefE2F1Diff.getEquivalence().getDifferences().size());
- assertTrue(changeRefE2F1Diff.getEquivalence().getDifferences().contains(changeRefE2F1Diff));
- assertTrue(changeRefE2F1Diff.getEquivalence().getDifferences().contains(changeRefF12EDiff));
-
- assertNotNull(changeRefE2F2Diff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefE2F2Diff.getEquivalence().getDifferences().size());
- assertTrue(changeRefE2F2Diff.getEquivalence().getDifferences().contains(changeRefE2F2Diff));
- assertTrue(changeRefE2F2Diff.getEquivalence().getDifferences().contains(changeRefF22EDiff));
- }
-
- @Test
- public void testA3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right);
-
- testA3(TestKind.LEFT, comparison);
-
- }
-
- private static void testA3(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 8 differences
- assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> C1toD1DiffDescription = null;
- Predicate<? super Diff> C1toD2DiffDescription = null;
- Predicate<? super Diff> C2toD1DiffDescription = null;
- Predicate<? super Diff> C2toD2DiffDescription = null;
- Predicate<? super Diff> D1toC1DiffDescription = null;
- Predicate<? super Diff> D1toC2DiffDescription = null;
- Predicate<? super Diff> D2toC2DiffDescription = null;
- Predicate<? super Diff> D2toC1DiffDescription = null;
-
- if (kind.equals(TestKind.LEFT)) {
- C1toD1DiffDescription = addedToReference("Requirements.C1", "destination", "Requirements.D1");
- C1toD2DiffDescription = addedToReference("Requirements.C1", "destination", "Requirements.D2");
- C2toD1DiffDescription = addedToReference("Requirements.C2", "destination", "Requirements.D1");
- C2toD2DiffDescription = addedToReference("Requirements.C2", "source", "Requirements.D2");
- D1toC1DiffDescription = addedToReference("Requirements.D1", "source", "Requirements.C1");
- D1toC2DiffDescription = addedToReference("Requirements.D1", "source", "Requirements.C2");
- D2toC2DiffDescription = addedToReference("Requirements.D2", "destination", "Requirements.C2");
- D2toC1DiffDescription = addedToReference("Requirements.D2", "source", "Requirements.C1");
- } else {
- C1toD1DiffDescription = removedFromReference("Requirements.C1", "destination", "Requirements.D1");
- C1toD2DiffDescription = removedFromReference("Requirements.C1", "destination", "Requirements.D2");
- C2toD1DiffDescription = removedFromReference("Requirements.C2", "destination", "Requirements.D1");
- C2toD2DiffDescription = removedFromReference("Requirements.C2", "source", "Requirements.D2");
- D1toC1DiffDescription = removedFromReference("Requirements.D1", "source", "Requirements.C1");
- D1toC2DiffDescription = removedFromReference("Requirements.D1", "source", "Requirements.C2");
- D2toC2DiffDescription = removedFromReference("Requirements.D2", "destination", "Requirements.C2");
- D2toC1DiffDescription = removedFromReference("Requirements.D2", "source", "Requirements.C1");
- }
-
- final Diff C1toD1Diff = Iterators.find(differences.iterator(), C1toD1DiffDescription);
- final Diff C1toD2Diff = Iterators.find(differences.iterator(), C1toD2DiffDescription);
- final Diff C2toD1Diff = Iterators.find(differences.iterator(), C2toD1DiffDescription);
- final Diff C2toD2Diff = Iterators.find(differences.iterator(), C2toD2DiffDescription);
- final Diff D1toC1Diff = Iterators.find(differences.iterator(), D1toC1DiffDescription);
- final Diff D1toC2Diff = Iterators.find(differences.iterator(), D1toC2DiffDescription);
- final Diff D2toC2Diff = Iterators.find(differences.iterator(), D2toC2DiffDescription);
- final Diff D2toC1Diff = Iterators.find(differences.iterator(), D2toC1DiffDescription);
-
- assertNotNull(C1toD1Diff);
- assertNotNull(C1toD2Diff);
- assertNotNull(C2toD1Diff);
- assertNotNull(C2toD2Diff);
- assertNotNull(D1toC1Diff);
- assertNotNull(D1toC2Diff);
- assertNotNull(D2toC2Diff);
- assertNotNull(D2toC1Diff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(4), comparison.getEquivalences().size());
-
- assertNotNull(C1toD1Diff.getEquivalence());
- assertSame(Integer.valueOf(2), C1toD1Diff.getEquivalence().getDifferences().size());
- assertTrue(C1toD1Diff.getEquivalence().getDifferences().contains(C1toD1Diff));
- assertTrue(C1toD1Diff.getEquivalence().getDifferences().contains(D1toC1Diff));
-
- assertNotNull(C1toD2Diff.getEquivalence());
- assertSame(Integer.valueOf(2), C1toD2Diff.getEquivalence().getDifferences().size());
- assertTrue(C1toD2Diff.getEquivalence().getDifferences().contains(C1toD2Diff));
- assertTrue(C1toD2Diff.getEquivalence().getDifferences().contains(D2toC1Diff));
-
- assertNotNull(C2toD1Diff.getEquivalence());
- assertSame(Integer.valueOf(2), C2toD1Diff.getEquivalence().getDifferences().size());
- assertTrue(C2toD1Diff.getEquivalence().getDifferences().contains(C2toD1Diff));
- assertTrue(C2toD1Diff.getEquivalence().getDifferences().contains(D1toC2Diff));
-
- assertNotNull(C2toD2Diff.getEquivalence());
- assertSame(Integer.valueOf(2), C2toD2Diff.getEquivalence().getDifferences().size());
- assertTrue(C2toD2Diff.getEquivalence().getDifferences().contains(C2toD2Diff));
- assertTrue(C2toD2Diff.getEquivalence().getDifferences().contains(D2toC2Diff));
- }
-
- @Test
- public void testA4UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right);
-
- testA4(TestKind.LEFT, comparison);
- }
-
- private static void testA4(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 8 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> AtoBdestDiffDescription = null;
- Predicate<? super Diff> AtoBsourceDiffDescription = null;
- Predicate<? super Diff> BtoAdestDiffDescription = null;
- Predicate<? super Diff> BtoAsourceDiffDescription = null;
-
- if (kind.equals(TestKind.LEFT)) {
- AtoBdestDiffDescription = addedToReference("Requirements.A", "destination", "Requirements.B");
- AtoBsourceDiffDescription = addedToReference("Requirements.A", "source", "Requirements.B");
- BtoAdestDiffDescription = addedToReference("Requirements.B", "destination", "Requirements.A");
- BtoAsourceDiffDescription = addedToReference("Requirements.B", "source", "Requirements.A");
- } else {
- AtoBdestDiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.B");
- AtoBsourceDiffDescription = removedFromReference("Requirements.A", "source", "Requirements.B");
- BtoAdestDiffDescription = removedFromReference("Requirements.B", "destination", "Requirements.A");
- BtoAsourceDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.A");
- }
-
- final Diff AtoBdestDiff = Iterators.find(differences.iterator(), AtoBdestDiffDescription);
- final Diff AtoBsourceDiff = Iterators.find(differences.iterator(), AtoBsourceDiffDescription);
- final Diff BtoAdestDiff = Iterators.find(differences.iterator(), BtoAdestDiffDescription);
- final Diff BtoAsourceDiff = Iterators.find(differences.iterator(), BtoAsourceDiffDescription);
-
- assertNotNull(AtoBdestDiff);
- assertNotNull(AtoBsourceDiff);
- assertNotNull(BtoAdestDiff);
- assertNotNull(BtoAsourceDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(2), comparison.getEquivalences().size());
-
- assertNotNull(AtoBdestDiff.getEquivalence());
- assertSame(Integer.valueOf(2), AtoBdestDiff.getEquivalence().getDifferences().size());
- assertTrue(AtoBdestDiff.getEquivalence().getDifferences().contains(AtoBdestDiff));
- assertTrue(AtoBdestDiff.getEquivalence().getDifferences().contains(BtoAsourceDiff));
-
- assertNotNull(AtoBsourceDiff.getEquivalence());
- assertSame(Integer.valueOf(2), AtoBsourceDiff.getEquivalence().getDifferences().size());
- assertTrue(AtoBsourceDiff.getEquivalence().getDifferences().contains(AtoBsourceDiff));
- assertTrue(AtoBsourceDiff.getEquivalence().getDifferences().contains(BtoAdestDiff));
- }
-
- @Test
- public void testA5UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final Comparison comparison = compare(left, right);
-
- testA5(TestKind.LEFT, comparison);
- }
-
- private static void testA5(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 12 differences
- assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2BDiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- Predicate<? super Diff> changeRefC2DDiffDescription = null;
- Predicate<? super Diff> changeRefD2CDiffDescription = null;
- Predicate<? super Diff> changeRefE2FDiffDescription = null;
- Predicate<? super Diff> changeRefF2EDiffDescription = null;
- Predicate<? super Diff> addADiffDescription = null;
- Predicate<? super Diff> addBDiffDescription = null;
- Predicate<? super Diff> addCDiffDescription = null;
- Predicate<? super Diff> addDDiffDescription = null;
- Predicate<? super Diff> addEDiffDescription = null;
- Predicate<? super Diff> addFDiffDescription = null;
-
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", null,
- "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- changeRefC2DDiffDescription = addedToReference("Requirements.C", "destination", "Requirements.D");
- changeRefD2CDiffDescription = changedReference("Requirements.D", "source", null, "Requirements.C");
- changeRefE2FDiffDescription = addedToReference("Requirements.E", "destination", "Requirements.F");
- changeRefF2EDiffDescription = addedToReference("Requirements.F", "source", "Requirements.E");
-
- addADiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.A");
- addBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
- addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
- addDDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.D");
- addEDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.E");
- addFDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.F");
- } else {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- null);
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- changeRefC2DDiffDescription = removedFromReference("Requirements.C", "destination",
- "Requirements.D");
- changeRefD2CDiffDescription = changedReference("Requirements.D", "source", "Requirements.C", null);
- changeRefE2FDiffDescription = removedFromReference("Requirements.E", "destination",
- "Requirements.F");
- changeRefF2EDiffDescription = removedFromReference("Requirements.F", "source", "Requirements.E");
-
- addADiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.A");
- addBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
- addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
- addDDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.D");
- addEDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.E");
- addFDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.F");
- }
-
- final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
- final Diff changeRefC2DDiff = Iterators.find(differences.iterator(), changeRefC2DDiffDescription);
- final Diff changeRefD2CDiff = Iterators.find(differences.iterator(), changeRefD2CDiffDescription);
- final Diff changeRefE2FDiff = Iterators.find(differences.iterator(), changeRefE2FDiffDescription);
- final Diff changeRefF2EDiff = Iterators.find(differences.iterator(), changeRefF2EDiffDescription);
-
- final Diff addADiff = Iterators.find(differences.iterator(), addADiffDescription);
- final Diff addBDiff = Iterators.find(differences.iterator(), addBDiffDescription);
- final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
- final Diff addDDiff = Iterators.find(differences.iterator(), addDDiffDescription);
- final Diff addEDiff = Iterators.find(differences.iterator(), addEDiffDescription);
- final Diff addFDiff = Iterators.find(differences.iterator(), addFDiffDescription);
-
- assertNotNull(changeRefA2BDiff);
- assertNotNull(changeRefB2ADiff);
- assertNotNull(changeRefC2DDiff);
- assertNotNull(changeRefD2CDiff);
- assertNotNull(changeRefE2FDiff);
- assertNotNull(changeRefF2EDiff);
-
- assertNotNull(addADiff);
- assertNotNull(addBDiff);
- assertNotNull(addCDiff);
- assertNotNull(addDDiff);
- assertNotNull(addEDiff);
- assertNotNull(addFDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(3), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2BDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefA2BDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
-
- assertNotNull(changeRefC2DDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefC2DDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefC2DDiff));
- assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefD2CDiff));
-
- assertNotNull(changeRefE2FDiff.getEquivalence());
- assertSame(Integer.valueOf(2), changeRefE2FDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefE2FDiff));
- assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefF2EDiff));
- }
-
- @Test
- public void testB1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(right, left);
-
- testA1(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testB2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(right, left);
-
- testA2(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testB3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(right, left);
-
- testA3(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testB4UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- Comparison comparison = compare(right, left);
-
- testA4(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testB5UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- Comparison comparison = compare(right, left);
-
- testA5(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testC1UseCase() throws IOException {
- final Resource left = input.getC1Left();
- final Resource right = input.getC1Right();
-
- final Comparison comparison = compare(left, right);
-
- testC1(TestKind.LEFT, comparison);
- }
-
- private static void testC1(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2BDiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- Predicate<? super Diff> changeRefC2ADiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- "Requirements.C");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
- } else {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
- "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
- }
-
- final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
- final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
-
- assertNotNull(changeRefA2BDiff);
- assertNotNull(changeRefB2ADiff);
- assertNotNull(changeRefC2ADiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2BDiff.getEquivalence());
- assertSame(Integer.valueOf(3), changeRefA2BDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
-
- }
-
- @Test
- public void testC2UseCase() throws IOException {
- final Resource left = input.getC2Left();
- final Resource right = input.getC2Right();
-
- final Comparison comparison = compare(left, right);
-
- testC2(TestKind.LEFT, comparison);
- }
-
- private static void testC2(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 4 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2BDiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- Predicate<? super Diff> changeRefC2ADiffDescription = null;
- Predicate<? super Diff> addCDiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- "Requirements.C");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
- addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
- } else {
- changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
- "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
- addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
- }
-
- final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
- final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
- final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
-
- assertNotNull(changeRefA2BDiff);
- assertNotNull(changeRefB2ADiff);
- assertNotNull(changeRefC2ADiff);
- assertNotNull(addCDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2BDiff.getEquivalence());
- assertSame(Integer.valueOf(3), changeRefA2BDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
- assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
-
- }
-
- @Test
- public void testC3UseCase() throws IOException {
- final Resource left = input.getC3Left();
- final Resource right = input.getC3Right();
-
- final Comparison comparison = compare(left, right);
-
- testC3(TestKind.LEFT, comparison);
- }
-
- private static void testC3(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 4 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2CDiffDescription = null;
- Predicate<? super Diff> deleteBDiffDescription = null;
- Predicate<? super Diff> changeRefC2ADiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- "Requirements.C");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
- deleteBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- } else {
- changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
- "Requirements.B");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
- deleteBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- }
-
- final Diff changeRefA2CDiff = Iterators.find(differences.iterator(), changeRefA2CDiffDescription);
- final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
- final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
-
- assertNotNull(changeRefA2CDiff);
- assertNotNull(changeRefC2ADiff);
- assertNotNull(deleteBDiff);
- assertNotNull(changeRefB2ADiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2CDiff.getEquivalence());
- assertSame(Integer.valueOf(3), changeRefA2CDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefA2CDiff));
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
-
- }
-
- @Test
- public void testC4UseCase() throws IOException {
- final Resource left = input.getC4Left();
- final Resource right = input.getC4Right();
-
- final Comparison comparison = compare(left, right);
-
- testC4(TestKind.LEFT, comparison);
- }
-
- private static void testC4(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 5 differences
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> changeRefA2CDiffDescription = null;
- Predicate<? super Diff> deleteBDiffDescription = null;
- Predicate<? super Diff> changeRefC2ADiffDescription = null;
- Predicate<? super Diff> changeRefB2ADiffDescription = null;
- Predicate<? super Diff> addCDiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
- "Requirements.C");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
- deleteBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
- addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
- } else {
- changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
- "Requirements.B");
- changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
- deleteBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
- changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
- addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
- }
-
- final Diff changeRefA2CDiff = Iterators.find(differences.iterator(), changeRefA2CDiffDescription);
- final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
- final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
- final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
- final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
-
- assertNotNull(changeRefA2CDiff);
- assertNotNull(changeRefC2ADiff);
- assertNotNull(deleteBDiff);
- assertNotNull(changeRefB2ADiff);
- assertNotNull(addCDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
-
- assertNotNull(changeRefA2CDiff.getEquivalence());
- assertSame(Integer.valueOf(3), changeRefA2CDiff.getEquivalence().getDifferences().size());
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefA2CDiff));
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
- assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
-
- }
-
- @Test
- public void testD1UseCase() throws IOException {
- final Resource left = input.getD1Left();
- final Resource right = input.getD1Right();
-
- final Comparison comparison = compare(left, right);
-
- testD1(TestKind.LEFT, comparison);
- }
-
- private static void testD1(final TestKind kind, final Comparison comparison) {
- List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 16 differences
- assertSame(Integer.valueOf(16), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> delBonADiffDescription = null;
- Predicate<? super Diff> delAonBDiffDescription = null;
- Predicate<? super Diff> addDonADiffDescription = null;
- Predicate<? super Diff> addEonADiffDescription = null;
- Predicate<? super Diff> delFonBDiffDescription = null;
- Predicate<? super Diff> addFonCDiffDescription = null;
- Predicate<? super Diff> addAonDDiffDescription = null;
- Predicate<? super Diff> delFonDDiffDescription = null;
- Predicate<? super Diff> addAonEDiffDescription = null;
- Predicate<? super Diff> addFonEDiffDescription = null;
- Predicate<? super Diff> delDonFDiffDescription = null;
- Predicate<? super Diff> delBonFDiffDescription = null;
- Predicate<? super Diff> addEonFDiffDescription = null;
- Predicate<? super Diff> addConFDiffDescription = null;
- Predicate<? super Diff> delBDiffDescription = null;
- Predicate<? super Diff> addEDiffDescription = null;
- if (kind.equals(TestKind.LEFT)) {
- delBonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.B");
- delAonBDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.A");
- addDonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.D");
- addEonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.E");
- delFonBDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.F");
- addFonCDiffDescription = addedToReference("Requirements.C", "source", "Requirements.F");
- addAonDDiffDescription = addedToReference("Requirements.D", "source", "Requirements.A");
- delFonDDiffDescription = removedFromReference("Requirements.D", "source", "Requirements.F");
- addAonEDiffDescription = addedToReference("Requirements.E", "source", "Requirements.A");
- addFonEDiffDescription = addedToReference("Requirements.E", "source", "Requirements.F");
- delDonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.D");
- delBonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.B");
- addEonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.E");
- addConFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.C");
- delBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
- addEDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.E");
- } else {
- delBonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.B");
- delAonBDiffDescription = addedToReference("Requirements.B", "source", "Requirements.A");
- addDonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.D");
- addEonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.E");
- delFonBDiffDescription = addedToReference("Requirements.B", "source", "Requirements.F");
- addFonCDiffDescription = removedFromReference("Requirements.C", "source", "Requirements.F");
- addAonDDiffDescription = removedFromReference("Requirements.D", "source", "Requirements.A");
- delFonDDiffDescription = addedToReference("Requirements.D", "source", "Requirements.F");
- addAonEDiffDescription = removedFromReference("Requirements.E", "source", "Requirements.A");
- addFonEDiffDescription = removedFromReference("Requirements.E", "source", "Requirements.F");
- delDonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.D");
- delBonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.B");
- addEonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.E");
- addConFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.C");
- delBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
- addEDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.E");
- }
-
- final Diff delBonADiff = Iterators.find(differences.iterator(), delBonADiffDescription);
- final Diff delAonBDiff = Iterators.find(differences.iterator(), delAonBDiffDescription);
- final Diff addDonADiff = Iterators.find(differences.iterator(), addDonADiffDescription);
- final Diff addEonADiff = Iterators.find(differences.iterator(), addEonADiffDescription);
- final Diff delFonBDiff = Iterators.find(differences.iterator(), delFonBDiffDescription);
- final Diff addFonCDiff = Iterators.find(differences.iterator(), addFonCDiffDescription);
- final Diff addAonDDiff = Iterators.find(differences.iterator(), addAonDDiffDescription);
- final Diff delFonDDiff = Iterators.find(differences.iterator(), delFonDDiffDescription);
- final Diff addAonEDiff = Iterators.find(differences.iterator(), addAonEDiffDescription);
- final Diff addFonEDiff = Iterators.find(differences.iterator(), addFonEDiffDescription);
- final Diff delDonFDiff = Iterators.find(differences.iterator(), delDonFDiffDescription);
- final Diff delBonFDiff = Iterators.find(differences.iterator(), delBonFDiffDescription);
- final Diff addEonFDiff = Iterators.find(differences.iterator(), addEonFDiffDescription);
- final Diff addConFDiff = Iterators.find(differences.iterator(), addConFDiffDescription);
- final Diff delBDiff = Iterators.find(differences.iterator(), delBDiffDescription);
- final Diff addEDiff = Iterators.find(differences.iterator(), addEDiffDescription);
-
- assertNotNull(delBonADiff);
- assertNotNull(delAonBDiff);
- assertNotNull(addDonADiff);
- assertNotNull(addEonADiff);
- assertNotNull(delFonBDiff);
- assertNotNull(addFonCDiff);
- assertNotNull(addAonDDiff);
- assertNotNull(delFonDDiff);
- assertNotNull(addAonEDiff);
- assertNotNull(addFonEDiff);
- assertNotNull(delDonFDiff);
- assertNotNull(delBonFDiff);
- assertNotNull(addEonFDiff);
- assertNotNull(addConFDiff);
- assertNotNull(delBDiff);
- assertNotNull(addEDiff);
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(7), comparison.getEquivalences().size());
-
- assertNotNull(delBonADiff.getEquivalence());
- assertSame(Integer.valueOf(2), delBonADiff.getEquivalence().getDifferences().size());
- assertTrue(delBonADiff.getEquivalence().getDifferences().contains(delBonADiff));
- assertTrue(delBonADiff.getEquivalence().getDifferences().contains(delAonBDiff));
-
- assertNotNull(addDonADiff.getEquivalence());
- assertSame(Integer.valueOf(2), addDonADiff.getEquivalence().getDifferences().size());
- assertTrue(addDonADiff.getEquivalence().getDifferences().contains(addDonADiff));
- assertTrue(addDonADiff.getEquivalence().getDifferences().contains(addAonDDiff));
-
- assertNotNull(addEonADiff.getEquivalence());
- assertSame(Integer.valueOf(2), addEonADiff.getEquivalence().getDifferences().size());
- assertTrue(addEonADiff.getEquivalence().getDifferences().contains(addEonADiff));
- assertTrue(addEonADiff.getEquivalence().getDifferences().contains(addAonEDiff));
-
- assertNotNull(delFonBDiff.getEquivalence());
- assertSame(Integer.valueOf(2), delFonBDiff.getEquivalence().getDifferences().size());
- assertTrue(delFonBDiff.getEquivalence().getDifferences().contains(delFonBDiff));
- assertTrue(delFonBDiff.getEquivalence().getDifferences().contains(delBonFDiff));
-
- assertNotNull(addFonCDiff.getEquivalence());
- assertSame(Integer.valueOf(2), addFonCDiff.getEquivalence().getDifferences().size());
- assertTrue(addFonCDiff.getEquivalence().getDifferences().contains(addFonCDiff));
- assertTrue(addFonCDiff.getEquivalence().getDifferences().contains(addConFDiff));
-
- assertNotNull(delFonDDiff.getEquivalence());
- assertSame(Integer.valueOf(2), delFonDDiff.getEquivalence().getDifferences().size());
- assertTrue(delFonDDiff.getEquivalence().getDifferences().contains(delFonDDiff));
- assertTrue(delFonDDiff.getEquivalence().getDifferences().contains(delDonFDiff));
-
- assertNotNull(addFonEDiff.getEquivalence());
- assertSame(Integer.valueOf(2), addFonEDiff.getEquivalence().getDifferences().size());
- assertTrue(addFonEDiff.getEquivalence().getDifferences().contains(addFonEDiff));
- assertTrue(addFonEDiff.getEquivalence().getDifferences().contains(addEonFDiff));
-
- }
-
- @Test
- public void testE1UseCase() throws IOException {
- final Resource left = input.getE1Left();
- final Resource right = input.getE1Right();
- final Resource ancestor = input.getE1Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA1(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE2UseCase() throws IOException {
- final Resource left = input.getE2Left();
- final Resource right = input.getE2Right();
- final Resource ancestor = input.getE2Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA2(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE3UseCase() throws IOException {
- final Resource left = input.getE3Left();
- final Resource right = input.getE3Right();
- final Resource ancestor = input.getE3Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA3(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE4UseCase() throws IOException {
- final Resource left = input.getE4Left();
- final Resource right = input.getE4Right();
- final Resource ancestor = input.getE4Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA4(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE5UseCase() throws IOException {
- final Resource left = input.getE5Left();
- final Resource right = input.getE5Right();
- final Resource ancestor = input.getE5Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA5(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE6UseCase() throws IOException {
- final Resource left = input.getE6Left();
- final Resource right = input.getE6Right();
- final Resource ancestor = input.getE6Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC1(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE7UseCase() throws IOException {
- final Resource left = input.getE7Left();
- final Resource right = input.getE7Right();
- final Resource ancestor = input.getE7Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC2(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE8UseCase() throws IOException {
- final Resource left = input.getE8Left();
- final Resource right = input.getE8Right();
- final Resource ancestor = input.getE8Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC3(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE9UseCase() throws IOException {
- final Resource left = input.getE9Left();
- final Resource right = input.getE9Right();
- final Resource ancestor = input.getE9Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC4(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testE10UseCase() throws IOException {
- final Resource left = input.getE10Left();
- final Resource right = input.getE10Right();
- final Resource ancestor = input.getE10Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testD1(TestKind.LEFT, comparison);
- }
-
- @Test
- public void testF1UseCase() throws IOException {
- final Resource left = input.getF1Left();
- final Resource right = input.getF1Right();
- final Resource ancestor = input.getF1Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA1(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF2UseCase() throws IOException {
- final Resource left = input.getF2Left();
- final Resource right = input.getF2Right();
- final Resource ancestor = input.getF2Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA2(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF3UseCase() throws IOException {
- final Resource left = input.getF3Left();
- final Resource right = input.getF3Right();
- final Resource ancestor = input.getF3Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA3(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF4UseCase() throws IOException {
- final Resource left = input.getF4Left();
- final Resource right = input.getF4Right();
- final Resource ancestor = input.getF4Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA4(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF5UseCase() throws IOException {
- final Resource left = input.getF5Left();
- final Resource right = input.getF5Right();
- final Resource ancestor = input.getF5Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testA5(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF6UseCase() throws IOException {
- final Resource left = input.getF6Left();
- final Resource right = input.getF6Right();
- final Resource ancestor = input.getF6Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC1(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF7UseCase() throws IOException {
- final Resource left = input.getF7Left();
- final Resource right = input.getF7Right();
- final Resource ancestor = input.getF7Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC2(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF8UseCase() throws IOException {
- final Resource left = input.getF8Left();
- final Resource right = input.getF8Right();
- final Resource ancestor = input.getF8Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC3(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF9UseCase() throws IOException {
- final Resource left = input.getF9Left();
- final Resource right = input.getF9Right();
- final Resource ancestor = input.getF9Ancestor();
-
- Comparison comparison = compare(left, right, ancestor);
-
- testC4(TestKind.RIGHT, comparison);
- }
-
- @Test
- public void testF10UseCase() throws IOException {
- final Resource left = input.getF10Left();
- final Resource right = input.getF10Right();
- final Resource ancestor = input.getF10Ancestor();
-
- final Comparison comparison = compare(left, right, ancestor);
-
- testD1(TestKind.RIGHT, comparison);
- }
-
- private Comparison compare(Notifier left, Notifier right) {
- return compare(left, right, null);
- }
-
- private Comparison compare(Notifier left, Notifier right, Notifier ancestor) {
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- return EMFCompare.builder().build().compare(scope);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.equi;
+
+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 static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+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.notify.Notifier;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.equi.data.EquiInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings({"nls", "boxing" })
+public class EquiComputingTest {
+
+ enum TestKind {
+ LEFT, RIGHT;
+ }
+
+ private EquiInputData input = new EquiInputData();
+
+ @Test
+ public void testA1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+ final Comparison comparison = compare(left, right);
+ testA1(TestKind.LEFT, comparison);
+ }
+
+ private static void testA1(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 6 differences
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2BDiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ Predicate<? super Diff> changeRefC2DDiffDescription = null;
+ Predicate<? super Diff> changeRefD2CDiffDescription = null;
+ Predicate<? super Diff> changeRefE2FDiffDescription = null;
+ Predicate<? super Diff> changeRefF2EDiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", null,
+ "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ changeRefC2DDiffDescription = addedToReference("Requirements.C", "destination", "Requirements.D");
+ changeRefD2CDiffDescription = changedReference("Requirements.D", "source", null, "Requirements.C");
+ changeRefE2FDiffDescription = addedToReference("Requirements.E", "destination", "Requirements.F");
+ changeRefF2EDiffDescription = addedToReference("Requirements.F", "source", "Requirements.E");
+ } else {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ null);
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ changeRefC2DDiffDescription = removedFromReference("Requirements.C", "destination",
+ "Requirements.D");
+ changeRefD2CDiffDescription = changedReference("Requirements.D", "source", "Requirements.C", null);
+ changeRefE2FDiffDescription = removedFromReference("Requirements.E", "destination",
+ "Requirements.F");
+ changeRefF2EDiffDescription = removedFromReference("Requirements.F", "source", "Requirements.E");
+ }
+
+ final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+ final Diff changeRefC2DDiff = Iterators.find(differences.iterator(), changeRefC2DDiffDescription);
+ final Diff changeRefD2CDiff = Iterators.find(differences.iterator(), changeRefD2CDiffDescription);
+ final Diff changeRefE2FDiff = Iterators.find(differences.iterator(), changeRefE2FDiffDescription);
+ final Diff changeRefF2EDiff = Iterators.find(differences.iterator(), changeRefF2EDiffDescription);
+
+ assertNotNull(changeRefA2BDiff);
+ assertNotNull(changeRefB2ADiff);
+ assertNotNull(changeRefC2DDiff);
+ assertNotNull(changeRefD2CDiff);
+ assertNotNull(changeRefE2FDiff);
+ assertNotNull(changeRefF2EDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(3), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2BDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefA2BDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+
+ assertNotNull(changeRefC2DDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefC2DDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefC2DDiff));
+ assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefD2CDiff));
+
+ assertNotNull(changeRefE2FDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefE2FDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefE2FDiff));
+ assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefF2EDiff));
+ }
+
+ @Test
+ public void testA2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testA2(TestKind.LEFT, comparison);
+
+ }
+
+ private static void testA2(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 8 differences
+ assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefC2D1DiffDescription = null;
+ Predicate<? super Diff> changeRefC2D2DiffDescription = null;
+ Predicate<? super Diff> changeRefD12CDiffDescription = null;
+ Predicate<? super Diff> changeRefD22CDiffDescription = null;
+ Predicate<? super Diff> changeRefE2F1DiffDescription = null;
+ Predicate<? super Diff> changeRefE2F2DiffDescription = null;
+ Predicate<? super Diff> changeRefF12EDiffDescription = null;
+ Predicate<? super Diff> changeRefF22EDiffDescription = null;
+
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefC2D1DiffDescription = addedToReference("Requirements.C", "destination",
+ "Requirements.D1");
+ changeRefC2D2DiffDescription = addedToReference("Requirements.C", "destination",
+ "Requirements.D2");
+ changeRefD12CDiffDescription = changedReference("Requirements.D1", "source", null,
+ "Requirements.C");
+ changeRefD22CDiffDescription = changedReference("Requirements.D2", "source", null,
+ "Requirements.C");
+ changeRefE2F1DiffDescription = addedToReference("Requirements.E", "destination",
+ "Requirements.F1");
+ changeRefE2F2DiffDescription = addedToReference("Requirements.E", "destination",
+ "Requirements.F2");
+ changeRefF12EDiffDescription = addedToReference("Requirements.F1", "source", "Requirements.E");
+ changeRefF22EDiffDescription = addedToReference("Requirements.F2", "source", "Requirements.E");
+ } else {
+ changeRefC2D1DiffDescription = removedFromReference("Requirements.C", "destination",
+ "Requirements.D1");
+ changeRefC2D2DiffDescription = removedFromReference("Requirements.C", "destination",
+ "Requirements.D2");
+ changeRefD12CDiffDescription = changedReference("Requirements.D1", "source", "Requirements.C",
+ null);
+ changeRefD22CDiffDescription = changedReference("Requirements.D2", "source", "Requirements.C",
+ null);
+ changeRefE2F1DiffDescription = removedFromReference("Requirements.E", "destination",
+ "Requirements.F1");
+ changeRefE2F2DiffDescription = removedFromReference("Requirements.E", "destination",
+ "Requirements.F2");
+ changeRefF12EDiffDescription = removedFromReference("Requirements.F1", "source", "Requirements.E");
+ changeRefF22EDiffDescription = removedFromReference("Requirements.F2", "source", "Requirements.E");
+ }
+
+ final Diff changeRefC2D1Diff = Iterators.find(differences.iterator(), changeRefC2D1DiffDescription);
+ final Diff changeRefC2D2Diff = Iterators.find(differences.iterator(), changeRefC2D2DiffDescription);
+ final Diff changeRefD12CDiff = Iterators.find(differences.iterator(), changeRefD12CDiffDescription);
+ final Diff changeRefD22CDiff = Iterators.find(differences.iterator(), changeRefD22CDiffDescription);
+ final Diff changeRefE2F1Diff = Iterators.find(differences.iterator(), changeRefE2F1DiffDescription);
+ final Diff changeRefE2F2Diff = Iterators.find(differences.iterator(), changeRefE2F2DiffDescription);
+ final Diff changeRefF12EDiff = Iterators.find(differences.iterator(), changeRefF12EDiffDescription);
+ final Diff changeRefF22EDiff = Iterators.find(differences.iterator(), changeRefF22EDiffDescription);
+
+ assertNotNull(changeRefC2D1Diff);
+ assertNotNull(changeRefC2D2Diff);
+ assertNotNull(changeRefD12CDiff);
+ assertNotNull(changeRefD22CDiff);
+ assertNotNull(changeRefE2F1Diff);
+ assertNotNull(changeRefE2F2Diff);
+ assertNotNull(changeRefF12EDiff);
+ assertNotNull(changeRefF22EDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(4), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefC2D1Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefC2D1Diff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefC2D1Diff.getEquivalence().getDifferences().contains(changeRefC2D1Diff));
+ assertTrue(changeRefC2D1Diff.getEquivalence().getDifferences().contains(changeRefD12CDiff));
+
+ assertNotNull(changeRefC2D2Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefC2D2Diff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefC2D2Diff.getEquivalence().getDifferences().contains(changeRefC2D2Diff));
+ assertTrue(changeRefC2D2Diff.getEquivalence().getDifferences().contains(changeRefD22CDiff));
+
+ assertNotNull(changeRefE2F1Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefE2F1Diff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefE2F1Diff.getEquivalence().getDifferences().contains(changeRefE2F1Diff));
+ assertTrue(changeRefE2F1Diff.getEquivalence().getDifferences().contains(changeRefF12EDiff));
+
+ assertNotNull(changeRefE2F2Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefE2F2Diff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefE2F2Diff.getEquivalence().getDifferences().contains(changeRefE2F2Diff));
+ assertTrue(changeRefE2F2Diff.getEquivalence().getDifferences().contains(changeRefF22EDiff));
+ }
+
+ @Test
+ public void testA3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testA3(TestKind.LEFT, comparison);
+
+ }
+
+ private static void testA3(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 8 differences
+ assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> C1toD1DiffDescription = null;
+ Predicate<? super Diff> C1toD2DiffDescription = null;
+ Predicate<? super Diff> C2toD1DiffDescription = null;
+ Predicate<? super Diff> C2toD2DiffDescription = null;
+ Predicate<? super Diff> D1toC1DiffDescription = null;
+ Predicate<? super Diff> D1toC2DiffDescription = null;
+ Predicate<? super Diff> D2toC2DiffDescription = null;
+ Predicate<? super Diff> D2toC1DiffDescription = null;
+
+ if (kind.equals(TestKind.LEFT)) {
+ C1toD1DiffDescription = addedToReference("Requirements.C1", "destination", "Requirements.D1");
+ C1toD2DiffDescription = addedToReference("Requirements.C1", "destination", "Requirements.D2");
+ C2toD1DiffDescription = addedToReference("Requirements.C2", "destination", "Requirements.D1");
+ C2toD2DiffDescription = addedToReference("Requirements.C2", "source", "Requirements.D2");
+ D1toC1DiffDescription = addedToReference("Requirements.D1", "source", "Requirements.C1");
+ D1toC2DiffDescription = addedToReference("Requirements.D1", "source", "Requirements.C2");
+ D2toC2DiffDescription = addedToReference("Requirements.D2", "destination", "Requirements.C2");
+ D2toC1DiffDescription = addedToReference("Requirements.D2", "source", "Requirements.C1");
+ } else {
+ C1toD1DiffDescription = removedFromReference("Requirements.C1", "destination", "Requirements.D1");
+ C1toD2DiffDescription = removedFromReference("Requirements.C1", "destination", "Requirements.D2");
+ C2toD1DiffDescription = removedFromReference("Requirements.C2", "destination", "Requirements.D1");
+ C2toD2DiffDescription = removedFromReference("Requirements.C2", "source", "Requirements.D2");
+ D1toC1DiffDescription = removedFromReference("Requirements.D1", "source", "Requirements.C1");
+ D1toC2DiffDescription = removedFromReference("Requirements.D1", "source", "Requirements.C2");
+ D2toC2DiffDescription = removedFromReference("Requirements.D2", "destination", "Requirements.C2");
+ D2toC1DiffDescription = removedFromReference("Requirements.D2", "source", "Requirements.C1");
+ }
+
+ final Diff C1toD1Diff = Iterators.find(differences.iterator(), C1toD1DiffDescription);
+ final Diff C1toD2Diff = Iterators.find(differences.iterator(), C1toD2DiffDescription);
+ final Diff C2toD1Diff = Iterators.find(differences.iterator(), C2toD1DiffDescription);
+ final Diff C2toD2Diff = Iterators.find(differences.iterator(), C2toD2DiffDescription);
+ final Diff D1toC1Diff = Iterators.find(differences.iterator(), D1toC1DiffDescription);
+ final Diff D1toC2Diff = Iterators.find(differences.iterator(), D1toC2DiffDescription);
+ final Diff D2toC2Diff = Iterators.find(differences.iterator(), D2toC2DiffDescription);
+ final Diff D2toC1Diff = Iterators.find(differences.iterator(), D2toC1DiffDescription);
+
+ assertNotNull(C1toD1Diff);
+ assertNotNull(C1toD2Diff);
+ assertNotNull(C2toD1Diff);
+ assertNotNull(C2toD2Diff);
+ assertNotNull(D1toC1Diff);
+ assertNotNull(D1toC2Diff);
+ assertNotNull(D2toC2Diff);
+ assertNotNull(D2toC1Diff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(4), comparison.getEquivalences().size());
+
+ assertNotNull(C1toD1Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), C1toD1Diff.getEquivalence().getDifferences().size());
+ assertTrue(C1toD1Diff.getEquivalence().getDifferences().contains(C1toD1Diff));
+ assertTrue(C1toD1Diff.getEquivalence().getDifferences().contains(D1toC1Diff));
+
+ assertNotNull(C1toD2Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), C1toD2Diff.getEquivalence().getDifferences().size());
+ assertTrue(C1toD2Diff.getEquivalence().getDifferences().contains(C1toD2Diff));
+ assertTrue(C1toD2Diff.getEquivalence().getDifferences().contains(D2toC1Diff));
+
+ assertNotNull(C2toD1Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), C2toD1Diff.getEquivalence().getDifferences().size());
+ assertTrue(C2toD1Diff.getEquivalence().getDifferences().contains(C2toD1Diff));
+ assertTrue(C2toD1Diff.getEquivalence().getDifferences().contains(D1toC2Diff));
+
+ assertNotNull(C2toD2Diff.getEquivalence());
+ assertSame(Integer.valueOf(2), C2toD2Diff.getEquivalence().getDifferences().size());
+ assertTrue(C2toD2Diff.getEquivalence().getDifferences().contains(C2toD2Diff));
+ assertTrue(C2toD2Diff.getEquivalence().getDifferences().contains(D2toC2Diff));
+ }
+
+ @Test
+ public void testA4UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testA4(TestKind.LEFT, comparison);
+ }
+
+ private static void testA4(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 8 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> AtoBdestDiffDescription = null;
+ Predicate<? super Diff> AtoBsourceDiffDescription = null;
+ Predicate<? super Diff> BtoAdestDiffDescription = null;
+ Predicate<? super Diff> BtoAsourceDiffDescription = null;
+
+ if (kind.equals(TestKind.LEFT)) {
+ AtoBdestDiffDescription = addedToReference("Requirements.A", "destination", "Requirements.B");
+ AtoBsourceDiffDescription = addedToReference("Requirements.A", "source", "Requirements.B");
+ BtoAdestDiffDescription = addedToReference("Requirements.B", "destination", "Requirements.A");
+ BtoAsourceDiffDescription = addedToReference("Requirements.B", "source", "Requirements.A");
+ } else {
+ AtoBdestDiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.B");
+ AtoBsourceDiffDescription = removedFromReference("Requirements.A", "source", "Requirements.B");
+ BtoAdestDiffDescription = removedFromReference("Requirements.B", "destination", "Requirements.A");
+ BtoAsourceDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.A");
+ }
+
+ final Diff AtoBdestDiff = Iterators.find(differences.iterator(), AtoBdestDiffDescription);
+ final Diff AtoBsourceDiff = Iterators.find(differences.iterator(), AtoBsourceDiffDescription);
+ final Diff BtoAdestDiff = Iterators.find(differences.iterator(), BtoAdestDiffDescription);
+ final Diff BtoAsourceDiff = Iterators.find(differences.iterator(), BtoAsourceDiffDescription);
+
+ assertNotNull(AtoBdestDiff);
+ assertNotNull(AtoBsourceDiff);
+ assertNotNull(BtoAdestDiff);
+ assertNotNull(BtoAsourceDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(2), comparison.getEquivalences().size());
+
+ assertNotNull(AtoBdestDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), AtoBdestDiff.getEquivalence().getDifferences().size());
+ assertTrue(AtoBdestDiff.getEquivalence().getDifferences().contains(AtoBdestDiff));
+ assertTrue(AtoBdestDiff.getEquivalence().getDifferences().contains(BtoAsourceDiff));
+
+ assertNotNull(AtoBsourceDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), AtoBsourceDiff.getEquivalence().getDifferences().size());
+ assertTrue(AtoBsourceDiff.getEquivalence().getDifferences().contains(AtoBsourceDiff));
+ assertTrue(AtoBsourceDiff.getEquivalence().getDifferences().contains(BtoAdestDiff));
+ }
+
+ @Test
+ public void testA5UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testA5(TestKind.LEFT, comparison);
+ }
+
+ private static void testA5(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 12 differences
+ assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2BDiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ Predicate<? super Diff> changeRefC2DDiffDescription = null;
+ Predicate<? super Diff> changeRefD2CDiffDescription = null;
+ Predicate<? super Diff> changeRefE2FDiffDescription = null;
+ Predicate<? super Diff> changeRefF2EDiffDescription = null;
+ Predicate<? super Diff> addADiffDescription = null;
+ Predicate<? super Diff> addBDiffDescription = null;
+ Predicate<? super Diff> addCDiffDescription = null;
+ Predicate<? super Diff> addDDiffDescription = null;
+ Predicate<? super Diff> addEDiffDescription = null;
+ Predicate<? super Diff> addFDiffDescription = null;
+
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", null,
+ "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ changeRefC2DDiffDescription = addedToReference("Requirements.C", "destination", "Requirements.D");
+ changeRefD2CDiffDescription = changedReference("Requirements.D", "source", null, "Requirements.C");
+ changeRefE2FDiffDescription = addedToReference("Requirements.E", "destination", "Requirements.F");
+ changeRefF2EDiffDescription = addedToReference("Requirements.F", "source", "Requirements.E");
+
+ addADiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.A");
+ addBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
+ addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
+ addDDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.D");
+ addEDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.E");
+ addFDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.F");
+ } else {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ null);
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ changeRefC2DDiffDescription = removedFromReference("Requirements.C", "destination",
+ "Requirements.D");
+ changeRefD2CDiffDescription = changedReference("Requirements.D", "source", "Requirements.C", null);
+ changeRefE2FDiffDescription = removedFromReference("Requirements.E", "destination",
+ "Requirements.F");
+ changeRefF2EDiffDescription = removedFromReference("Requirements.F", "source", "Requirements.E");
+
+ addADiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.A");
+ addBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
+ addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
+ addDDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.D");
+ addEDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.E");
+ addFDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.F");
+ }
+
+ final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+ final Diff changeRefC2DDiff = Iterators.find(differences.iterator(), changeRefC2DDiffDescription);
+ final Diff changeRefD2CDiff = Iterators.find(differences.iterator(), changeRefD2CDiffDescription);
+ final Diff changeRefE2FDiff = Iterators.find(differences.iterator(), changeRefE2FDiffDescription);
+ final Diff changeRefF2EDiff = Iterators.find(differences.iterator(), changeRefF2EDiffDescription);
+
+ final Diff addADiff = Iterators.find(differences.iterator(), addADiffDescription);
+ final Diff addBDiff = Iterators.find(differences.iterator(), addBDiffDescription);
+ final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
+ final Diff addDDiff = Iterators.find(differences.iterator(), addDDiffDescription);
+ final Diff addEDiff = Iterators.find(differences.iterator(), addEDiffDescription);
+ final Diff addFDiff = Iterators.find(differences.iterator(), addFDiffDescription);
+
+ assertNotNull(changeRefA2BDiff);
+ assertNotNull(changeRefB2ADiff);
+ assertNotNull(changeRefC2DDiff);
+ assertNotNull(changeRefD2CDiff);
+ assertNotNull(changeRefE2FDiff);
+ assertNotNull(changeRefF2EDiff);
+
+ assertNotNull(addADiff);
+ assertNotNull(addBDiff);
+ assertNotNull(addCDiff);
+ assertNotNull(addDDiff);
+ assertNotNull(addEDiff);
+ assertNotNull(addFDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(3), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2BDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefA2BDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+
+ assertNotNull(changeRefC2DDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefC2DDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefC2DDiff));
+ assertTrue(changeRefC2DDiff.getEquivalence().getDifferences().contains(changeRefD2CDiff));
+
+ assertNotNull(changeRefE2FDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), changeRefE2FDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefE2FDiff));
+ assertTrue(changeRefE2FDiff.getEquivalence().getDifferences().contains(changeRefF2EDiff));
+ }
+
+ @Test
+ public void testB1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(right, left);
+
+ testA1(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testB2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ Comparison comparison = compare(right, left);
+
+ testA2(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testB3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(right, left);
+
+ testA3(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testB4UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ Comparison comparison = compare(right, left);
+
+ testA4(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testB5UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ Comparison comparison = compare(right, left);
+
+ testA5(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testC1UseCase() throws IOException {
+ final Resource left = input.getC1Left();
+ final Resource right = input.getC1Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testC1(TestKind.LEFT, comparison);
+ }
+
+ private static void testC1(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 3 differences
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2BDiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ Predicate<? super Diff> changeRefC2ADiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ "Requirements.C");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
+ } else {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
+ "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
+ }
+
+ final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+ final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
+
+ assertNotNull(changeRefA2BDiff);
+ assertNotNull(changeRefB2ADiff);
+ assertNotNull(changeRefC2ADiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2BDiff.getEquivalence());
+ assertSame(Integer.valueOf(3), changeRefA2BDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
+
+ }
+
+ @Test
+ public void testC2UseCase() throws IOException {
+ final Resource left = input.getC2Left();
+ final Resource right = input.getC2Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testC2(TestKind.LEFT, comparison);
+ }
+
+ private static void testC2(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2BDiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ Predicate<? super Diff> changeRefC2ADiffDescription = null;
+ Predicate<? super Diff> addCDiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ "Requirements.C");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
+ addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
+ } else {
+ changeRefA2BDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
+ "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
+ addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
+ }
+
+ final Diff changeRefA2BDiff = Iterators.find(differences.iterator(), changeRefA2BDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+ final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
+ final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
+
+ assertNotNull(changeRefA2BDiff);
+ assertNotNull(changeRefB2ADiff);
+ assertNotNull(changeRefC2ADiff);
+ assertNotNull(addCDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2BDiff.getEquivalence());
+ assertSame(Integer.valueOf(3), changeRefA2BDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefA2BDiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+ assertTrue(changeRefA2BDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
+
+ }
+
+ @Test
+ public void testC3UseCase() throws IOException {
+ final Resource left = input.getC3Left();
+ final Resource right = input.getC3Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testC3(TestKind.LEFT, comparison);
+ }
+
+ private static void testC3(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2CDiffDescription = null;
+ Predicate<? super Diff> deleteBDiffDescription = null;
+ Predicate<? super Diff> changeRefC2ADiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ "Requirements.C");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
+ deleteBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ } else {
+ changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
+ "Requirements.B");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
+ deleteBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ }
+
+ final Diff changeRefA2CDiff = Iterators.find(differences.iterator(), changeRefA2CDiffDescription);
+ final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
+ final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+
+ assertNotNull(changeRefA2CDiff);
+ assertNotNull(changeRefC2ADiff);
+ assertNotNull(deleteBDiff);
+ assertNotNull(changeRefB2ADiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2CDiff.getEquivalence());
+ assertSame(Integer.valueOf(3), changeRefA2CDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefA2CDiff));
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+
+ }
+
+ @Test
+ public void testC4UseCase() throws IOException {
+ final Resource left = input.getC4Left();
+ final Resource right = input.getC4Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testC4(TestKind.LEFT, comparison);
+ }
+
+ private static void testC4(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 5 differences
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeRefA2CDiffDescription = null;
+ Predicate<? super Diff> deleteBDiffDescription = null;
+ Predicate<? super Diff> changeRefC2ADiffDescription = null;
+ Predicate<? super Diff> changeRefB2ADiffDescription = null;
+ Predicate<? super Diff> addCDiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.B",
+ "Requirements.C");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", null, "Requirements.A");
+ deleteBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", "Requirements.A", null);
+ addCDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.C");
+ } else {
+ changeRefA2CDiffDescription = changedReference("Requirements.A", "destination", "Requirements.C",
+ "Requirements.B");
+ changeRefC2ADiffDescription = changedReference("Requirements.C", "source", "Requirements.A", null);
+ deleteBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
+ changeRefB2ADiffDescription = changedReference("Requirements.B", "source", null, "Requirements.A");
+ addCDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.C");
+ }
+
+ final Diff changeRefA2CDiff = Iterators.find(differences.iterator(), changeRefA2CDiffDescription);
+ final Diff changeRefC2ADiff = Iterators.find(differences.iterator(), changeRefC2ADiffDescription);
+ final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
+ final Diff changeRefB2ADiff = Iterators.find(differences.iterator(), changeRefB2ADiffDescription);
+ final Diff addCDiff = Iterators.find(differences.iterator(), addCDiffDescription);
+
+ assertNotNull(changeRefA2CDiff);
+ assertNotNull(changeRefC2ADiff);
+ assertNotNull(deleteBDiff);
+ assertNotNull(changeRefB2ADiff);
+ assertNotNull(addCDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), comparison.getEquivalences().size());
+
+ assertNotNull(changeRefA2CDiff.getEquivalence());
+ assertSame(Integer.valueOf(3), changeRefA2CDiff.getEquivalence().getDifferences().size());
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefA2CDiff));
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefC2ADiff));
+ assertTrue(changeRefA2CDiff.getEquivalence().getDifferences().contains(changeRefB2ADiff));
+
+ }
+
+ @Test
+ public void testD1UseCase() throws IOException {
+ final Resource left = input.getD1Left();
+ final Resource right = input.getD1Right();
+
+ final Comparison comparison = compare(left, right);
+
+ testD1(TestKind.LEFT, comparison);
+ }
+
+ private static void testD1(final TestKind kind, final Comparison comparison) {
+ List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 16 differences
+ assertSame(Integer.valueOf(16), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> delBonADiffDescription = null;
+ Predicate<? super Diff> delAonBDiffDescription = null;
+ Predicate<? super Diff> addDonADiffDescription = null;
+ Predicate<? super Diff> addEonADiffDescription = null;
+ Predicate<? super Diff> delFonBDiffDescription = null;
+ Predicate<? super Diff> addFonCDiffDescription = null;
+ Predicate<? super Diff> addAonDDiffDescription = null;
+ Predicate<? super Diff> delFonDDiffDescription = null;
+ Predicate<? super Diff> addAonEDiffDescription = null;
+ Predicate<? super Diff> addFonEDiffDescription = null;
+ Predicate<? super Diff> delDonFDiffDescription = null;
+ Predicate<? super Diff> delBonFDiffDescription = null;
+ Predicate<? super Diff> addEonFDiffDescription = null;
+ Predicate<? super Diff> addConFDiffDescription = null;
+ Predicate<? super Diff> delBDiffDescription = null;
+ Predicate<? super Diff> addEDiffDescription = null;
+ if (kind.equals(TestKind.LEFT)) {
+ delBonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.B");
+ delAonBDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.A");
+ addDonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.D");
+ addEonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.E");
+ delFonBDiffDescription = removedFromReference("Requirements.B", "source", "Requirements.F");
+ addFonCDiffDescription = addedToReference("Requirements.C", "source", "Requirements.F");
+ addAonDDiffDescription = addedToReference("Requirements.D", "source", "Requirements.A");
+ delFonDDiffDescription = removedFromReference("Requirements.D", "source", "Requirements.F");
+ addAonEDiffDescription = addedToReference("Requirements.E", "source", "Requirements.A");
+ addFonEDiffDescription = addedToReference("Requirements.E", "source", "Requirements.F");
+ delDonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.D");
+ delBonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.B");
+ addEonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.E");
+ addConFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.C");
+ delBDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.B");
+ addEDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.E");
+ } else {
+ delBonADiffDescription = addedToReference("Requirements.A", "destination", "Requirements.B");
+ delAonBDiffDescription = addedToReference("Requirements.B", "source", "Requirements.A");
+ addDonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.D");
+ addEonADiffDescription = removedFromReference("Requirements.A", "destination", "Requirements.E");
+ delFonBDiffDescription = addedToReference("Requirements.B", "source", "Requirements.F");
+ addFonCDiffDescription = removedFromReference("Requirements.C", "source", "Requirements.F");
+ addAonDDiffDescription = removedFromReference("Requirements.D", "source", "Requirements.A");
+ delFonDDiffDescription = addedToReference("Requirements.D", "source", "Requirements.F");
+ addAonEDiffDescription = removedFromReference("Requirements.E", "source", "Requirements.A");
+ addFonEDiffDescription = removedFromReference("Requirements.E", "source", "Requirements.F");
+ delDonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.D");
+ delBonFDiffDescription = addedToReference("Requirements.F", "destination", "Requirements.B");
+ addEonFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.E");
+ addConFDiffDescription = removedFromReference("Requirements.F", "destination", "Requirements.C");
+ delBDiffDescription = addedToReference("Requirements", "containmentRef1", "Requirements.B");
+ addEDiffDescription = removedFromReference("Requirements", "containmentRef1", "Requirements.E");
+ }
+
+ final Diff delBonADiff = Iterators.find(differences.iterator(), delBonADiffDescription);
+ final Diff delAonBDiff = Iterators.find(differences.iterator(), delAonBDiffDescription);
+ final Diff addDonADiff = Iterators.find(differences.iterator(), addDonADiffDescription);
+ final Diff addEonADiff = Iterators.find(differences.iterator(), addEonADiffDescription);
+ final Diff delFonBDiff = Iterators.find(differences.iterator(), delFonBDiffDescription);
+ final Diff addFonCDiff = Iterators.find(differences.iterator(), addFonCDiffDescription);
+ final Diff addAonDDiff = Iterators.find(differences.iterator(), addAonDDiffDescription);
+ final Diff delFonDDiff = Iterators.find(differences.iterator(), delFonDDiffDescription);
+ final Diff addAonEDiff = Iterators.find(differences.iterator(), addAonEDiffDescription);
+ final Diff addFonEDiff = Iterators.find(differences.iterator(), addFonEDiffDescription);
+ final Diff delDonFDiff = Iterators.find(differences.iterator(), delDonFDiffDescription);
+ final Diff delBonFDiff = Iterators.find(differences.iterator(), delBonFDiffDescription);
+ final Diff addEonFDiff = Iterators.find(differences.iterator(), addEonFDiffDescription);
+ final Diff addConFDiff = Iterators.find(differences.iterator(), addConFDiffDescription);
+ final Diff delBDiff = Iterators.find(differences.iterator(), delBDiffDescription);
+ final Diff addEDiff = Iterators.find(differences.iterator(), addEDiffDescription);
+
+ assertNotNull(delBonADiff);
+ assertNotNull(delAonBDiff);
+ assertNotNull(addDonADiff);
+ assertNotNull(addEonADiff);
+ assertNotNull(delFonBDiff);
+ assertNotNull(addFonCDiff);
+ assertNotNull(addAonDDiff);
+ assertNotNull(delFonDDiff);
+ assertNotNull(addAonEDiff);
+ assertNotNull(addFonEDiff);
+ assertNotNull(delDonFDiff);
+ assertNotNull(delBonFDiff);
+ assertNotNull(addEonFDiff);
+ assertNotNull(addConFDiff);
+ assertNotNull(delBDiff);
+ assertNotNull(addEDiff);
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(7), comparison.getEquivalences().size());
+
+ assertNotNull(delBonADiff.getEquivalence());
+ assertSame(Integer.valueOf(2), delBonADiff.getEquivalence().getDifferences().size());
+ assertTrue(delBonADiff.getEquivalence().getDifferences().contains(delBonADiff));
+ assertTrue(delBonADiff.getEquivalence().getDifferences().contains(delAonBDiff));
+
+ assertNotNull(addDonADiff.getEquivalence());
+ assertSame(Integer.valueOf(2), addDonADiff.getEquivalence().getDifferences().size());
+ assertTrue(addDonADiff.getEquivalence().getDifferences().contains(addDonADiff));
+ assertTrue(addDonADiff.getEquivalence().getDifferences().contains(addAonDDiff));
+
+ assertNotNull(addEonADiff.getEquivalence());
+ assertSame(Integer.valueOf(2), addEonADiff.getEquivalence().getDifferences().size());
+ assertTrue(addEonADiff.getEquivalence().getDifferences().contains(addEonADiff));
+ assertTrue(addEonADiff.getEquivalence().getDifferences().contains(addAonEDiff));
+
+ assertNotNull(delFonBDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), delFonBDiff.getEquivalence().getDifferences().size());
+ assertTrue(delFonBDiff.getEquivalence().getDifferences().contains(delFonBDiff));
+ assertTrue(delFonBDiff.getEquivalence().getDifferences().contains(delBonFDiff));
+
+ assertNotNull(addFonCDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), addFonCDiff.getEquivalence().getDifferences().size());
+ assertTrue(addFonCDiff.getEquivalence().getDifferences().contains(addFonCDiff));
+ assertTrue(addFonCDiff.getEquivalence().getDifferences().contains(addConFDiff));
+
+ assertNotNull(delFonDDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), delFonDDiff.getEquivalence().getDifferences().size());
+ assertTrue(delFonDDiff.getEquivalence().getDifferences().contains(delFonDDiff));
+ assertTrue(delFonDDiff.getEquivalence().getDifferences().contains(delDonFDiff));
+
+ assertNotNull(addFonEDiff.getEquivalence());
+ assertSame(Integer.valueOf(2), addFonEDiff.getEquivalence().getDifferences().size());
+ assertTrue(addFonEDiff.getEquivalence().getDifferences().contains(addFonEDiff));
+ assertTrue(addFonEDiff.getEquivalence().getDifferences().contains(addEonFDiff));
+
+ }
+
+ @Test
+ public void testE1UseCase() throws IOException {
+ final Resource left = input.getE1Left();
+ final Resource right = input.getE1Right();
+ final Resource ancestor = input.getE1Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA1(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE2UseCase() throws IOException {
+ final Resource left = input.getE2Left();
+ final Resource right = input.getE2Right();
+ final Resource ancestor = input.getE2Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA2(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE3UseCase() throws IOException {
+ final Resource left = input.getE3Left();
+ final Resource right = input.getE3Right();
+ final Resource ancestor = input.getE3Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA3(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE4UseCase() throws IOException {
+ final Resource left = input.getE4Left();
+ final Resource right = input.getE4Right();
+ final Resource ancestor = input.getE4Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA4(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE5UseCase() throws IOException {
+ final Resource left = input.getE5Left();
+ final Resource right = input.getE5Right();
+ final Resource ancestor = input.getE5Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA5(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE6UseCase() throws IOException {
+ final Resource left = input.getE6Left();
+ final Resource right = input.getE6Right();
+ final Resource ancestor = input.getE6Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC1(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE7UseCase() throws IOException {
+ final Resource left = input.getE7Left();
+ final Resource right = input.getE7Right();
+ final Resource ancestor = input.getE7Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC2(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE8UseCase() throws IOException {
+ final Resource left = input.getE8Left();
+ final Resource right = input.getE8Right();
+ final Resource ancestor = input.getE8Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC3(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE9UseCase() throws IOException {
+ final Resource left = input.getE9Left();
+ final Resource right = input.getE9Right();
+ final Resource ancestor = input.getE9Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC4(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testE10UseCase() throws IOException {
+ final Resource left = input.getE10Left();
+ final Resource right = input.getE10Right();
+ final Resource ancestor = input.getE10Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testD1(TestKind.LEFT, comparison);
+ }
+
+ @Test
+ public void testF1UseCase() throws IOException {
+ final Resource left = input.getF1Left();
+ final Resource right = input.getF1Right();
+ final Resource ancestor = input.getF1Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA1(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF2UseCase() throws IOException {
+ final Resource left = input.getF2Left();
+ final Resource right = input.getF2Right();
+ final Resource ancestor = input.getF2Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA2(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF3UseCase() throws IOException {
+ final Resource left = input.getF3Left();
+ final Resource right = input.getF3Right();
+ final Resource ancestor = input.getF3Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA3(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF4UseCase() throws IOException {
+ final Resource left = input.getF4Left();
+ final Resource right = input.getF4Right();
+ final Resource ancestor = input.getF4Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA4(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF5UseCase() throws IOException {
+ final Resource left = input.getF5Left();
+ final Resource right = input.getF5Right();
+ final Resource ancestor = input.getF5Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testA5(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF6UseCase() throws IOException {
+ final Resource left = input.getF6Left();
+ final Resource right = input.getF6Right();
+ final Resource ancestor = input.getF6Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC1(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF7UseCase() throws IOException {
+ final Resource left = input.getF7Left();
+ final Resource right = input.getF7Right();
+ final Resource ancestor = input.getF7Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC2(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF8UseCase() throws IOException {
+ final Resource left = input.getF8Left();
+ final Resource right = input.getF8Right();
+ final Resource ancestor = input.getF8Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC3(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF9UseCase() throws IOException {
+ final Resource left = input.getF9Left();
+ final Resource right = input.getF9Right();
+ final Resource ancestor = input.getF9Ancestor();
+
+ Comparison comparison = compare(left, right, ancestor);
+
+ testC4(TestKind.RIGHT, comparison);
+ }
+
+ @Test
+ public void testF10UseCase() throws IOException {
+ final Resource left = input.getF10Left();
+ final Resource right = input.getF10Right();
+ final Resource ancestor = input.getF10Ancestor();
+
+ final Comparison comparison = compare(left, right, ancestor);
+
+ testD1(TestKind.RIGHT, comparison);
+ }
+
+ private Comparison compare(Notifier left, Notifier right) {
+ return compare(left, right, null);
+ }
+
+ private Comparison compare(Notifier left, Notifier right, Notifier ancestor) {
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ return EMFCompare.builder().build().compare(scope);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/data/EquiInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/data/EquiInputData.java
index 2cf4542b6..5d8eb539a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/data/EquiInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/equi/data/EquiInputData.java
@@ -1,338 +1,338 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.equi.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class EquiInputData extends AbstractInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA2Left() throws IOException {
- return loadFromClassLoader("a2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA2Right() throws IOException {
- return loadFromClassLoader("a2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA3Left() throws IOException {
- return loadFromClassLoader("a3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA3Right() throws IOException {
- return loadFromClassLoader("a3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA4Left() throws IOException {
- return loadFromClassLoader("a4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA4Right() throws IOException {
- return loadFromClassLoader("a4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA5Left() throws IOException {
- return loadFromClassLoader("a5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA5Right() throws IOException {
- return loadFromClassLoader("a5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC1Left() throws IOException {
- return loadFromClassLoader("c1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC1Right() throws IOException {
- return loadFromClassLoader("c1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC2Left() throws IOException {
- return loadFromClassLoader("c2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC2Right() throws IOException {
- return loadFromClassLoader("c2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC3Left() throws IOException {
- return loadFromClassLoader("c3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC3Right() throws IOException {
- return loadFromClassLoader("c3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC4Left() throws IOException {
- return loadFromClassLoader("c4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC4Right() throws IOException {
- return loadFromClassLoader("c4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getD1Left() throws IOException {
- return loadFromClassLoader("d1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getD1Right() throws IOException {
- return loadFromClassLoader("d1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Left() throws IOException {
- return loadFromClassLoader("e1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Right() throws IOException {
- return loadFromClassLoader("e1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Ancestor() throws IOException {
- return loadFromClassLoader("e1/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Left() throws IOException {
- return loadFromClassLoader("e2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Right() throws IOException {
- return loadFromClassLoader("e2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Ancestor() throws IOException {
- return loadFromClassLoader("e2/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Left() throws IOException {
- return loadFromClassLoader("e3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Right() throws IOException {
- return loadFromClassLoader("e3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Ancestor() throws IOException {
- return loadFromClassLoader("e3/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Left() throws IOException {
- return loadFromClassLoader("e4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Right() throws IOException {
- return loadFromClassLoader("e4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Ancestor() throws IOException {
- return loadFromClassLoader("e4/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Left() throws IOException {
- return loadFromClassLoader("e5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Right() throws IOException {
- return loadFromClassLoader("e5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Ancestor() throws IOException {
- return loadFromClassLoader("e5/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Left() throws IOException {
- return loadFromClassLoader("e6/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Right() throws IOException {
- return loadFromClassLoader("e6/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Ancestor() throws IOException {
- return loadFromClassLoader("e6/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Left() throws IOException {
- return loadFromClassLoader("e7/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Right() throws IOException {
- return loadFromClassLoader("e7/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Ancestor() throws IOException {
- return loadFromClassLoader("e7/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Left() throws IOException {
- return loadFromClassLoader("e8/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Right() throws IOException {
- return loadFromClassLoader("e8/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Ancestor() throws IOException {
- return loadFromClassLoader("e8/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Left() throws IOException {
- return loadFromClassLoader("e9/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Right() throws IOException {
- return loadFromClassLoader("e9/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Ancestor() throws IOException {
- return loadFromClassLoader("e9/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Left() throws IOException {
- return loadFromClassLoader("e10/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Right() throws IOException {
- return loadFromClassLoader("e10/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Ancestor() throws IOException {
- return loadFromClassLoader("e10/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Left() throws IOException {
- return loadFromClassLoader("f1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Right() throws IOException {
- return loadFromClassLoader("f1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Ancestor() throws IOException {
- return loadFromClassLoader("f1/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Left() throws IOException {
- return loadFromClassLoader("f2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Right() throws IOException {
- return loadFromClassLoader("f2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Ancestor() throws IOException {
- return loadFromClassLoader("f2/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Left() throws IOException {
- return loadFromClassLoader("f3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Right() throws IOException {
- return loadFromClassLoader("f3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Ancestor() throws IOException {
- return loadFromClassLoader("f3/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Left() throws IOException {
- return loadFromClassLoader("f4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Right() throws IOException {
- return loadFromClassLoader("f4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Ancestor() throws IOException {
- return loadFromClassLoader("f4/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Left() throws IOException {
- return loadFromClassLoader("f5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Right() throws IOException {
- return loadFromClassLoader("f5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Ancestor() throws IOException {
- return loadFromClassLoader("f5/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Left() throws IOException {
- return loadFromClassLoader("f6/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Right() throws IOException {
- return loadFromClassLoader("f6/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Ancestor() throws IOException {
- return loadFromClassLoader("f6/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Left() throws IOException {
- return loadFromClassLoader("f7/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Right() throws IOException {
- return loadFromClassLoader("f7/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Ancestor() throws IOException {
- return loadFromClassLoader("f7/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Left() throws IOException {
- return loadFromClassLoader("f8/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Right() throws IOException {
- return loadFromClassLoader("f8/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Ancestor() throws IOException {
- return loadFromClassLoader("f8/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Left() throws IOException {
- return loadFromClassLoader("f9/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Right() throws IOException {
- return loadFromClassLoader("f9/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Ancestor() throws IOException {
- return loadFromClassLoader("f9/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Left() throws IOException {
- return loadFromClassLoader("f10/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Right() throws IOException {
- return loadFromClassLoader("f10/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Ancestor() throws IOException {
- return loadFromClassLoader("f10/ancestor.nodes"); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.equi.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class EquiInputData extends AbstractInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Left() throws IOException {
+ return loadFromClassLoader("a3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Right() throws IOException {
+ return loadFromClassLoader("a3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Left() throws IOException {
+ return loadFromClassLoader("a4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Right() throws IOException {
+ return loadFromClassLoader("a4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Left() throws IOException {
+ return loadFromClassLoader("a5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Right() throws IOException {
+ return loadFromClassLoader("a5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC1Left() throws IOException {
+ return loadFromClassLoader("c1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC1Right() throws IOException {
+ return loadFromClassLoader("c1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC2Left() throws IOException {
+ return loadFromClassLoader("c2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC2Right() throws IOException {
+ return loadFromClassLoader("c2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC3Left() throws IOException {
+ return loadFromClassLoader("c3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC3Right() throws IOException {
+ return loadFromClassLoader("c3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC4Left() throws IOException {
+ return loadFromClassLoader("c4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC4Right() throws IOException {
+ return loadFromClassLoader("c4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getD1Left() throws IOException {
+ return loadFromClassLoader("d1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getD1Right() throws IOException {
+ return loadFromClassLoader("d1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Left() throws IOException {
+ return loadFromClassLoader("e1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Right() throws IOException {
+ return loadFromClassLoader("e1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Ancestor() throws IOException {
+ return loadFromClassLoader("e1/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Left() throws IOException {
+ return loadFromClassLoader("e2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Right() throws IOException {
+ return loadFromClassLoader("e2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Ancestor() throws IOException {
+ return loadFromClassLoader("e2/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Left() throws IOException {
+ return loadFromClassLoader("e3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Right() throws IOException {
+ return loadFromClassLoader("e3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Ancestor() throws IOException {
+ return loadFromClassLoader("e3/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Left() throws IOException {
+ return loadFromClassLoader("e4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Right() throws IOException {
+ return loadFromClassLoader("e4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Ancestor() throws IOException {
+ return loadFromClassLoader("e4/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Left() throws IOException {
+ return loadFromClassLoader("e5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Right() throws IOException {
+ return loadFromClassLoader("e5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Ancestor() throws IOException {
+ return loadFromClassLoader("e5/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Left() throws IOException {
+ return loadFromClassLoader("e6/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Right() throws IOException {
+ return loadFromClassLoader("e6/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Ancestor() throws IOException {
+ return loadFromClassLoader("e6/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Left() throws IOException {
+ return loadFromClassLoader("e7/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Right() throws IOException {
+ return loadFromClassLoader("e7/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Ancestor() throws IOException {
+ return loadFromClassLoader("e7/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Left() throws IOException {
+ return loadFromClassLoader("e8/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Right() throws IOException {
+ return loadFromClassLoader("e8/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Ancestor() throws IOException {
+ return loadFromClassLoader("e8/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Left() throws IOException {
+ return loadFromClassLoader("e9/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Right() throws IOException {
+ return loadFromClassLoader("e9/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Ancestor() throws IOException {
+ return loadFromClassLoader("e9/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Left() throws IOException {
+ return loadFromClassLoader("e10/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Right() throws IOException {
+ return loadFromClassLoader("e10/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Ancestor() throws IOException {
+ return loadFromClassLoader("e10/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Left() throws IOException {
+ return loadFromClassLoader("f1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Right() throws IOException {
+ return loadFromClassLoader("f1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Ancestor() throws IOException {
+ return loadFromClassLoader("f1/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Left() throws IOException {
+ return loadFromClassLoader("f2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Right() throws IOException {
+ return loadFromClassLoader("f2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Ancestor() throws IOException {
+ return loadFromClassLoader("f2/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Left() throws IOException {
+ return loadFromClassLoader("f3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Right() throws IOException {
+ return loadFromClassLoader("f3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Ancestor() throws IOException {
+ return loadFromClassLoader("f3/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Left() throws IOException {
+ return loadFromClassLoader("f4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Right() throws IOException {
+ return loadFromClassLoader("f4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Ancestor() throws IOException {
+ return loadFromClassLoader("f4/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Left() throws IOException {
+ return loadFromClassLoader("f5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Right() throws IOException {
+ return loadFromClassLoader("f5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Ancestor() throws IOException {
+ return loadFromClassLoader("f5/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Left() throws IOException {
+ return loadFromClassLoader("f6/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Right() throws IOException {
+ return loadFromClassLoader("f6/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Ancestor() throws IOException {
+ return loadFromClassLoader("f6/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Left() throws IOException {
+ return loadFromClassLoader("f7/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Right() throws IOException {
+ return loadFromClassLoader("f7/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Ancestor() throws IOException {
+ return loadFromClassLoader("f7/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Left() throws IOException {
+ return loadFromClassLoader("f8/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Right() throws IOException {
+ return loadFromClassLoader("f8/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Ancestor() throws IOException {
+ return loadFromClassLoader("f8/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Left() throws IOException {
+ return loadFromClassLoader("f9/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Right() throws IOException {
+ return loadFromClassLoader("f9/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Ancestor() throws IOException {
+ return loadFromClassLoader("f9/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Left() throws IOException {
+ return loadFromClassLoader("f10/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Right() throws IOException {
+ return loadFromClassLoader("f10/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Ancestor() throws IOException {
+ return loadFromClassLoader("f10/ancestor.nodes"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/FragmentationTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/FragmentationTest.java
index b1d9152f3..cb7b7d1e4 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/FragmentationTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/FragmentationTest.java
@@ -1,1265 +1,1265 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fragmentation;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.ConflictKind;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.ResourceAttachmentChange;
-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.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.fragmentation.data.FragmentationInputData;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class FragmentationTest {
- private final FragmentationInputData input = new FragmentationInputData();
-
- private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
-
- @Test
- public void testUncontroledObjectResourceSet() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- assertNotNull(leftSet);
- assertNotNull(originSet);
- assertNotNull(rightSet);
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
- assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
- assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testUncontroledObjectResourceSet does.
- @Test
- public void testMergeUncontroledObjectResourceSetLtR() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
- // Still two resources, though one is empty
- assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
-
- for (Resource resource : rightSet.getResources()) {
- if (resource != right) {
- assertTrue(resource.getContents().isEmpty());
- }
- }
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() != originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict resource change) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testUncontroledObjectResourceSet does.
- // TODO will fail until bug 406101 is fixed
- @Ignore
- @Test
- public void testMergeUncontroledObjectResourceSetRtL() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() != originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertTrue(lrCompare.getDifferences().isEmpty());
-
- // And since we've undone the resource change, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testUncontroledObjectResource() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- // At the resource level, we cannot match an object with the 'proxy' root.
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- // There's one addition, and one deletion (the proxy root)
- final Diff addition;
- final Diff deletion;
- if (differences.get(0).getKind() == DifferenceKind.ADD) {
- addition = differences.get(0);
- deletion = differences.get(1);
- } else {
- deletion = differences.get(0);
- addition = differences.get(1);
- }
- assertTrue(addition instanceof ReferenceChange);
- assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertEquals(((ReferenceChange)addition).getValue(), getNodeNamed(left, "fragmented"));
- assertSame(addition.getSource(), DifferenceSource.LEFT);
- assertSame(addition.getKind(), DifferenceKind.ADD);
-
- assertTrue(deletion instanceof ReferenceChange);
- assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertTrue(((ReferenceChange)deletion).getValue().eIsProxy());
- assertSame(deletion.getSource(), DifferenceSource.LEFT);
- assertSame(deletion.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testUncontroledObjectResource does.
- @Test
- public void testMergeUncontroledObjectResourceLtR() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllLeftToRight(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertNull(originFragmentedNode);
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0) == leftFragmentedNode);
- assertTrue(originRootContent.get(0).eIsProxy());
- assertTrue(rightRootContent.get(0) == rightFragmentedNode);
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be four diffs (conflicting 2-by-2) when compared with origin :
- // two deletions (the proxies) and two additions (the previously fragmented root)
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
- }
-
- // This only tests the merge. Will fail if testUncontroledObjectResource does.
- @Test
- public void testMergeUncontroledObjectResourceRtL() throws IOException {
- final Resource left = input.getUncontrolLeft();
- final Resource origin = input.getUncontrolOrigin();
- final Resource right = input.getUncontrolRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllRightToLeft(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertNull(leftFragmentedNode);
- assertNull(originFragmentedNode);
- assertNull(rightFragmentedNode);
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0).eIsProxy());
- assertTrue(originRootContent.get(0).eIsProxy());
- assertTrue(rightRootContent.get(0).eIsProxy());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // And since we've undone the changes, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testControledObjectResourceSet() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- assertNotNull(leftSet);
- assertNotNull(originSet);
- assertNotNull(rightSet);
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
- assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
- assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.ADD);
- }
-
- // This only tests the merge. Will fail if testControledObjectResourceSet does.
- // TODO will fail until bug 406101 is fixed
- @Ignore
- @Test
- public void testMergeControledObjectResourceSetLtR() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict resource change) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testControledObjectResourceSet does.
- @Test
- public void testMergeControledObjectResourceSetRtL() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // Note : we still have 2 resources there, though one is empty
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- for (Resource res : leftSet.getResources()) {
- if (res != left) {
- assertTrue(res.getContents().isEmpty());
- }
- }
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertTrue(lrCompare.getDifferences().isEmpty());
-
- // And since we've undone the resource change, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testControledObjectResource() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- // At the resource level, we cannot match an object with the 'proxy' root.
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- // There's one deletion, and one addition (the proxy root)
- final Diff addition;
- final Diff deletion;
- if (differences.get(0).getKind() == DifferenceKind.ADD) {
- addition = differences.get(0);
- deletion = differences.get(1);
- } else {
- deletion = differences.get(0);
- addition = differences.get(1);
- }
- assertTrue(addition instanceof ReferenceChange);
- assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertTrue(((ReferenceChange)addition).getValue().eIsProxy());
- assertSame(addition.getSource(), DifferenceSource.LEFT);
- assertSame(addition.getKind(), DifferenceKind.ADD);
-
- assertTrue(deletion instanceof ReferenceChange);
- assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertEquals(((ReferenceChange)deletion).getValue(), getNodeNamed(origin, "fragmented"));
- assertSame(deletion.getSource(), DifferenceSource.LEFT);
- assertSame(deletion.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testControledObjectResource does.
- @Test
- public void testMergeControledObjectResourceLtR() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllLeftToRight(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertNull(leftFragmentedNode);
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertNull(rightFragmentedNode);
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0).eIsProxy());
- assertTrue(originRootContent.get(0) == originFragmentedNode);
- assertTrue(rightRootContent.get(0).eIsProxy());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be four diffs (conflicting 2-by-2) when compared with origin :
- // two additions (the proxies) and two deletions (the old root)
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
- }
-
- // This only tests the merge. Will fail if testControledObjectResource does.
- @Test
- public void testMergeControledObjectResourceRtL() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOrigin();
- final Resource right = input.getControlRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllRightToLeft(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0) == leftFragmentedNode);
- assertTrue(originRootContent.get(0) == originFragmentedNode);
- assertTrue(rightRootContent.get(0) == rightFragmentedNode);
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // And since we've undone the changes, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testControledObjectFolderResourceSet() throws IOException {
- final Resource left = input.getControlLeftFolder();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- assertNotNull(leftSet);
- assertNotNull(originSet);
- assertNotNull(rightSet);
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
- assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
- assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.ADD);
- }
-
- // This only tests the merge. Will fail if testControledObjectFolderResourceSet does.
- @Test
- public void testMergeControledObjectFolderResourceSetLtR() throws IOException {
- final Resource left = input.getControlLeftFolder();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict resource change) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testControledObjectFolderResourceSet does.
- @Test
- public void testMergeControledObjectFolderResourceSetRtL() throws IOException {
- final Resource left = input.getControlLeftFolder();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // Note : we still have 2 resources there, though one is empty
- assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- for (Resource res : leftSet.getResources()) {
- if (res != left) {
- assertTrue(res.getContents().isEmpty());
- }
- }
-
- final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertTrue(lrCompare.getDifferences().isEmpty());
-
- // And since we've undone the resource change, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testControledObjectFolderResource() throws IOException {
- final Resource left = input.getControlLeft();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- // At the resource level, we cannot match an object with the 'proxy' root.
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- // There's one deletion, and one addition (the proxy root)
- final Diff addition;
- final Diff deletion;
- if (differences.get(0).getKind() == DifferenceKind.ADD) {
- addition = differences.get(0);
- deletion = differences.get(1);
- } else {
- deletion = differences.get(0);
- addition = differences.get(1);
- }
- assertTrue(addition instanceof ReferenceChange);
- assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertTrue(((ReferenceChange)addition).getValue().eIsProxy());
- assertSame(addition.getSource(), DifferenceSource.LEFT);
- assertSame(addition.getKind(), DifferenceKind.ADD);
-
- assertTrue(deletion instanceof ReferenceChange);
- assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
- assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
- assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
- assertEquals(((ReferenceChange)deletion).getValue(), getNodeNamed(origin, "fragmented"));
- assertSame(deletion.getSource(), DifferenceSource.LEFT);
- assertSame(deletion.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testControledObjectFolderResource does.
- @Test
- public void testMergeControledObjectFolderResourceLtR() throws IOException {
- final Resource left = input.getControlLeftFolder();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllLeftToRight(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertNull(leftFragmentedNode);
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertNull(rightFragmentedNode);
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0).eIsProxy());
- assertTrue(originRootContent.get(0) == originFragmentedNode);
- assertTrue(rightRootContent.get(0).eIsProxy());
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be four diffs (conflicting 2-by-2) when compared with origin :
- // two additions (the proxies) and two deletions (the old root)
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
- }
-
- // This only tests the merge. Will fail if testControledObjectFolderResource does.
- @Test
- public void testMergeControledObjectFolderResourceRtL() throws IOException {
- final Resource left = input.getControlLeftFolder();
- final Resource origin = input.getControlOriginFolder();
- final Resource right = input.getControlRightFolder();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllRightToLeft(differences, new BasicMonitor());
-
- final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
- final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
- final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
-
- assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
- assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
- assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
-
- final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
- .basicList();
- final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
- .eContents()).basicList();
- final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
- .eContents()).basicList();
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
-
- assertTrue(leftRootContent.get(0) == leftFragmentedNode);
- assertTrue(originRootContent.get(0) == originFragmentedNode);
- assertTrue(rightRootContent.get(0) == rightFragmentedNode);
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // And since we've undone the changes, there are no diffs with origin either
- comparison = EMFCompare.builder().build().compare(scope);
- assertTrue(comparison.getDifferences().isEmpty());
- }
-
- @Test
- public void testDeletedRootResourceSet() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- assertNotNull(leftSet);
- assertNotNull(originSet);
- assertNotNull(rightSet);
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getRight(), getNodeNamed(right, "deletedRoot"));
- assertEquals(diff.getMatch().getOrigin(), getNodeNamed(origin, "deletedRoot"));
- assertNull(diff.getMatch().getLeft());
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testDeletedRootResourceSet does.
- @Test
- public void testMergeDeletedRootResourceSetLtR() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict deletion) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testDeletedRootResourceSet does.
- @Test
- public void testMergeDeletedRootResourceSetRtL() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testDeletedRootResource() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getRight(), getNodeNamed(right, "deletedRoot"));
- assertEquals(diff.getMatch().getOrigin(), getNodeNamed(origin, "deletedRoot"));
- assertNull(diff.getMatch().getLeft());
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.DELETE);
- }
-
- // This only tests the merge. Will fail if testDeletedRootResource does.
- @Test
- public void testMergeDeletedRootResourceLtR() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict deletion) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testDeletedRootResource does.
- @Test
- public void testMergeDeletedRootResourceRtL() throws IOException {
- final Resource left = input.getDeletedRootLeft();
- final Resource origin = input.getDeletedRootOrigin();
- final Resource right = input.getDeletedRootRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testNewRootResourceSet() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- assertNotNull(leftSet);
- assertNotNull(originSet);
- assertNotNull(rightSet);
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getLeft(), getNodeNamed(left, "newRoot"));
- assertNull(diff.getMatch().getOrigin());
- assertNull(diff.getMatch().getRight());
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.ADD);
- }
-
- // This only tests the merge. Will fail if testNewRootResourceSet does.
- @Test
- public void testMergeNewRootResourceSetLtR() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(leftSet, rightSet, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict addition) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testNewRootResourceSet does.
- @Test
- public void testMergeNewRootResourceSetRtL() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- final ResourceSet leftSet = left.getResourceSet();
- final ResourceSet originSet = origin.getResourceSet();
- final ResourceSet rightSet = right.getResourceSet();
-
- EcoreUtil.resolveAll(leftSet);
- EcoreUtil.resolveAll(originSet);
- EcoreUtil.resolveAll(rightSet);
-
- final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testNewRootResource() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final Diff diff = differences.get(0);
- assertTrue(diff instanceof ResourceAttachmentChange);
- assertEquals(diff.getMatch().getLeft(), getNodeNamed(left, "newRoot"));
- assertNull(diff.getMatch().getOrigin());
- assertNull(diff.getMatch().getRight());
- assertSame(diff.getSource(), DifferenceSource.LEFT);
- assertSame(diff.getKind(), DifferenceKind.ADD);
- }
-
- // This only tests the merge. Will fail if testNewRootResource does.
- @Test
- public void testMergeNewRootResourceLtR() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
-
- // there should be no diff between left and right
- final Comparison lrCompare = EMFCompare.builder().build().compare(
- new DefaultComparisonScope(left, right, null));
- assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
-
- // but there should be two diffs (a pseudo conflict addition) when compared with origin
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
- assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
- }
-
- // This only tests the merge. Will fail if testNewRootResource does.
- @Test
- public void testMergeNewRootResourceRtL() throws IOException {
- final Resource left = input.getNewRootLeft();
- final Resource origin = input.getNewRootOrigin();
- final Resource right = input.getNewRootRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- final Diff diff = differences.get(0);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- private EObject getNodeNamed(Notifier notifier, String name) {
- final Iterator<EObject> iterator;
- if (notifier instanceof ResourceSet) {
- iterator = Iterators.filter(EcoreUtil.getAllProperContents((ResourceSet)notifier, false),
- EObject.class);
- } else if (notifier instanceof Resource) {
- iterator = EcoreUtil.getAllProperContents((Resource)notifier, false);
- } else {
- iterator = EcoreUtil.getAllProperContents((EObject)notifier, false);
- }
- while (iterator.hasNext()) {
- final EObject next = iterator.next();
- final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
- if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
- return next;
- }
- }
- return null;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fragmentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.ResourceAttachmentChange;
+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.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.fragmentation.data.FragmentationInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class FragmentationTest {
+ private final FragmentationInputData input = new FragmentationInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testUncontroledObjectResourceSet() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ assertNotNull(leftSet);
+ assertNotNull(originSet);
+ assertNotNull(rightSet);
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
+ assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
+ assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testUncontroledObjectResourceSet does.
+ @Test
+ public void testMergeUncontroledObjectResourceSetLtR() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
+ // Still two resources, though one is empty
+ assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
+
+ for (Resource resource : rightSet.getResources()) {
+ if (resource != right) {
+ assertTrue(resource.getContents().isEmpty());
+ }
+ }
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() != originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict resource change) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testUncontroledObjectResourceSet does.
+ // TODO will fail until bug 406101 is fixed
+ @Ignore
+ @Test
+ public void testMergeUncontroledObjectResourceSetRtL() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() != originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertTrue(lrCompare.getDifferences().isEmpty());
+
+ // And since we've undone the resource change, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testUncontroledObjectResource() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // At the resource level, we cannot match an object with the 'proxy' root.
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ // There's one addition, and one deletion (the proxy root)
+ final Diff addition;
+ final Diff deletion;
+ if (differences.get(0).getKind() == DifferenceKind.ADD) {
+ addition = differences.get(0);
+ deletion = differences.get(1);
+ } else {
+ deletion = differences.get(0);
+ addition = differences.get(1);
+ }
+ assertTrue(addition instanceof ReferenceChange);
+ assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertEquals(((ReferenceChange)addition).getValue(), getNodeNamed(left, "fragmented"));
+ assertSame(addition.getSource(), DifferenceSource.LEFT);
+ assertSame(addition.getKind(), DifferenceKind.ADD);
+
+ assertTrue(deletion instanceof ReferenceChange);
+ assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertTrue(((ReferenceChange)deletion).getValue().eIsProxy());
+ assertSame(deletion.getSource(), DifferenceSource.LEFT);
+ assertSame(deletion.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testUncontroledObjectResource does.
+ @Test
+ public void testMergeUncontroledObjectResourceLtR() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllLeftToRight(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertNull(originFragmentedNode);
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0) == leftFragmentedNode);
+ assertTrue(originRootContent.get(0).eIsProxy());
+ assertTrue(rightRootContent.get(0) == rightFragmentedNode);
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be four diffs (conflicting 2-by-2) when compared with origin :
+ // two deletions (the proxies) and two additions (the previously fragmented root)
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
+ }
+
+ // This only tests the merge. Will fail if testUncontroledObjectResource does.
+ @Test
+ public void testMergeUncontroledObjectResourceRtL() throws IOException {
+ final Resource left = input.getUncontrolLeft();
+ final Resource origin = input.getUncontrolOrigin();
+ final Resource right = input.getUncontrolRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllRightToLeft(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertNull(leftFragmentedNode);
+ assertNull(originFragmentedNode);
+ assertNull(rightFragmentedNode);
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0).eIsProxy());
+ assertTrue(originRootContent.get(0).eIsProxy());
+ assertTrue(rightRootContent.get(0).eIsProxy());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // And since we've undone the changes, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testControledObjectResourceSet() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ assertNotNull(leftSet);
+ assertNotNull(originSet);
+ assertNotNull(rightSet);
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
+ assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
+ assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.ADD);
+ }
+
+ // This only tests the merge. Will fail if testControledObjectResourceSet does.
+ // TODO will fail until bug 406101 is fixed
+ @Ignore
+ @Test
+ public void testMergeControledObjectResourceSetLtR() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict resource change) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testControledObjectResourceSet does.
+ @Test
+ public void testMergeControledObjectResourceSetRtL() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // Note : we still have 2 resources there, though one is empty
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ for (Resource res : leftSet.getResources()) {
+ if (res != left) {
+ assertTrue(res.getContents().isEmpty());
+ }
+ }
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertTrue(lrCompare.getDifferences().isEmpty());
+
+ // And since we've undone the resource change, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testControledObjectResource() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // At the resource level, we cannot match an object with the 'proxy' root.
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ // There's one deletion, and one addition (the proxy root)
+ final Diff addition;
+ final Diff deletion;
+ if (differences.get(0).getKind() == DifferenceKind.ADD) {
+ addition = differences.get(0);
+ deletion = differences.get(1);
+ } else {
+ deletion = differences.get(0);
+ addition = differences.get(1);
+ }
+ assertTrue(addition instanceof ReferenceChange);
+ assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertTrue(((ReferenceChange)addition).getValue().eIsProxy());
+ assertSame(addition.getSource(), DifferenceSource.LEFT);
+ assertSame(addition.getKind(), DifferenceKind.ADD);
+
+ assertTrue(deletion instanceof ReferenceChange);
+ assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertEquals(((ReferenceChange)deletion).getValue(), getNodeNamed(origin, "fragmented"));
+ assertSame(deletion.getSource(), DifferenceSource.LEFT);
+ assertSame(deletion.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testControledObjectResource does.
+ @Test
+ public void testMergeControledObjectResourceLtR() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllLeftToRight(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertNull(leftFragmentedNode);
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertNull(rightFragmentedNode);
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0).eIsProxy());
+ assertTrue(originRootContent.get(0) == originFragmentedNode);
+ assertTrue(rightRootContent.get(0).eIsProxy());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be four diffs (conflicting 2-by-2) when compared with origin :
+ // two additions (the proxies) and two deletions (the old root)
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
+ }
+
+ // This only tests the merge. Will fail if testControledObjectResource does.
+ @Test
+ public void testMergeControledObjectResourceRtL() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOrigin();
+ final Resource right = input.getControlRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllRightToLeft(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0) == leftFragmentedNode);
+ assertTrue(originRootContent.get(0) == originFragmentedNode);
+ assertTrue(rightRootContent.get(0) == rightFragmentedNode);
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // And since we've undone the changes, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testControledObjectFolderResourceSet() throws IOException {
+ final Resource left = input.getControlLeftFolder();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ assertNotNull(leftSet);
+ assertNotNull(originSet);
+ assertNotNull(rightSet);
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getLeft(), getNodeNamed(leftSet, "fragmented"));
+ assertEquals(diff.getMatch().getRight(), getNodeNamed(rightSet, "fragmented"));
+ assertEquals(diff.getMatch().getOrigin(), getNodeNamed(originSet, "fragmented"));
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.ADD);
+ }
+
+ // This only tests the merge. Will fail if testControledObjectFolderResourceSet does.
+ @Test
+ public void testMergeControledObjectFolderResourceSetLtR() throws IOException {
+ final Resource left = input.getControlLeftFolder();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(rightSet.getResources().size()));
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() != leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() != rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict resource change) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testControledObjectFolderResourceSet does.
+ @Test
+ public void testMergeControledObjectFolderResourceSetRtL() throws IOException {
+ final Resource left = input.getControlLeftFolder();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // Note : we still have 2 resources there, though one is empty
+ assertSame(Integer.valueOf(2), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ for (Resource res : leftSet.getResources()) {
+ if (res != left) {
+ assertTrue(res.getContents().isEmpty());
+ }
+ }
+
+ final EObject leftFragmentedNode = getNodeNamed(leftSet, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(originSet, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(rightSet, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertTrue(lrCompare.getDifferences().isEmpty());
+
+ // And since we've undone the resource change, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testControledObjectFolderResource() throws IOException {
+ final Resource left = input.getControlLeft();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // At the resource level, we cannot match an object with the 'proxy' root.
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ // There's one deletion, and one addition (the proxy root)
+ final Diff addition;
+ final Diff deletion;
+ if (differences.get(0).getKind() == DifferenceKind.ADD) {
+ addition = differences.get(0);
+ deletion = differences.get(1);
+ } else {
+ deletion = differences.get(0);
+ addition = differences.get(1);
+ }
+ assertTrue(addition instanceof ReferenceChange);
+ assertEquals(addition.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(addition.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(addition.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertTrue(((ReferenceChange)addition).getValue().eIsProxy());
+ assertSame(addition.getSource(), DifferenceSource.LEFT);
+ assertSame(addition.getKind(), DifferenceKind.ADD);
+
+ assertTrue(deletion instanceof ReferenceChange);
+ assertEquals(deletion.getMatch().getLeft(), getNodeNamed(left, "root"));
+ assertEquals(deletion.getMatch().getRight(), getNodeNamed(right, "root"));
+ assertEquals(deletion.getMatch().getOrigin(), getNodeNamed(origin, "root"));
+ assertEquals(((ReferenceChange)deletion).getValue(), getNodeNamed(origin, "fragmented"));
+ assertSame(deletion.getSource(), DifferenceSource.LEFT);
+ assertSame(deletion.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testControledObjectFolderResource does.
+ @Test
+ public void testMergeControledObjectFolderResourceLtR() throws IOException {
+ final Resource left = input.getControlLeftFolder();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllLeftToRight(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertNull(leftFragmentedNode);
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertNull(rightFragmentedNode);
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0).eIsProxy());
+ assertTrue(originRootContent.get(0) == originFragmentedNode);
+ assertTrue(rightRootContent.get(0).eIsProxy());
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be four diffs (conflicting 2-by-2) when compared with origin :
+ // two additions (the proxies) and two deletions (the old root)
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(1).getKind());
+ }
+
+ // This only tests the merge. Will fail if testControledObjectFolderResource does.
+ @Test
+ public void testMergeControledObjectFolderResourceRtL() throws IOException {
+ final Resource left = input.getControlLeftFolder();
+ final Resource origin = input.getControlOriginFolder();
+ final Resource right = input.getControlRightFolder();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllRightToLeft(differences, new BasicMonitor());
+
+ final EObject leftFragmentedNode = getNodeNamed(left, "fragmented");
+ final EObject originFragmentedNode = getNodeNamed(origin, "fragmented");
+ final EObject rightFragmentedNode = getNodeNamed(right, "fragmented");
+
+ assertTrue(leftFragmentedNode.eContainer().eResource() == leftFragmentedNode.eResource());
+ assertTrue(originFragmentedNode.eContainer().eResource() == originFragmentedNode.eResource());
+ assertTrue(rightFragmentedNode.eContainer().eResource() == rightFragmentedNode.eResource());
+
+ final List<EObject> leftRootContent = ((InternalEList<EObject>)getNodeNamed(left, "root").eContents())
+ .basicList();
+ final List<EObject> originRootContent = ((InternalEList<EObject>)getNodeNamed(origin, "root")
+ .eContents()).basicList();
+ final List<EObject> rightRootContent = ((InternalEList<EObject>)getNodeNamed(right, "root")
+ .eContents()).basicList();
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originRootContent.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightRootContent.size()));
+
+ assertTrue(leftRootContent.get(0) == leftFragmentedNode);
+ assertTrue(originRootContent.get(0) == originFragmentedNode);
+ assertTrue(rightRootContent.get(0) == rightFragmentedNode);
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // And since we've undone the changes, there are no diffs with origin either
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertTrue(comparison.getDifferences().isEmpty());
+ }
+
+ @Test
+ public void testDeletedRootResourceSet() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ assertNotNull(leftSet);
+ assertNotNull(originSet);
+ assertNotNull(rightSet);
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getRight(), getNodeNamed(right, "deletedRoot"));
+ assertEquals(diff.getMatch().getOrigin(), getNodeNamed(origin, "deletedRoot"));
+ assertNull(diff.getMatch().getLeft());
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testDeletedRootResourceSet does.
+ @Test
+ public void testMergeDeletedRootResourceSetLtR() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict deletion) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testDeletedRootResourceSet does.
+ @Test
+ public void testMergeDeletedRootResourceSetRtL() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testDeletedRootResource() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getRight(), getNodeNamed(right, "deletedRoot"));
+ assertEquals(diff.getMatch().getOrigin(), getNodeNamed(origin, "deletedRoot"));
+ assertNull(diff.getMatch().getLeft());
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.DELETE);
+ }
+
+ // This only tests the merge. Will fail if testDeletedRootResource does.
+ @Test
+ public void testMergeDeletedRootResourceLtR() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict deletion) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testDeletedRootResource does.
+ @Test
+ public void testMergeDeletedRootResourceRtL() throws IOException {
+ final Resource left = input.getDeletedRootLeft();
+ final Resource origin = input.getDeletedRootOrigin();
+ final Resource right = input.getDeletedRootRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testNewRootResourceSet() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ assertNotNull(leftSet);
+ assertNotNull(originSet);
+ assertNotNull(rightSet);
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(leftSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(originSet.getResources().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(rightSet.getResources().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getLeft(), getNodeNamed(left, "newRoot"));
+ assertNull(diff.getMatch().getOrigin());
+ assertNull(diff.getMatch().getRight());
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.ADD);
+ }
+
+ // This only tests the merge. Will fail if testNewRootResourceSet does.
+ @Test
+ public void testMergeNewRootResourceSetLtR() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(leftSet, rightSet, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict addition) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testNewRootResourceSet does.
+ @Test
+ public void testMergeNewRootResourceSetRtL() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ final ResourceSet leftSet = left.getResourceSet();
+ final ResourceSet originSet = origin.getResourceSet();
+ final ResourceSet rightSet = right.getResourceSet();
+
+ EcoreUtil.resolveAll(leftSet);
+ EcoreUtil.resolveAll(originSet);
+ EcoreUtil.resolveAll(rightSet);
+
+ final IComparisonScope scope = new DefaultComparisonScope(leftSet, rightSet, originSet);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testNewRootResource() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final Diff diff = differences.get(0);
+ assertTrue(diff instanceof ResourceAttachmentChange);
+ assertEquals(diff.getMatch().getLeft(), getNodeNamed(left, "newRoot"));
+ assertNull(diff.getMatch().getOrigin());
+ assertNull(diff.getMatch().getRight());
+ assertSame(diff.getSource(), DifferenceSource.LEFT);
+ assertSame(diff.getKind(), DifferenceKind.ADD);
+ }
+
+ // This only tests the merge. Will fail if testNewRootResource does.
+ @Test
+ public void testMergeNewRootResourceLtR() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(2), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(2), Integer.valueOf(right.getContents().size()));
+
+ // there should be no diff between left and right
+ final Comparison lrCompare = EMFCompare.builder().build().compare(
+ new DefaultComparisonScope(left, right, null));
+ assertSame(Integer.valueOf(0), Integer.valueOf(lrCompare.getDifferences().size()));
+
+ // but there should be two diffs (a pseudo conflict addition) when compared with origin
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getConflicts().size()));
+ assertSame(ConflictKind.PSEUDO, comparison.getConflicts().get(0).getKind());
+ }
+
+ // This only tests the merge. Will fail if testNewRootResource does.
+ @Test
+ public void testMergeNewRootResourceRtL() throws IOException {
+ final Resource left = input.getNewRootLeft();
+ final Resource origin = input.getNewRootOrigin();
+ final Resource right = input.getNewRootRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final Diff diff = differences.get(0);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ assertSame(Integer.valueOf(1), Integer.valueOf(left.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(origin.getContents().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(right.getContents().size()));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Notifier notifier, String name) {
+ final Iterator<EObject> iterator;
+ if (notifier instanceof ResourceSet) {
+ iterator = Iterators.filter(EcoreUtil.getAllProperContents((ResourceSet)notifier, false),
+ EObject.class);
+ } else if (notifier instanceof Resource) {
+ iterator = EcoreUtil.getAllProperContents((Resource)notifier, false);
+ } else {
+ iterator = EcoreUtil.getAllProperContents((EObject)notifier, false);
+ }
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/data/FragmentationInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/data/FragmentationInputData.java
index efed92b0d..7d2f3eb7d 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/data/FragmentationInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fragmentation/data/FragmentationInputData.java
@@ -1,81 +1,81 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fragmentation.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.impl.ResourceSetImpl;
-
-// We'll use a resource set for these tests
-@SuppressWarnings("nls")
-public class FragmentationInputData extends AbstractInputData {
- public Resource getControlLeft() throws IOException {
- return loadFromClassLoader("control/left.nodes", new ResourceSetImpl());
- }
-
- public Resource getControlOrigin() throws IOException {
- return loadFromClassLoader("control/origin.nodes", new ResourceSetImpl());
- }
-
- public Resource getControlRight() throws IOException {
- return loadFromClassLoader("control/right.nodes", new ResourceSetImpl());
- }
-
- public Resource getUncontrolLeft() throws IOException {
- return loadFromClassLoader("uncontrol/left.nodes", new ResourceSetImpl());
- }
-
- public Resource getUncontrolOrigin() throws IOException {
- return loadFromClassLoader("uncontrol/origin.nodes", new ResourceSetImpl());
- }
-
- public Resource getUncontrolRight() throws IOException {
- return loadFromClassLoader("uncontrol/right.nodes", new ResourceSetImpl());
- }
-
- public Resource getControlLeftFolder() throws IOException {
- return loadFromClassLoader("control/left/left.nodes", new ResourceSetImpl());
- }
-
- public Resource getControlOriginFolder() throws IOException {
- return loadFromClassLoader("control/origin/origin.nodes", new ResourceSetImpl());
- }
-
- public Resource getControlRightFolder() throws IOException {
- return loadFromClassLoader("control/right/right.nodes", new ResourceSetImpl());
- }
-
- public Resource getDeletedRootLeft() throws IOException {
- return loadFromClassLoader("deletedroot/left.nodes", new ResourceSetImpl());
- }
-
- public Resource getDeletedRootOrigin() throws IOException {
- return loadFromClassLoader("deletedroot/origin.nodes", new ResourceSetImpl());
- }
-
- public Resource getDeletedRootRight() throws IOException {
- return loadFromClassLoader("deletedroot/right.nodes", new ResourceSetImpl());
- }
-
- public Resource getNewRootLeft() throws IOException {
- return loadFromClassLoader("newroot/left.nodes", new ResourceSetImpl());
- }
-
- public Resource getNewRootOrigin() throws IOException {
- return loadFromClassLoader("newroot/origin.nodes", new ResourceSetImpl());
- }
-
- public Resource getNewRootRight() throws IOException {
- return loadFromClassLoader("newroot/right.nodes", new ResourceSetImpl());
- }
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fragmentation.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.impl.ResourceSetImpl;
+
+// We'll use a resource set for these tests
+@SuppressWarnings("nls")
+public class FragmentationInputData extends AbstractInputData {
+ public Resource getControlLeft() throws IOException {
+ return loadFromClassLoader("control/left.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getControlOrigin() throws IOException {
+ return loadFromClassLoader("control/origin.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getControlRight() throws IOException {
+ return loadFromClassLoader("control/right.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getUncontrolLeft() throws IOException {
+ return loadFromClassLoader("uncontrol/left.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getUncontrolOrigin() throws IOException {
+ return loadFromClassLoader("uncontrol/origin.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getUncontrolRight() throws IOException {
+ return loadFromClassLoader("uncontrol/right.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getControlLeftFolder() throws IOException {
+ return loadFromClassLoader("control/left/left.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getControlOriginFolder() throws IOException {
+ return loadFromClassLoader("control/origin/origin.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getControlRightFolder() throws IOException {
+ return loadFromClassLoader("control/right/right.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getDeletedRootLeft() throws IOException {
+ return loadFromClassLoader("deletedroot/left.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getDeletedRootOrigin() throws IOException {
+ return loadFromClassLoader("deletedroot/origin.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getDeletedRootRight() throws IOException {
+ return loadFromClassLoader("deletedroot/right.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getNewRootLeft() throws IOException {
+ return loadFromClassLoader("newroot/left.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getNewRootOrigin() throws IOException {
+ return loadFromClassLoader("newroot/origin.nodes", new ResourceSetImpl());
+ }
+
+ public Resource getNewRootRight() throws IOException {
+ return loadFromClassLoader("newroot/right.nodes", new ResourceSetImpl());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractInputData.java
index 132870db2..3789ffca3 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractInputData.java
@@ -1,101 +1,101 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collections;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-
-/**
- * Implementations of this class can be used to load models from the class' class loader.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public abstract class AbstractInputData {
- /**
- * Tries and locate a model in the current class' classpath.
- *
- * @param string
- * Relative path to the model we seek (relative to this class).
- * @return The loaded resource.
- * @throws IOException
- * Thrown if we could not access either this class' resource, or the file towards which
- * <code>string</code> points.
- */
- protected Resource loadFromClassLoader(String string) throws IOException {
- final URL fileURL = getClass().getResource(string);
- final InputStream str = fileURL.openStream();
- final URI uri = URI.createURI(fileURL.toString());
-
- Resource.Factory resourceFactory = Resource.Factory.Registry.INSTANCE.getFactory(uri);
- if (resourceFactory == null) {
- // Most likely a standalone run. Try with a plain XMI resource
- resourceFactory = new XMIResourceFactoryImpl();
- }
-
- // resourceFactory cannot be null
- Resource res = resourceFactory.createResource(uri);
- res.load(str, Collections.emptyMap());
- str.close();
- return res;
- }
-
- /**
- * Tries and locate a model in the current class' classpath.
- *
- * @param string
- * Relative path to the model we seek (relative to this class).
- * @param resourceSet
- * the resource set in which to load the resource.
- * @return The loaded resource.
- * @throws IOException
- * Thrown if we could not access either this class' resource, or the file towards which
- * <code>path</code> points.
- */
- protected Resource loadFromClassLoader(String path, ResourceSet resourceSet) throws IOException {
- final URL fileURL = getClass().getResource(path);
- final URI uri = URI.createURI(fileURL.toString());
-
- final Resource existing = resourceSet.getResource(uri, false);
- if (existing != null) {
- return existing;
- }
-
- InputStream stream = null;
- Resource resource = null;
- try {
- resource = resourceSet.createResource(uri);
- stream = fileURL.openStream();
- resource.load(stream, Collections.emptyMap());
- } catch (IOException e) {
- // return null
- } catch (WrappedException e) {
- // return null
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- // Should have been caught by the outer try
- }
- }
- }
-
- return resource;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+
+/**
+ * Implementations of this class can be used to load models from the class' class loader.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public abstract class AbstractInputData {
+ /**
+ * Tries and locate a model in the current class' classpath.
+ *
+ * @param string
+ * Relative path to the model we seek (relative to this class).
+ * @return The loaded resource.
+ * @throws IOException
+ * Thrown if we could not access either this class' resource, or the file towards which
+ * <code>string</code> points.
+ */
+ protected Resource loadFromClassLoader(String string) throws IOException {
+ final URL fileURL = getClass().getResource(string);
+ final InputStream str = fileURL.openStream();
+ final URI uri = URI.createURI(fileURL.toString());
+
+ Resource.Factory resourceFactory = Resource.Factory.Registry.INSTANCE.getFactory(uri);
+ if (resourceFactory == null) {
+ // Most likely a standalone run. Try with a plain XMI resource
+ resourceFactory = new XMIResourceFactoryImpl();
+ }
+
+ // resourceFactory cannot be null
+ Resource res = resourceFactory.createResource(uri);
+ res.load(str, Collections.emptyMap());
+ str.close();
+ return res;
+ }
+
+ /**
+ * Tries and locate a model in the current class' classpath.
+ *
+ * @param string
+ * Relative path to the model we seek (relative to this class).
+ * @param resourceSet
+ * the resource set in which to load the resource.
+ * @return The loaded resource.
+ * @throws IOException
+ * Thrown if we could not access either this class' resource, or the file towards which
+ * <code>path</code> points.
+ */
+ protected Resource loadFromClassLoader(String path, ResourceSet resourceSet) throws IOException {
+ final URL fileURL = getClass().getResource(path);
+ final URI uri = URI.createURI(fileURL.toString());
+
+ final Resource existing = resourceSet.getResource(uri, false);
+ if (existing != null) {
+ return existing;
+ }
+
+ InputStream stream = null;
+ Resource resource = null;
+ try {
+ resource = resourceSet.createResource(uri);
+ stream = fileURL.openStream();
+ resource.load(stream, Collections.emptyMap());
+ } catch (IOException e) {
+ // return null
+ } catch (WrappedException e) {
+ // return null
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // Should have been caught by the outer try
+ }
+ }
+ }
+
+ return resource;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractMatchValidator.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractMatchValidator.java
index 3fda2890c..13b00a4b7 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractMatchValidator.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/AbstractMatchValidator.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Match;
-
-/**
- * This abstract class provides the base functionality to walk over a given {@link Comparison} {@link Match}
- * es. Sub-classes of this will be used to validate the {@link Match} detected by EMF Compare.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public abstract class AbstractMatchValidator {
- /**
- * Default constructor.
- */
- public AbstractMatchValidator() {
- // Empty implementation
- }
-
- public void validate(Comparison comparison) {
- for (Match rootMatch : comparison.getMatches()) {
- walkAndValidate(rootMatch);
- }
- }
-
- /**
- * Walks over the given match and its sub-matches, calling {@link #validateMatch(Match)} on each.
- *
- * @param match
- * The match we are to validate.
- */
- protected void walkAndValidate(Match match) {
- validateMatch(match);
- for (Match submatch : match.getSubmatches()) {
- walkAndValidate(submatch);
- }
- }
-
- /**
- * Ensures that the given match is indeed matching the expected elements.
- *
- * @param match
- * The match we are to validate.
- */
- protected abstract void validateMatch(Match match);
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Match;
+
+/**
+ * This abstract class provides the base functionality to walk over a given {@link Comparison} {@link Match}
+ * es. Sub-classes of this will be used to validate the {@link Match} detected by EMF Compare.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public abstract class AbstractMatchValidator {
+ /**
+ * Default constructor.
+ */
+ public AbstractMatchValidator() {
+ // Empty implementation
+ }
+
+ public void validate(Comparison comparison) {
+ for (Match rootMatch : comparison.getMatches()) {
+ walkAndValidate(rootMatch);
+ }
+ }
+
+ /**
+ * Walks over the given match and its sub-matches, calling {@link #validateMatch(Match)} on each.
+ *
+ * @param match
+ * The match we are to validate.
+ */
+ protected void walkAndValidate(Match match) {
+ validateMatch(match);
+ for (Match submatch : match.getSubmatches()) {
+ walkAndValidate(submatch);
+ }
+ }
+
+ /**
+ * Ensures that the given match is indeed matching the expected elements.
+ *
+ * @param match
+ * The match we are to validate.
+ */
+ protected abstract void validateMatch(Match match);
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareAssert.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareAssert.java
index b9d0736d4..0cb53c22e 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareAssert.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareAssert.java
@@ -1,294 +1,294 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.framework;
-
-import static com.google.common.base.Predicates.and;
-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.changedAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-import java.lang.reflect.Field;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.scope.FilterComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.utils.EMFComparePredicates;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * Provides specific assertions for EMF Compare tests.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("nls")
-public class EMFCompareAssert {
- /**
- * This can be used to check whether all objects of the given list have a corresponding {@link Match} in
- * the given {@link Comparison}. If one of said EObjects is not matched, we will check whether it is
- * included in the given <code>scope</code> if it is a {@link FilterComparisonScope}.
- *
- * @param eObjects
- * The list of EObjects for which we need corresponding {@link Match}es.
- * @param comparison
- * The {@link Comparison} in which we are to check for Matches.
- * @param scope
- * The scope that has been used to create the given <code>comparison</code>.
- */
- public static void assertAllMatched(List<EObject> eObjects, Comparison comparison, IComparisonScope scope) {
- final Predicate<? super EObject> scopeFilter;
- if (scope instanceof FilterComparisonScope) {
- scopeFilter = getResourceChildrenFilteringPredicate((FilterComparisonScope)scope);
- } else {
- scopeFilter = Predicates.alwaysTrue();
- }
-
- final Iterator<EObject> eObjectIterator = eObjects.iterator();
- while (eObjectIterator.hasNext()) {
- final EObject eObject = eObjectIterator.next();
- final Match match = comparison.getMatch(eObject);
- assertTrue(eObject + " has no match", match != null || !scopeFilter.apply(eObject));
- }
- }
-
- /**
- * Asserts that the given list of differences contains a ReferenceChange describing the given change for a
- * single-valued reference. The {@code differences} list will be updated by this call, removing the
- * corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular reference change.
- * @param qualifiedName
- * Qualified name of the EObject which reference we expect to have changed.
- * @param referenceName
- * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
- * this reference to be single-valued.
- * @param fromQualifiedName
- * Qualified name of the original value of this reference (can be either the origin or right
- * value).
- * @param toQualifiedName
- * Qualified name of the value to which this reference has been changed (can be either left or
- * right in three-way comparisons, only left for two-way).
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#changedReference(String, String, String, String)
- */
- public static void assertChangedReference(List<Diff> differences, String qualifiedName,
- String referenceName, String fromQualifiedName, String toQualifiedName, DifferenceSource side) {
- final Predicate<? super Diff> changedReferenceOnSide = and(fromSide(side), changedReference(
- qualifiedName, referenceName, fromQualifiedName, toQualifiedName));
- final Diff matchingDiff = removeFirst(differences.iterator(), changedReferenceOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Asserts that the given list of differences contains a ReferenceChange describing the removal of a value
- * from a multi-valued reference. The {@code differences} list will be updated by this call, removing the
- * corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular reference change.
- * @param qualifiedName
- * Qualified name of the EObject which reference we expect to have changed.
- * @param referenceName
- * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
- * this reference to be multi-valued.
- * @param removedValueQualifiedName
- * Qualified name of the value we expect to have been removed from that reference's list of
- * values.
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#removedFromReference(String, String, String)
- */
- public static void assertRemovedFromReference(List<Diff> differences, String qualifiedName,
- String referenceName, String removedValueQualifiedName, DifferenceSource side) {
- final Predicate<? super Diff> removedFromReferenceOnSide = and(fromSide(side), removedFromReference(
- qualifiedName, referenceName, removedValueQualifiedName));
- final Diff matchingDiff = removeFirst(differences.iterator(), removedFromReferenceOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Asserts that the given list of differences contains a ReferenceChange describing the addition of a
- * value into a multi-valued reference. The {@code differences} list will be updated by this call,
- * removing the corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular reference change.
- * @param qualifiedName
- * Qualified name of the EObject which reference we expect to have changed.
- * @param referenceName
- * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
- * this reference to be multi-valued.
- * @param addedValueQualifiedName
- * Qualified name of the value we expect to have been added to that reference's list of values.
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#addedToReference(String, String, String)
- */
- public static void assertAddedToReference(List<Diff> differences, String qualifiedName,
- String referenceName, String addedValueQualifiedName, DifferenceSource side) {
- final Predicate<? super Diff> addedToReferenceOnSide = and(fromSide(side), addedToReference(
- qualifiedName, referenceName, addedValueQualifiedName));
- final Diff matchingDiff = removeFirst(differences.iterator(), addedToReferenceOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Asserts that the given list of differences contains an AttributeChange describing the given change for
- * a single-valued attribute. The {@code differences} list will be updated by this call, removing the
- * corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular attribute change.
- * @param qualifiedName
- * Qualified name of the EObject which attribute we expect to have changed.
- * @param attributeName
- * Name of the attribute which values we expect to have changed. <b>Note</b> that we expect
- * this attribute to be single-valued.
- * @param fromValue
- * The original value of this attribute. Can be either the origin or right value.
- * @param toValue
- * The value to which this attribute has been changed. Can be either left or right for a
- * three-way comparison, only left in two-way.
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#changedAttribute(String, String, Object, Object)
- */
- public static void assertChangedAttribute(List<Diff> differences, String qualifiedName,
- String attributeName, Object fromValue, Object toValue, DifferenceSource side) {
- final Predicate<? super Diff> changedAttributeOnSide = and(fromSide(side), changedAttribute(
- qualifiedName, attributeName, fromValue, toValue));
- final Diff matchingDiff = removeFirst(differences.iterator(), changedAttributeOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Asserts that the given list of differences contains a ReferenceChange describing the given element
- * addition. This is only meant for containment changes. The {@code differences} list will be updated by
- * this call, removing the corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular element addition.
- * @param qualifiedName
- * Qualified name of the EObject we expect to have been added.
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#added(String)
- */
- public static void assertAdded(List<Diff> differences, String qualifiedName, DifferenceSource side) {
- final Predicate<? super Diff> addedOnSide = and(fromSide(side), added(qualifiedName));
- final Diff matchingDiff = removeFirst(differences.iterator(), addedOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Asserts that the given list of differences contains a ReferenceChange describing the given element
- * deletion. This is only meant for containment changes. The {@code differences} list will be updated by
- * this call, removing the corresponding Diff if it could be located.
- * <p>
- * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
- * so that we can compare it to the given qualified names.
- * </p>
- *
- * @param differences
- * List of differences in which to seek for a particular element deletion.
- * @param qualifiedName
- * Qualified name of the EObject we expect to have been deleted.
- * @param side
- * The side from which we expect this diff to originate.
- * @see EMFComparePredicates#removed(String)
- */
- public static void assertRemoved(List<Diff> differences, String qualifiedName, DifferenceSource side) {
- final Predicate<? super Diff> removedOnSide = and(fromSide(side), removed(qualifiedName));
- final Diff matchingDiff = removeFirst(differences.iterator(), removedOnSide);
- assertNotNull(matchingDiff);
- }
-
- /**
- * Retrieves the Predicate that is used by the given scope in order to filter out Resource children.
- * <p>
- * This uses reflection to access a protected field, and is only meant for testing purposes.
- * </p>
- *
- * @param scope
- * The scope which predicate we need to retrieve.
- * @return The predicate that was used by the given scope to filter out Resource children.
- */
- @SuppressWarnings("unchecked")
- private static Predicate<? super EObject> getResourceChildrenFilteringPredicate(
- FilterComparisonScope scope) {
- final String fieldName = "resourceContentFilter"; //$NON-NLS-1$
- try {
- final Field field = FilterComparisonScope.class.getDeclaredField(fieldName);
- field.setAccessible(true);
- return (Predicate<? super EObject>)field.get(scope);
- } catch (Exception e) {
- fail("Could not retrieve the filtering predicate of " + scope.getClass().getName()); //$NON-NLS-1$
- }
- // Unreachable code
- return null;
- }
-
- /**
- * Removes and returns the first element returned by {@code iterator} that satisfies the given predicate.
- *
- * @param iterator
- * Iterators over which elements we are to iterate.
- * @param predicate
- * The predicate which needs to be satisified.
- * @return The first element of {@code iterator} that satisfies {@code predicate}, {@code null} if none.
- */
- private static <T> T removeFirst(Iterator<T> iterator, Predicate<? super T> predicate) {
- while (iterator.hasNext()) {
- T element = iterator.next();
- if (predicate.apply(element)) {
- iterator.remove();
- return element;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.framework;
+
+import static com.google.common.base.Predicates.and;
+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.changedAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+import java.lang.reflect.Field;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.scope.FilterComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.utils.EMFComparePredicates;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Provides specific assertions for EMF Compare tests.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@SuppressWarnings("nls")
+public class EMFCompareAssert {
+ /**
+ * This can be used to check whether all objects of the given list have a corresponding {@link Match} in
+ * the given {@link Comparison}. If one of said EObjects is not matched, we will check whether it is
+ * included in the given <code>scope</code> if it is a {@link FilterComparisonScope}.
+ *
+ * @param eObjects
+ * The list of EObjects for which we need corresponding {@link Match}es.
+ * @param comparison
+ * The {@link Comparison} in which we are to check for Matches.
+ * @param scope
+ * The scope that has been used to create the given <code>comparison</code>.
+ */
+ public static void assertAllMatched(List<EObject> eObjects, Comparison comparison, IComparisonScope scope) {
+ final Predicate<? super EObject> scopeFilter;
+ if (scope instanceof FilterComparisonScope) {
+ scopeFilter = getResourceChildrenFilteringPredicate((FilterComparisonScope)scope);
+ } else {
+ scopeFilter = Predicates.alwaysTrue();
+ }
+
+ final Iterator<EObject> eObjectIterator = eObjects.iterator();
+ while (eObjectIterator.hasNext()) {
+ final EObject eObject = eObjectIterator.next();
+ final Match match = comparison.getMatch(eObject);
+ assertTrue(eObject + " has no match", match != null || !scopeFilter.apply(eObject));
+ }
+ }
+
+ /**
+ * Asserts that the given list of differences contains a ReferenceChange describing the given change for a
+ * single-valued reference. The {@code differences} list will be updated by this call, removing the
+ * corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular reference change.
+ * @param qualifiedName
+ * Qualified name of the EObject which reference we expect to have changed.
+ * @param referenceName
+ * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
+ * this reference to be single-valued.
+ * @param fromQualifiedName
+ * Qualified name of the original value of this reference (can be either the origin or right
+ * value).
+ * @param toQualifiedName
+ * Qualified name of the value to which this reference has been changed (can be either left or
+ * right in three-way comparisons, only left for two-way).
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#changedReference(String, String, String, String)
+ */
+ public static void assertChangedReference(List<Diff> differences, String qualifiedName,
+ String referenceName, String fromQualifiedName, String toQualifiedName, DifferenceSource side) {
+ final Predicate<? super Diff> changedReferenceOnSide = and(fromSide(side), changedReference(
+ qualifiedName, referenceName, fromQualifiedName, toQualifiedName));
+ final Diff matchingDiff = removeFirst(differences.iterator(), changedReferenceOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Asserts that the given list of differences contains a ReferenceChange describing the removal of a value
+ * from a multi-valued reference. The {@code differences} list will be updated by this call, removing the
+ * corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular reference change.
+ * @param qualifiedName
+ * Qualified name of the EObject which reference we expect to have changed.
+ * @param referenceName
+ * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
+ * this reference to be multi-valued.
+ * @param removedValueQualifiedName
+ * Qualified name of the value we expect to have been removed from that reference's list of
+ * values.
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#removedFromReference(String, String, String)
+ */
+ public static void assertRemovedFromReference(List<Diff> differences, String qualifiedName,
+ String referenceName, String removedValueQualifiedName, DifferenceSource side) {
+ final Predicate<? super Diff> removedFromReferenceOnSide = and(fromSide(side), removedFromReference(
+ qualifiedName, referenceName, removedValueQualifiedName));
+ final Diff matchingDiff = removeFirst(differences.iterator(), removedFromReferenceOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Asserts that the given list of differences contains a ReferenceChange describing the addition of a
+ * value into a multi-valued reference. The {@code differences} list will be updated by this call,
+ * removing the corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular reference change.
+ * @param qualifiedName
+ * Qualified name of the EObject which reference we expect to have changed.
+ * @param referenceName
+ * Name of the reference which values we expect to have changed. <b>Note</b> that we expect
+ * this reference to be multi-valued.
+ * @param addedValueQualifiedName
+ * Qualified name of the value we expect to have been added to that reference's list of values.
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#addedToReference(String, String, String)
+ */
+ public static void assertAddedToReference(List<Diff> differences, String qualifiedName,
+ String referenceName, String addedValueQualifiedName, DifferenceSource side) {
+ final Predicate<? super Diff> addedToReferenceOnSide = and(fromSide(side), addedToReference(
+ qualifiedName, referenceName, addedValueQualifiedName));
+ final Diff matchingDiff = removeFirst(differences.iterator(), addedToReferenceOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Asserts that the given list of differences contains an AttributeChange describing the given change for
+ * a single-valued attribute. The {@code differences} list will be updated by this call, removing the
+ * corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular attribute change.
+ * @param qualifiedName
+ * Qualified name of the EObject which attribute we expect to have changed.
+ * @param attributeName
+ * Name of the attribute which values we expect to have changed. <b>Note</b> that we expect
+ * this attribute to be single-valued.
+ * @param fromValue
+ * The original value of this attribute. Can be either the origin or right value.
+ * @param toValue
+ * The value to which this attribute has been changed. Can be either left or right for a
+ * three-way comparison, only left in two-way.
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#changedAttribute(String, String, Object, Object)
+ */
+ public static void assertChangedAttribute(List<Diff> differences, String qualifiedName,
+ String attributeName, Object fromValue, Object toValue, DifferenceSource side) {
+ final Predicate<? super Diff> changedAttributeOnSide = and(fromSide(side), changedAttribute(
+ qualifiedName, attributeName, fromValue, toValue));
+ final Diff matchingDiff = removeFirst(differences.iterator(), changedAttributeOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Asserts that the given list of differences contains a ReferenceChange describing the given element
+ * addition. This is only meant for containment changes. The {@code differences} list will be updated by
+ * this call, removing the corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular element addition.
+ * @param qualifiedName
+ * Qualified name of the EObject we expect to have been added.
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#added(String)
+ */
+ public static void assertAdded(List<Diff> differences, String qualifiedName, DifferenceSource side) {
+ final Predicate<? super Diff> addedOnSide = and(fromSide(side), added(qualifiedName));
+ final Diff matchingDiff = removeFirst(differences.iterator(), addedOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Asserts that the given list of differences contains a ReferenceChange describing the given element
+ * deletion. This is only meant for containment changes. The {@code differences} list will be updated by
+ * this call, removing the corresponding Diff if it could be located.
+ * <p>
+ * Note that in order for this to work, we expect the EObjects to have a "name" feature returning a String
+ * so that we can compare it to the given qualified names.
+ * </p>
+ *
+ * @param differences
+ * List of differences in which to seek for a particular element deletion.
+ * @param qualifiedName
+ * Qualified name of the EObject we expect to have been deleted.
+ * @param side
+ * The side from which we expect this diff to originate.
+ * @see EMFComparePredicates#removed(String)
+ */
+ public static void assertRemoved(List<Diff> differences, String qualifiedName, DifferenceSource side) {
+ final Predicate<? super Diff> removedOnSide = and(fromSide(side), removed(qualifiedName));
+ final Diff matchingDiff = removeFirst(differences.iterator(), removedOnSide);
+ assertNotNull(matchingDiff);
+ }
+
+ /**
+ * Retrieves the Predicate that is used by the given scope in order to filter out Resource children.
+ * <p>
+ * This uses reflection to access a protected field, and is only meant for testing purposes.
+ * </p>
+ *
+ * @param scope
+ * The scope which predicate we need to retrieve.
+ * @return The predicate that was used by the given scope to filter out Resource children.
+ */
+ @SuppressWarnings("unchecked")
+ private static Predicate<? super EObject> getResourceChildrenFilteringPredicate(
+ FilterComparisonScope scope) {
+ final String fieldName = "resourceContentFilter"; //$NON-NLS-1$
+ try {
+ final Field field = FilterComparisonScope.class.getDeclaredField(fieldName);
+ field.setAccessible(true);
+ return (Predicate<? super EObject>)field.get(scope);
+ } catch (Exception e) {
+ fail("Could not retrieve the filtering predicate of " + scope.getClass().getName()); //$NON-NLS-1$
+ }
+ // Unreachable code
+ return null;
+ }
+
+ /**
+ * Removes and returns the first element returned by {@code iterator} that satisfies the given predicate.
+ *
+ * @param iterator
+ * Iterators over which elements we are to iterate.
+ * @param predicate
+ * The predicate which needs to be satisified.
+ * @return The first element of {@code iterator} that satisfies {@code predicate}, {@code null} if none.
+ */
+ private static <T> T removeFirst(Iterator<T> iterator, Predicate<? super T> predicate) {
+ while (iterator.hasNext()) {
+ T element = iterator.next();
+ if (predicate.apply(element)) {
+ iterator.remove();
+ return element;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareTestBase.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareTestBase.java
index cf91e205d..7ea24866f 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareTestBase.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/EMFCompareTestBase.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.framework;
-
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-// TODO move asserts to their own utility class
-/**
- * This provides a number of utility methods for EMF Compare tests.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class EMFCompareTestBase {
- /**
- * Returns all proper content of the given resource in the form of a list.
- *
- * @param res
- * The resource which content we need.
- * @return The list of all of the given resource's contained EObjects.
- */
- protected static List<EObject> getAllProperContent(Resource res) {
- if (res == null) {
- return Lists.newArrayList();
- }
-
- final Iterator<Object> properContent = EcoreUtil.getAllProperContents(res, false);
- final Iterator<EObject> filter = Iterators.filter(properContent, EObject.class);
- return Lists.newArrayList(filter);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.framework;
+
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+// TODO move asserts to their own utility class
+/**
+ * This provides a number of utility methods for EMF Compare tests.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class EMFCompareTestBase {
+ /**
+ * Returns all proper content of the given resource in the form of a list.
+ *
+ * @param res
+ * The resource which content we need.
+ * @return The list of all of the given resource's contained EObjects.
+ */
+ protected static List<EObject> getAllProperContent(Resource res) {
+ if (res == null) {
+ return Lists.newArrayList();
+ }
+
+ final Iterator<Object> properContent = EcoreUtil.getAllProperContents(res, false);
+ final Iterator<EObject> filter = Iterators.filter(properContent, EObject.class);
+ return Lists.newArrayList(filter);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/IdentifierMatchValidator.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/IdentifierMatchValidator.java
index 48fda31d2..7f264d4c1 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/IdentifierMatchValidator.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/IdentifierMatchValidator.java
@@ -1,101 +1,101 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import com.google.common.collect.Maps;
-
-import java.util.Map;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-
-/**
- * This implementation of a {@link AbstractMatchValidator} expects that all sides of a given {@link Match}
- * share the same identifier according to the semantics of {@link #getID(EObject)}.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class IdentifierMatchValidator extends AbstractMatchValidator {
- /** "Remember" which Match corresponds to which ID. */
- private Map<String, Match> idToMatch = Maps.newHashMap();
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.tests.framework.AbstractMatchValidator#validate(org.eclipse.emf.compare.Comparison)
- */
- @Override
- public void validate(Comparison comparison) {
- super.validate(comparison);
- idToMatch.clear();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.tests.framework.AbstractMatchValidator#validateMatch(org.eclipse.emf.compare.Match)
- */
- @Override
- protected void validateMatch(Match match) {
- final EObject left = match.getLeft();
- final EObject right = match.getRight();
- final EObject origin = match.getOrigin();
-
- // Make sure that we haven't already seen a match with this id.
- final String referenceID;
- if (left != null) {
- referenceID = getID(left);
- } else if (right != null) {
- referenceID = getID(right);
- } else {
- referenceID = getID(origin);
- }
- assertFalse(idToMatch.containsKey(referenceID));
- idToMatch.put(referenceID, match);
-
- if (left != null && right != null && origin != null) {
- assertEquals(getID(left), getID(right));
- assertEquals(getID(left), getID(origin));
- } else if (left != null && right != null) {
- assertEquals(getID(left), getID(right));
- } else if (left != null && origin != null) {
- assertEquals(getID(left), getID(origin));
- } else if (right != null && origin != null) {
- assertEquals(getID(right), getID(origin));
- }
- }
-
- /**
- * Retrieves the identifier of the given EObject. We'll consider the attribute ID first, then the XMI ID,
- * and simply return <code>null</code> if none are set.
- *
- * @param eObject
- * The EObject for which we need an identifier.
- * @return The unique identifier of the given EObject if any, <code>null</code> if none.
- */
- protected String getID(EObject eObject) {
- String identifier = EcoreUtil.getID(eObject);
- if (identifier == null) {
- final Resource eObjectResource = eObject.eResource();
- if (eObjectResource instanceof XMIResource) {
- identifier = ((XMIResource)eObjectResource).getID(eObject);
- }
- }
- return identifier;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import com.google.common.collect.Maps;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+
+/**
+ * This implementation of a {@link AbstractMatchValidator} expects that all sides of a given {@link Match}
+ * share the same identifier according to the semantics of {@link #getID(EObject)}.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class IdentifierMatchValidator extends AbstractMatchValidator {
+ /** "Remember" which Match corresponds to which ID. */
+ private Map<String, Match> idToMatch = Maps.newHashMap();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.tests.framework.AbstractMatchValidator#validate(org.eclipse.emf.compare.Comparison)
+ */
+ @Override
+ public void validate(Comparison comparison) {
+ super.validate(comparison);
+ idToMatch.clear();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.tests.framework.AbstractMatchValidator#validateMatch(org.eclipse.emf.compare.Match)
+ */
+ @Override
+ protected void validateMatch(Match match) {
+ final EObject left = match.getLeft();
+ final EObject right = match.getRight();
+ final EObject origin = match.getOrigin();
+
+ // Make sure that we haven't already seen a match with this id.
+ final String referenceID;
+ if (left != null) {
+ referenceID = getID(left);
+ } else if (right != null) {
+ referenceID = getID(right);
+ } else {
+ referenceID = getID(origin);
+ }
+ assertFalse(idToMatch.containsKey(referenceID));
+ idToMatch.put(referenceID, match);
+
+ if (left != null && right != null && origin != null) {
+ assertEquals(getID(left), getID(right));
+ assertEquals(getID(left), getID(origin));
+ } else if (left != null && right != null) {
+ assertEquals(getID(left), getID(right));
+ } else if (left != null && origin != null) {
+ assertEquals(getID(left), getID(origin));
+ } else if (right != null && origin != null) {
+ assertEquals(getID(right), getID(origin));
+ }
+ }
+
+ /**
+ * Retrieves the identifier of the given EObject. We'll consider the attribute ID first, then the XMI ID,
+ * and simply return <code>null</code> if none are set.
+ *
+ * @param eObject
+ * The EObject for which we need an identifier.
+ * @return The unique identifier of the given EObject if any, <code>null</code> if none.
+ */
+ protected String getID(EObject eObject) {
+ String identifier = EcoreUtil.getID(eObject);
+ if (identifier == null) {
+ final Resource eObjectResource = eObject.eResource();
+ if (eObjectResource instanceof XMIResource) {
+ identifier = ((XMIResource)eObjectResource).getID(eObject);
+ }
+ }
+ return identifier;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/NotifierTuple.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/NotifierTuple.java
index 7d107fc70..f357cd125 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/NotifierTuple.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/NotifierTuple.java
@@ -1,74 +1,74 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework;
-
-import org.eclipse.emf.common.notify.Notifier;
-
-/**
- * This represents a "use case" as EMF Compare understands it, i.e : two or three notifiers which are to be
- * compared and merged.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class NotifierTuple {
- /** "Left" notifier of this comparison. */
- private Notifier left;
-
- /** "Right" notifier of this comparison. */
- private Notifier right;
-
- /** common ancestor of {@link #left} and {@link #right}. */
- private Notifier origin;
-
- /**
- * Constructs a tuple given its content.
- *
- * @param left
- * The left Notifier.
- * @param right
- * The right Notifier.
- * @param origin
- * The Notifier that is to be considered as the common ancestor of <code>left</code> and
- * <code>right</code>.
- */
- public NotifierTuple(Notifier left, Notifier right, Notifier origin) {
- this.left = left;
- this.right = right;
- this.origin = origin;
- }
-
- /**
- * Returns the left Notifier of this comparison.
- *
- * @return The left Notifier of this comparison.
- */
- public Notifier getLeft() {
- return left;
- }
-
- /**
- * Returns the right Notifier of this comparison.
- *
- * @return The right Notifier of this comparison.
- */
- public Notifier getRight() {
- return right;
- }
-
- /**
- * Returns the origin Notifier of this comparison.
- *
- * @return The origin Notifier of this comparison.
- */
- public Notifier getOrigin() {
- return origin;
- }
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework;
+
+import org.eclipse.emf.common.notify.Notifier;
+
+/**
+ * This represents a "use case" as EMF Compare understands it, i.e : two or three notifiers which are to be
+ * compared and merged.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class NotifierTuple {
+ /** "Left" notifier of this comparison. */
+ private Notifier left;
+
+ /** "Right" notifier of this comparison. */
+ private Notifier right;
+
+ /** common ancestor of {@link #left} and {@link #right}. */
+ private Notifier origin;
+
+ /**
+ * Constructs a tuple given its content.
+ *
+ * @param left
+ * The left Notifier.
+ * @param right
+ * The right Notifier.
+ * @param origin
+ * The Notifier that is to be considered as the common ancestor of <code>left</code> and
+ * <code>right</code>.
+ */
+ public NotifierTuple(Notifier left, Notifier right, Notifier origin) {
+ this.left = left;
+ this.right = right;
+ this.origin = origin;
+ }
+
+ /**
+ * Returns the left Notifier of this comparison.
+ *
+ * @return The left Notifier of this comparison.
+ */
+ public Notifier getLeft() {
+ return left;
+ }
+
+ /**
+ * Returns the right Notifier of this comparison.
+ *
+ * @return The right Notifier of this comparison.
+ */
+ public Notifier getRight() {
+ return right;
+ }
+
+ /**
+ * Returns the origin Notifier of this comparison.
+ *
+ * @return The origin Notifier of this comparison.
+ */
+ public Notifier getOrigin() {
+ return origin;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/EMFCompareTestRunner.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/EMFCompareTestRunner.java
index 8c4d59edf..3169b6e87 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/EMFCompareTestRunner.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/EMFCompareTestRunner.java
@@ -1,76 +1,76 @@
-/**
- * Copyright (c) 2011, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
-import org.eclipse.emf.compare.tests.framework.junit.internal.UseCaseRunner;
-import org.junit.Assert;
-import org.junit.runner.Description;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.ParentRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
-/**
- * This will be used to launch various tests on a given set of models.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public final class EMFCompareTestRunner extends ParentRunner<Runner> {
- /** Instantiates our runner. */
- public EMFCompareTestRunner(Class<?> clazz) throws InitializationError {
- super(clazz);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.BlockJUnit4ClassRunner#getChildren()
- */
- @Override
- protected List<Runner> getChildren() {
- final List<Runner> runners = new ArrayList<Runner>();
- for (FrameworkMethod child : getTestClass().getAnnotatedMethods(UseCase.class)) {
- try {
- runners.add(new UseCaseRunner(getTestClass().getJavaClass(), child));
- } catch (InitializationError e) {
- e.printStackTrace();
- Assert.fail(e.getMessage());
- }
- }
- return runners;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.ParentRunner#describeChild(java.lang.Object)
- */
- @Override
- protected Description describeChild(Runner child) {
- return child.getDescription();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.ParentRunner#runChild(java.lang.Object,
- * org.junit.runner.notification.RunNotifier)
- */
- @Override
- protected void runChild(Runner runner, final RunNotifier notifier) {
- runner.run(notifier);
- }
-}
+/**
+ * Copyright (c) 2011, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
+import org.eclipse.emf.compare.tests.framework.junit.internal.UseCaseRunner;
+import org.junit.Assert;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * This will be used to launch various tests on a given set of models.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public final class EMFCompareTestRunner extends ParentRunner<Runner> {
+ /** Instantiates our runner. */
+ public EMFCompareTestRunner(Class<?> clazz) throws InitializationError {
+ super(clazz);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.BlockJUnit4ClassRunner#getChildren()
+ */
+ @Override
+ protected List<Runner> getChildren() {
+ final List<Runner> runners = new ArrayList<Runner>();
+ for (FrameworkMethod child : getTestClass().getAnnotatedMethods(UseCase.class)) {
+ try {
+ runners.add(new UseCaseRunner(getTestClass().getJavaClass(), child));
+ } catch (InitializationError e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+ return runners;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.ParentRunner#describeChild(java.lang.Object)
+ */
+ @Override
+ protected Description describeChild(Runner child) {
+ return child.getDescription();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.ParentRunner#runChild(java.lang.Object,
+ * org.junit.runner.notification.RunNotifier)
+ */
+ @Override
+ protected void runChild(Runner runner, final RunNotifier notifier) {
+ runner.run(notifier);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/BeforeMatch.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/BeforeMatch.java
index 7fa4ae0b9..7aac866a0 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/BeforeMatch.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/BeforeMatch.java
@@ -1,40 +1,40 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
-
-/**
- * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
- * called before executing the matching process on a given NotifierTuple.
- * <p>
- * Methods annotated with {@link BeforeMatch} should declare a single argument of type {@link NotifierTuple}.
- * </p>
- * <p>
- * Methods annotated as {@link BeforeMatch} will never be called if there are no methods annotated
- * {@link MatchTest} in the same test class.
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface BeforeMatch {
- // Empty implementation
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
+
+/**
+ * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
+ * called before executing the matching process on a given NotifierTuple.
+ * <p>
+ * Methods annotated with {@link BeforeMatch} should declare a single argument of type {@link NotifierTuple}.
+ * </p>
+ * <p>
+ * Methods annotated as {@link BeforeMatch} will never be called if there are no methods annotated
+ * {@link MatchTest} in the same test class.
+ * </p>
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface BeforeMatch {
+ // Empty implementation
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/ConflictTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/ConflictTest.java
index 1f3fdc399..065dfb4a6 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/ConflictTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/ConflictTest.java
@@ -1,65 +1,65 @@
-/**
- * Copyright (c) 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.diff.DefaultDiffEngine;
-import org.eclipse.emf.compare.diff.IDiffEngine;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
-
-/**
- * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
- * called after executing the conflict detection process on a given NotifierTuple.
- * <p>
- * Methods annotated with {@link DiffTest} should declare two arguments of type {@link IComparisonScope} and
- * {@link Comparison}.
- * </p>
- * <p>
- * This annotation accepts three additional parameters, matchEngine, diffEngine and scope, which allow users
- * to specify the {@link IMatchEngine}, {@link IDiffEngine} and {@link IComparisonScope} classes that are to
- * be used by the framework.
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface ConflictTest {
- /**
- * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
- * have a public no-arg constructor.
- */
- Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
-
- /**
- * Optionally specifies the diff engine we are to use for this test. We're expecting the given class to
- * have a public no-arg constructor.
- */
- Class<? extends IDiffEngine> diffEngine() default DefaultDiffEngine.class;
-
- /**
- * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
- * public constructor taking three {@link Notifier}s as parameters.
- */
- Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
-}
+/**
+ * Copyright (c) 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.diff.DefaultDiffEngine;
+import org.eclipse.emf.compare.diff.IDiffEngine;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
+
+/**
+ * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
+ * called after executing the conflict detection process on a given NotifierTuple.
+ * <p>
+ * Methods annotated with {@link DiffTest} should declare two arguments of type {@link IComparisonScope} and
+ * {@link Comparison}.
+ * </p>
+ * <p>
+ * This annotation accepts three additional parameters, matchEngine, diffEngine and scope, which allow users
+ * to specify the {@link IMatchEngine}, {@link IDiffEngine} and {@link IComparisonScope} classes that are to
+ * be used by the framework.
+ * </p>
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface ConflictTest {
+ /**
+ * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
+ * have a public no-arg constructor.
+ */
+ Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
+
+ /**
+ * Optionally specifies the diff engine we are to use for this test. We're expecting the given class to
+ * have a public no-arg constructor.
+ */
+ Class<? extends IDiffEngine> diffEngine() default DefaultDiffEngine.class;
+
+ /**
+ * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
+ * public constructor taking three {@link Notifier}s as parameters.
+ */
+ Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/DiffTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/DiffTest.java
index 6b4c9117f..f5705c0ef 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/DiffTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/DiffTest.java
@@ -1,65 +1,65 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.diff.DefaultDiffEngine;
-import org.eclipse.emf.compare.diff.IDiffEngine;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
-
-/**
- * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
- * called after executing the differencing process on a given NotifierTuple.
- * <p>
- * Methods annotated with {@link DiffTest} should declare two arguments of type {@link IComparisonScope} and
- * {@link Comparison}.
- * </p>
- * <p>
- * This annotation accepts three additional parameters, matchEngine, diffEngine and scope, which allow users
- * to specify the {@link IMatchEngine}, {@link IDiffEngine} and {@link IComparisonScope} classes that are to
- * be used by the framework.
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface DiffTest {
- /**
- * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
- * have a public no-arg constructor.
- */
- Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
-
- /**
- * Optionally specifies the diff engine we are to use for this test. We're expecting the given class to
- * have a public no-arg constructor.
- */
- Class<? extends IDiffEngine> diffEngine() default DefaultDiffEngine.class;
-
- /**
- * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
- * public constructor taking three {@link Notifier}s as parameters.
- */
- Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.diff.DefaultDiffEngine;
+import org.eclipse.emf.compare.diff.IDiffEngine;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
+
+/**
+ * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
+ * called after executing the differencing process on a given NotifierTuple.
+ * <p>
+ * Methods annotated with {@link DiffTest} should declare two arguments of type {@link IComparisonScope} and
+ * {@link Comparison}.
+ * </p>
+ * <p>
+ * This annotation accepts three additional parameters, matchEngine, diffEngine and scope, which allow users
+ * to specify the {@link IMatchEngine}, {@link IDiffEngine} and {@link IComparisonScope} classes that are to
+ * be used by the framework.
+ * </p>
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface DiffTest {
+ /**
+ * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
+ * have a public no-arg constructor.
+ */
+ Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
+
+ /**
+ * Optionally specifies the diff engine we are to use for this test. We're expecting the given class to
+ * have a public no-arg constructor.
+ */
+ Class<? extends IDiffEngine> diffEngine() default DefaultDiffEngine.class;
+
+ /**
+ * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
+ * public constructor taking three {@link Notifier}s as parameters.
+ */
+ Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/MatchTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/MatchTest.java
index 95fe46240..db8dc96c2 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/MatchTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/MatchTest.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
-
-/**
- * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
- * called after executing the matching process on a given NotifierTuple.
- * <p>
- * Methods annotated with {@link MatchTest} should declare two arguments of type {@link IComparisonScope} and
- * {@link Comparison}.
- * </p>
- * <p>
- * This annotation accepts two additional parameters, engine and scope, which allow users to specify the
- * {@link IMatchEngine} and {@link IComparisonScope} classes that are to be used by the framework.
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface MatchTest {
- /**
- * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
- * have a public no-arg constructor.
- */
- Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
-
- /**
- * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
- * public constructor taking three {@link Notifier}s as parameters.
- */
- Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
+
+/**
+ * This annotation can be used to tell the {@link EMFCompareTestRunner} that a particular method has to be
+ * called after executing the matching process on a given NotifierTuple.
+ * <p>
+ * Methods annotated with {@link MatchTest} should declare two arguments of type {@link IComparisonScope} and
+ * {@link Comparison}.
+ * </p>
+ * <p>
+ * This annotation accepts two additional parameters, engine and scope, which allow users to specify the
+ * {@link IMatchEngine} and {@link IComparisonScope} classes that are to be used by the framework.
+ * </p>
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface MatchTest {
+ /**
+ * Optionally specifies the match engine we are to use for this test. We're expecting the given class to
+ * have a public no-arg constructor.
+ */
+ Class<? extends IMatchEngine> matchEngine() default DefaultMatchEngine.class;
+
+ /**
+ * Optionally specifies the scope we are to use for this test. We're expecting the given class to have a
+ * public constructor taking three {@link Notifier}s as parameters.
+ */
+ Class<? extends IComparisonScope> scope() default DefaultComparisonScope.class;
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/UseCase.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/UseCase.java
index e584c0430..ecb61f031 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/UseCase.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/annotation/UseCase.java
@@ -1,32 +1,32 @@
-/**
- * Copyright (c) 2011, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-
-/**
- * This can be used to annotate {@link NotifierTuple}-returning methods so that they can be run as unit test.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Inherited
-public @interface UseCase {
- /** Name of this use case as displayed in the test results. */
- String value();
-}
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+
+/**
+ * This can be used to annotate {@link NotifierTuple}-returning methods so that they can be run as unit test.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface UseCase {
+ /** Name of this use case as displayed in the test results. */
+ String value();
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ConflictStatement.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ConflictStatement.java
index ffd1e9671..f1a5b1183 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ConflictStatement.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ConflictStatement.java
@@ -1,187 +1,187 @@
-/**
- * Copyright (c) 2013, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.Monitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.conflict.DefaultConflictDetector;
-import org.eclipse.emf.compare.conflict.IConflictDetector;
-import org.eclipse.emf.compare.diff.DefaultDiffEngine;
-import org.eclipse.emf.compare.diff.DiffBuilder;
-import org.eclipse.emf.compare.diff.IDiffEngine;
-import org.eclipse.emf.compare.match.DefaultComparisonFactory;
-import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
-import org.eclipse.emf.compare.match.eobject.EditionDistance;
-import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * This implementation of a {@link Statement} allows us to call methods annotated with {@link ConflictTest} on
- * the result of a conflict detection process.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class ConflictStatement extends Statement {
- /** Target of the test. */
- private final Object testObject;
-
- /**
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
- */
- private final ResultStatement<NotifierTuple> tupleStatement;
-
- /** The actual test method. */
- private final FrameworkMethod test;
-
- /**
- * Instantiates our statement given its target object and tuple as well as the test methods.
- *
- * @param testObject
- * Target of the test.
- * @param tupleStatement
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match
- * and diff.
- * @param test
- * The actual test method.
- */
- public ConflictStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
- FrameworkMethod test) {
- this.testObject = testObject;
- this.tupleStatement = tupleStatement;
- this.test = test;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.model.Statement#evaluate()
- */
- @Override
- public void evaluate() throws Throwable {
- tupleStatement.evaluate();
- final NotifierTuple tuple = tupleStatement.getResult();
-
- final ConflictTest annotation = test.getAnnotation(ConflictTest.class);
- final IComparisonScope scope = createComparisonScope(tuple, annotation);
- final IMatchEngine matchEngine = createMatchEngine(annotation);
- final IDiffEngine diffEngine = createDiffEngine(annotation);
- final IConflictDetector detector = new DefaultConflictDetector();
- final Monitor monitor = new BasicMonitor();
-
- final Comparison comparison = matchEngine.match(scope, new BasicMonitor());
- diffEngine.diff(comparison, new BasicMonitor());
- detector.detect(comparison, monitor);
-
- test.invokeExplosively(testObject, scope, comparison);
- }
-
- /**
- * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
- * the {@link DefaultMatchEngine default} otherwise.
- *
- * @param annotation
- * The annotation on which is defined the match engine we are to use.
- * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
- * the {@link DefaultMatchEngine} otherwise.
- */
- private static IMatchEngine createMatchEngine(ConflictTest annotation) {
- final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
-
- IMatchEngine engine = null;
- try {
- engine = engineClass.newInstance();
- } catch (InstantiationException e) {
- // Swallow : we'll create a default engine instead.
- } catch (IllegalAccessException e) {
- // Swallow : we'll create a default engine instead.
- }
- if (engine == null) {
- final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
- .weightProvider(new EcoreWeightProvider()).build());
- final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
- engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- }
- return engine;
- }
-
- /**
- * Creates the diff engine specified by the given annotation if it has a public no-arg constructor, use
- * the {@link DefaultDiffEngine default} otherwise.
- *
- * @param annotation
- * The annotation on which is defined the diff engine we are to use.
- * @return An instance of the specified diff engine if it has a public no-arg constructor; an instance of
- * the {@link DefaultDiffEngine} otherwise.
- */
- private static IDiffEngine createDiffEngine(ConflictTest annotation) {
- final Class<? extends IDiffEngine> engineClass = annotation.diffEngine();
-
- IDiffEngine engine = null;
- try {
- engine = engineClass.newInstance();
- } catch (InstantiationException e) {
- // Swallow : we'll create a default engine instead.
- } catch (IllegalAccessException e) {
- // Swallow : we'll create a default engine instead.
- }
- if (engine == null) {
- engine = new DefaultDiffEngine(new DiffBuilder());
- }
- return engine;
- }
-
- /**
- * Creates the comparison scope specified by the given annotation if it has a public constructor taking
- * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
- * otherwise.
- *
- * @param tuple
- * The tuple for which we need a comparison scope.
- * @param annotation
- * The annotation on which is specified the desired scope's class.
- * @return An instance of the specified comparison scope it it has the expected constructor, an instance
- * of the {@link DefaultComparisonScope} otherwise.
- */
- private static IComparisonScope createComparisonScope(NotifierTuple tuple, ConflictTest annotation) {
- final Class<? extends IComparisonScope> scopeClass = annotation.scope();
-
- IComparisonScope scope = null;
- try {
- final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
- Notifier.class, Notifier.class, Notifier.class);
- scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
- // we're swallowing all exceptions, we simply catch everything.
- } catch (Exception e) {
- // CHECKSTYLE:ON
- // Swallow : we'll create a default engine instead.
- }
- if (scope == null) {
- scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- }
- return scope;
- }
-}
+/**
+ * Copyright (c) 2013, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.conflict.DefaultConflictDetector;
+import org.eclipse.emf.compare.conflict.IConflictDetector;
+import org.eclipse.emf.compare.diff.DefaultDiffEngine;
+import org.eclipse.emf.compare.diff.DiffBuilder;
+import org.eclipse.emf.compare.diff.IDiffEngine;
+import org.eclipse.emf.compare.match.DefaultComparisonFactory;
+import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
+import org.eclipse.emf.compare.match.eobject.EditionDistance;
+import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * This implementation of a {@link Statement} allows us to call methods annotated with {@link ConflictTest} on
+ * the result of a conflict detection process.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class ConflictStatement extends Statement {
+ /** Target of the test. */
+ private final Object testObject;
+
+ /**
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
+ */
+ private final ResultStatement<NotifierTuple> tupleStatement;
+
+ /** The actual test method. */
+ private final FrameworkMethod test;
+
+ /**
+ * Instantiates our statement given its target object and tuple as well as the test methods.
+ *
+ * @param testObject
+ * Target of the test.
+ * @param tupleStatement
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match
+ * and diff.
+ * @param test
+ * The actual test method.
+ */
+ public ConflictStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
+ FrameworkMethod test) {
+ this.testObject = testObject;
+ this.tupleStatement = tupleStatement;
+ this.test = test;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.model.Statement#evaluate()
+ */
+ @Override
+ public void evaluate() throws Throwable {
+ tupleStatement.evaluate();
+ final NotifierTuple tuple = tupleStatement.getResult();
+
+ final ConflictTest annotation = test.getAnnotation(ConflictTest.class);
+ final IComparisonScope scope = createComparisonScope(tuple, annotation);
+ final IMatchEngine matchEngine = createMatchEngine(annotation);
+ final IDiffEngine diffEngine = createDiffEngine(annotation);
+ final IConflictDetector detector = new DefaultConflictDetector();
+ final Monitor monitor = new BasicMonitor();
+
+ final Comparison comparison = matchEngine.match(scope, new BasicMonitor());
+ diffEngine.diff(comparison, new BasicMonitor());
+ detector.detect(comparison, monitor);
+
+ test.invokeExplosively(testObject, scope, comparison);
+ }
+
+ /**
+ * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
+ * the {@link DefaultMatchEngine default} otherwise.
+ *
+ * @param annotation
+ * The annotation on which is defined the match engine we are to use.
+ * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
+ * the {@link DefaultMatchEngine} otherwise.
+ */
+ private static IMatchEngine createMatchEngine(ConflictTest annotation) {
+ final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
+
+ IMatchEngine engine = null;
+ try {
+ engine = engineClass.newInstance();
+ } catch (InstantiationException e) {
+ // Swallow : we'll create a default engine instead.
+ } catch (IllegalAccessException e) {
+ // Swallow : we'll create a default engine instead.
+ }
+ if (engine == null) {
+ final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
+ .weightProvider(new EcoreWeightProvider()).build());
+ final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
+ engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ }
+ return engine;
+ }
+
+ /**
+ * Creates the diff engine specified by the given annotation if it has a public no-arg constructor, use
+ * the {@link DefaultDiffEngine default} otherwise.
+ *
+ * @param annotation
+ * The annotation on which is defined the diff engine we are to use.
+ * @return An instance of the specified diff engine if it has a public no-arg constructor; an instance of
+ * the {@link DefaultDiffEngine} otherwise.
+ */
+ private static IDiffEngine createDiffEngine(ConflictTest annotation) {
+ final Class<? extends IDiffEngine> engineClass = annotation.diffEngine();
+
+ IDiffEngine engine = null;
+ try {
+ engine = engineClass.newInstance();
+ } catch (InstantiationException e) {
+ // Swallow : we'll create a default engine instead.
+ } catch (IllegalAccessException e) {
+ // Swallow : we'll create a default engine instead.
+ }
+ if (engine == null) {
+ engine = new DefaultDiffEngine(new DiffBuilder());
+ }
+ return engine;
+ }
+
+ /**
+ * Creates the comparison scope specified by the given annotation if it has a public constructor taking
+ * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
+ * otherwise.
+ *
+ * @param tuple
+ * The tuple for which we need a comparison scope.
+ * @param annotation
+ * The annotation on which is specified the desired scope's class.
+ * @return An instance of the specified comparison scope it it has the expected constructor, an instance
+ * of the {@link DefaultComparisonScope} otherwise.
+ */
+ private static IComparisonScope createComparisonScope(NotifierTuple tuple, ConflictTest annotation) {
+ final Class<? extends IComparisonScope> scopeClass = annotation.scope();
+
+ IComparisonScope scope = null;
+ try {
+ final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
+ Notifier.class, Notifier.class, Notifier.class);
+ scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
+ // we're swallowing all exceptions, we simply catch everything.
+ } catch (Exception e) {
+ // CHECKSTYLE:ON
+ // Swallow : we'll create a default engine instead.
+ }
+ if (scope == null) {
+ scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ }
+ return scope;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/DiffStatement.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/DiffStatement.java
index 656afed47..7fb9238a2 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/DiffStatement.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/DiffStatement.java
@@ -1,180 +1,180 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.diff.DefaultDiffEngine;
-import org.eclipse.emf.compare.diff.DiffBuilder;
-import org.eclipse.emf.compare.diff.IDiffEngine;
-import org.eclipse.emf.compare.match.DefaultComparisonFactory;
-import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
-import org.eclipse.emf.compare.match.eobject.EditionDistance;
-import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * This implementation of a {@link Statement} allows us to call methods annotated with {@link DiffTest} on the
- * result of a Differencing process.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class DiffStatement extends Statement {
- /** Target of the test. */
- private final Object testObject;
-
- /**
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
- */
- private final ResultStatement<NotifierTuple> tupleStatement;
-
- /** The actual test method. */
- private final FrameworkMethod test;
-
- /**
- * Instantiates our statement given its target object and tuple as well as the test methods.
- *
- * @param testObject
- * Target of the test.
- * @param tupleStatement
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match
- * and diff.
- * @param test
- * The actual test method.
- */
- public DiffStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
- FrameworkMethod test) {
- this.testObject = testObject;
- this.tupleStatement = tupleStatement;
- this.test = test;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.model.Statement#evaluate()
- */
- @Override
- public void evaluate() throws Throwable {
- tupleStatement.evaluate();
- final NotifierTuple tuple = tupleStatement.getResult();
-
- final DiffTest annotation = test.getAnnotation(DiffTest.class);
- final IComparisonScope scope = createComparisonScope(tuple, annotation);
- final IMatchEngine matchEngine = createMatchEngine(annotation);
- final IDiffEngine diffEngine = createDiffEngine(annotation);
- final Comparison comparison = matchEngine.match(scope, new BasicMonitor());
- diffEngine.diff(comparison, new BasicMonitor());
-
- test.invokeExplosively(testObject, scope, comparison);
- }
-
- /**
- * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
- * the {@link DefaultMatchEngine default} otherwise.
- *
- * @param annotation
- * The annotation on which is defined the match engine we are to use.
- * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
- * the {@link DefaultMatchEngine} otherwise.
- */
- private static IMatchEngine createMatchEngine(DiffTest annotation) {
- final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
-
- IMatchEngine engine = null;
- try {
- engine = engineClass.newInstance();
- } catch (InstantiationException e) {
- // Swallow : we'll create a default engine instead.
- } catch (IllegalAccessException e) {
- // Swallow : we'll create a default engine instead.
- }
- if (engine == null) {
- final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
- .weightProvider(new EcoreWeightProvider()).build());
- final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
- engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- }
- return engine;
- }
-
- /**
- * Creates the diff engine specified by the given annotation if it has a public no-arg constructor, use
- * the {@link DefaultDiffEngine default} otherwise.
- *
- * @param annotation
- * The annotation on which is defined the diff engine we are to use.
- * @return An instance of the specified diff engine if it has a public no-arg constructor; an instance of
- * the {@link DefaultDiffEngine} otherwise.
- */
- private static IDiffEngine createDiffEngine(DiffTest annotation) {
- final Class<? extends IDiffEngine> engineClass = annotation.diffEngine();
-
- IDiffEngine engine = null;
- try {
- engine = engineClass.newInstance();
- } catch (InstantiationException e) {
- // Swallow : we'll create a default engine instead.
- } catch (IllegalAccessException e) {
- // Swallow : we'll create a default engine instead.
- }
- if (engine == null) {
- engine = new DefaultDiffEngine(new DiffBuilder());
- }
- return engine;
- }
-
- /**
- * Creates the comparison scope specified by the given annotation if it has a public constructor taking
- * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
- * otherwise.
- *
- * @param tuple
- * The tuple for which we need a comparison scope.
- * @param annotation
- * The annotation on which is specified the desired scope's class.
- * @return An instance of the specified comparison scope it it has the expected constructor, an instance
- * of the {@link DefaultComparisonScope} otherwise.
- */
- private static IComparisonScope createComparisonScope(NotifierTuple tuple, DiffTest annotation) {
- final Class<? extends IComparisonScope> scopeClass = annotation.scope();
-
- IComparisonScope scope = null;
- try {
- final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
- Notifier.class, Notifier.class, Notifier.class);
- scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
- // we're swallowing all exceptions, we simply catch everything.
- } catch (Exception e) {
- // CHECKSTYLE:ON
- // Swallow : we'll create a default engine instead.
- }
- if (scope == null) {
- scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- }
- return scope;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.diff.DefaultDiffEngine;
+import org.eclipse.emf.compare.diff.DiffBuilder;
+import org.eclipse.emf.compare.diff.IDiffEngine;
+import org.eclipse.emf.compare.match.DefaultComparisonFactory;
+import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
+import org.eclipse.emf.compare.match.eobject.EditionDistance;
+import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * This implementation of a {@link Statement} allows us to call methods annotated with {@link DiffTest} on the
+ * result of a Differencing process.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class DiffStatement extends Statement {
+ /** Target of the test. */
+ private final Object testObject;
+
+ /**
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
+ */
+ private final ResultStatement<NotifierTuple> tupleStatement;
+
+ /** The actual test method. */
+ private final FrameworkMethod test;
+
+ /**
+ * Instantiates our statement given its target object and tuple as well as the test methods.
+ *
+ * @param testObject
+ * Target of the test.
+ * @param tupleStatement
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match
+ * and diff.
+ * @param test
+ * The actual test method.
+ */
+ public DiffStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
+ FrameworkMethod test) {
+ this.testObject = testObject;
+ this.tupleStatement = tupleStatement;
+ this.test = test;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.model.Statement#evaluate()
+ */
+ @Override
+ public void evaluate() throws Throwable {
+ tupleStatement.evaluate();
+ final NotifierTuple tuple = tupleStatement.getResult();
+
+ final DiffTest annotation = test.getAnnotation(DiffTest.class);
+ final IComparisonScope scope = createComparisonScope(tuple, annotation);
+ final IMatchEngine matchEngine = createMatchEngine(annotation);
+ final IDiffEngine diffEngine = createDiffEngine(annotation);
+ final Comparison comparison = matchEngine.match(scope, new BasicMonitor());
+ diffEngine.diff(comparison, new BasicMonitor());
+
+ test.invokeExplosively(testObject, scope, comparison);
+ }
+
+ /**
+ * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
+ * the {@link DefaultMatchEngine default} otherwise.
+ *
+ * @param annotation
+ * The annotation on which is defined the match engine we are to use.
+ * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
+ * the {@link DefaultMatchEngine} otherwise.
+ */
+ private static IMatchEngine createMatchEngine(DiffTest annotation) {
+ final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
+
+ IMatchEngine engine = null;
+ try {
+ engine = engineClass.newInstance();
+ } catch (InstantiationException e) {
+ // Swallow : we'll create a default engine instead.
+ } catch (IllegalAccessException e) {
+ // Swallow : we'll create a default engine instead.
+ }
+ if (engine == null) {
+ final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
+ .weightProvider(new EcoreWeightProvider()).build());
+ final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
+ engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ }
+ return engine;
+ }
+
+ /**
+ * Creates the diff engine specified by the given annotation if it has a public no-arg constructor, use
+ * the {@link DefaultDiffEngine default} otherwise.
+ *
+ * @param annotation
+ * The annotation on which is defined the diff engine we are to use.
+ * @return An instance of the specified diff engine if it has a public no-arg constructor; an instance of
+ * the {@link DefaultDiffEngine} otherwise.
+ */
+ private static IDiffEngine createDiffEngine(DiffTest annotation) {
+ final Class<? extends IDiffEngine> engineClass = annotation.diffEngine();
+
+ IDiffEngine engine = null;
+ try {
+ engine = engineClass.newInstance();
+ } catch (InstantiationException e) {
+ // Swallow : we'll create a default engine instead.
+ } catch (IllegalAccessException e) {
+ // Swallow : we'll create a default engine instead.
+ }
+ if (engine == null) {
+ engine = new DefaultDiffEngine(new DiffBuilder());
+ }
+ return engine;
+ }
+
+ /**
+ * Creates the comparison scope specified by the given annotation if it has a public constructor taking
+ * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
+ * otherwise.
+ *
+ * @param tuple
+ * The tuple for which we need a comparison scope.
+ * @param annotation
+ * The annotation on which is specified the desired scope's class.
+ * @return An instance of the specified comparison scope it it has the expected constructor, an instance
+ * of the {@link DefaultComparisonScope} otherwise.
+ */
+ private static IComparisonScope createComparisonScope(NotifierTuple tuple, DiffTest annotation) {
+ final Class<? extends IComparisonScope> scopeClass = annotation.scope();
+
+ IComparisonScope scope = null;
+ try {
+ final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
+ Notifier.class, Notifier.class, Notifier.class);
+ scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
+ // we're swallowing all exceptions, we simply catch everything.
+ } catch (Exception e) {
+ // CHECKSTYLE:ON
+ // Swallow : we'll create a default engine instead.
+ }
+ if (scope == null) {
+ scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ }
+ return scope;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/MatchStatement.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/MatchStatement.java
index c1772b4ec..67c881c7c 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/MatchStatement.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/MatchStatement.java
@@ -1,159 +1,159 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.match.DefaultComparisonFactory;
-import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
-import org.eclipse.emf.compare.match.eobject.EditionDistance;
-import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * This implementation of a {@link Statement} allows us to call methods annotated with {@link MatchTest} on
- * the result of a Matching process.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class MatchStatement extends Statement {
- /** Target of the test. */
- private final Object testObject;
-
- /**
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
- */
- private final ResultStatement<NotifierTuple> tupleStatement;
-
- /** The methods to call before the match, if any. */
- private final List<FrameworkMethod> beforeTest;
-
- /** The actual test method. */
- private final FrameworkMethod test;
-
- /**
- * Instantiates our statement given its target object and tuple as well as the befores and test methods.
- *
- * @param testObject
- * Target of the test.
- * @param tupleStatement
- * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
- * @param beforeTest
- * If there were any method to call before launching the match, this will contain them.
- * @param test
- * The actual test method.
- */
- public MatchStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
- List<FrameworkMethod> beforeTest, FrameworkMethod test) {
- this.testObject = testObject;
- this.tupleStatement = tupleStatement;
- this.beforeTest = beforeTest;
- this.test = test;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.model.Statement#evaluate()
- */
- @Override
- public void evaluate() throws Throwable {
- tupleStatement.evaluate();
- final NotifierTuple tuple = tupleStatement.getResult();
-
- for (FrameworkMethod before : beforeTest) {
- before.invokeExplosively(testObject, tuple);
- }
-
- final MatchTest annotation = test.getAnnotation(MatchTest.class);
- final IMatchEngine engine = createMatchEngine(annotation);
- final IComparisonScope scope = createComparisonScope(tuple, annotation);
- final Comparison comparison = engine.match(scope, new BasicMonitor());
-
- test.invokeExplosively(testObject, scope, comparison);
- }
-
- /**
- * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
- * the {@link DefaultMatchEngine default} otherwise.
- *
- * @param annotation
- * The annotation on which is defined the match engine we are to use.
- * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
- * the {@link DefaultMatchEngine} otherwise.
- */
- private static IMatchEngine createMatchEngine(MatchTest annotation) {
- final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
-
- IMatchEngine engine = null;
- try {
- engine = engineClass.newInstance();
- } catch (InstantiationException e) {
- // Swallow : we'll create a default engine instead.
- } catch (IllegalAccessException e) {
- // Swallow : we'll create a default engine instead.
- }
- if (engine == null) {
- final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
- .weightProvider(new EcoreWeightProvider()).build());
- final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
- engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- }
- return engine;
- }
-
- /**
- * Creates the comparison scope specified by the given annotation if it has a public constructor taking
- * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
- * otherwise.
- *
- * @param tuple
- * The tuple for which we need a comparison scope.
- * @param annotation
- * The annotation on which is specified the desired scope's class.
- * @return An instance of the specified comparison scope it it has the expected constructor, an instance
- * of the {@link DefaultComparisonScope} otherwise.
- */
- private static IComparisonScope createComparisonScope(NotifierTuple tuple, MatchTest annotation) {
- final Class<? extends IComparisonScope> scopeClass = annotation.scope();
-
- IComparisonScope scope = null;
- try {
- final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
- Notifier.class, Notifier.class, Notifier.class);
- scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
- // we're swallowing all exceptions, we simply catch everything.
- } catch (Exception e) {
- // CHECKSTYLE:ON
- // Swallow : we'll create a default engine instead.
- }
- if (scope == null) {
- scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
- }
- return scope;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.match.DefaultComparisonFactory;
+import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.match.eobject.EcoreWeightProvider;
+import org.eclipse.emf.compare.match.eobject.EditionDistance;
+import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * This implementation of a {@link Statement} allows us to call methods annotated with {@link MatchTest} on
+ * the result of a Matching process.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class MatchStatement extends Statement {
+ /** Target of the test. */
+ private final Object testObject;
+
+ /**
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
+ */
+ private final ResultStatement<NotifierTuple> tupleStatement;
+
+ /** The methods to call before the match, if any. */
+ private final List<FrameworkMethod> beforeTest;
+
+ /** The actual test method. */
+ private final FrameworkMethod test;
+
+ /**
+ * Instantiates our statement given its target object and tuple as well as the befores and test methods.
+ *
+ * @param testObject
+ * Target of the test.
+ * @param tupleStatement
+ * The statement that should be executed to retrieve the {@link NotifierTuple} we are to match.
+ * @param beforeTest
+ * If there were any method to call before launching the match, this will contain them.
+ * @param test
+ * The actual test method.
+ */
+ public MatchStatement(Object testObject, ResultStatement<NotifierTuple> tupleStatement,
+ List<FrameworkMethod> beforeTest, FrameworkMethod test) {
+ this.testObject = testObject;
+ this.tupleStatement = tupleStatement;
+ this.beforeTest = beforeTest;
+ this.test = test;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.model.Statement#evaluate()
+ */
+ @Override
+ public void evaluate() throws Throwable {
+ tupleStatement.evaluate();
+ final NotifierTuple tuple = tupleStatement.getResult();
+
+ for (FrameworkMethod before : beforeTest) {
+ before.invokeExplosively(testObject, tuple);
+ }
+
+ final MatchTest annotation = test.getAnnotation(MatchTest.class);
+ final IMatchEngine engine = createMatchEngine(annotation);
+ final IComparisonScope scope = createComparisonScope(tuple, annotation);
+ final Comparison comparison = engine.match(scope, new BasicMonitor());
+
+ test.invokeExplosively(testObject, scope, comparison);
+ }
+
+ /**
+ * Creates the match engine specified by the given annotation if it has a public no-arg constructor, use
+ * the {@link DefaultMatchEngine default} otherwise.
+ *
+ * @param annotation
+ * The annotation on which is defined the match engine we are to use.
+ * @return An instance of the specified match engine if it has a public no-arg constructor; an instance of
+ * the {@link DefaultMatchEngine} otherwise.
+ */
+ private static IMatchEngine createMatchEngine(MatchTest annotation) {
+ final Class<? extends IMatchEngine> engineClass = annotation.matchEngine();
+
+ IMatchEngine engine = null;
+ try {
+ engine = engineClass.newInstance();
+ } catch (InstantiationException e) {
+ // Swallow : we'll create a default engine instead.
+ } catch (IllegalAccessException e) {
+ // Swallow : we'll create a default engine instead.
+ }
+ if (engine == null) {
+ final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder()
+ .weightProvider(new EcoreWeightProvider()).build());
+ final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
+ engine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ }
+ return engine;
+ }
+
+ /**
+ * Creates the comparison scope specified by the given annotation if it has a public constructor taking
+ * three {@link Notifier}s as parameters. We'll return an instance of the {@link DefaultComparisonScope}
+ * otherwise.
+ *
+ * @param tuple
+ * The tuple for which we need a comparison scope.
+ * @param annotation
+ * The annotation on which is specified the desired scope's class.
+ * @return An instance of the specified comparison scope it it has the expected constructor, an instance
+ * of the {@link DefaultComparisonScope} otherwise.
+ */
+ private static IComparisonScope createComparisonScope(NotifierTuple tuple, MatchTest annotation) {
+ final Class<? extends IComparisonScope> scopeClass = annotation.scope();
+
+ IComparisonScope scope = null;
+ try {
+ final Constructor<? extends IComparisonScope> constructor = scopeClass.getConstructor(
+ Notifier.class, Notifier.class, Notifier.class);
+ scope = constructor.newInstance(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ // CHECKSTYLE:OFF invoking a constructor requires 7 catches. Since
+ // we're swallowing all exceptions, we simply catch everything.
+ } catch (Exception e) {
+ // CHECKSTYLE:ON
+ // Swallow : we'll create a default engine instead.
+ }
+ if (scope == null) {
+ scope = new DefaultComparisonScope(tuple.getLeft(), tuple.getRight(), tuple.getOrigin());
+ }
+ return scope;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ResultStatement.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ResultStatement.java
index 117eeb499..5e9844513 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ResultStatement.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/ResultStatement.java
@@ -1,30 +1,30 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import org.junit.runners.model.Statement;
-
-/**
- * This implementation of a Statement allows us to have a result on a JUnit work unit. We'll thus be able to
- * chain statements with the result of the preceding one.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- * @param <T>
- * Type of this statement's result.
- */
-public abstract class ResultStatement<T> extends Statement {
- /**
- * This will be used by the framework to retrieve the result of this statement's evaluation.
- *
- * @return The result of this statement's evaluation.
- */
- public abstract T getResult();
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import org.junit.runners.model.Statement;
+
+/**
+ * This implementation of a Statement allows us to have a result on a JUnit work unit. We'll thus be able to
+ * chain statements with the result of the preceding one.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ * @param <T>
+ * Type of this statement's result.
+ */
+public abstract class ResultStatement<T> extends Statement {
+ /**
+ * This will be used by the framework to retrieve the result of this statement's evaluation.
+ *
+ * @return The result of this statement's evaluation.
+ */
+ public abstract T getResult();
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseRunner.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseRunner.java
index e80c4a62b..df62d3972 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseRunner.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseRunner.java
@@ -1,127 +1,127 @@
-/**
- * Copyright (c) 2011, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.BeforeMatch;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
-import org.junit.Assert;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-/**
- * This particular implementation of a runner will be used to run the tests of a use case.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class UseCaseRunner extends BlockJUnit4ClassRunner {
- /** The method we are to invoke in order to retrieve the use case. */
- private FrameworkMethod useCase;
-
- /**
- * Instantiates our runner.
- *
- * @param clazz
- * The java class containing our tests.
- * @param useCaseMethod
- * The method we are to invoke in order to retrieve the use case.
- * @throws InitializationError
- * Thrown if the initialization failed somehow.
- */
- public UseCaseRunner(Class<?> clazz, FrameworkMethod useCaseMethod) throws InitializationError {
- super(clazz);
- this.useCase = useCaseMethod;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.BlockJUnit4ClassRunner#testName(org.junit.runners.model.FrameworkMethod)
- */
- @Override
- protected String testName(FrameworkMethod method) {
- // Replace the standard description to make it unique so that the JUnit view understands that these
- // are two distinct tests.
- final StringBuilder name = new StringBuilder();
- name.append(super.testName(method));
- name.append(" - "); //$NON-NLS-1$
- name.append(useCase.getAnnotation(UseCase.class).value());
-
- return name.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.ParentRunner#getName()
- */
- @Override
- protected String getName() {
- final StringBuilder name = new StringBuilder();
- name.append(useCase.getAnnotation(UseCase.class).value());
- return name.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
- */
- @Override
- protected List<FrameworkMethod> computeTestMethods() {
- final List<FrameworkMethod> allMethods = Lists.newArrayList(getTestClass().getAnnotatedMethods(
- MatchTest.class));
- allMethods.addAll(getTestClass().getAnnotatedMethods(DiffTest.class));
- allMethods.addAll(getTestClass().getAnnotatedMethods(ConflictTest.class));
-
- return allMethods;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.BlockJUnit4ClassRunner#methodBlock(org.junit.runners.model.FrameworkMethod)
- */
- @Override
- protected Statement methodBlock(FrameworkMethod method) {
- Object testObject = null;
- try {
- testObject = createTest();
- } catch (Exception e) {
- Assert.fail(e.getMessage());
- }
-
- final ResultStatement<NotifierTuple> useCaseStatement = new UseCaseStatement(useCase, testObject);
-
- final Statement result;
- if (method.getAnnotation(MatchTest.class) != null) {
- final List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeMatch.class);
- result = new MatchStatement(testObject, useCaseStatement, befores, method);
- } else if (method.getAnnotation(DiffTest.class) != null) {
- result = new DiffStatement(testObject, useCaseStatement, method);
- } else if (method.getAnnotation(ConflictTest.class) != null) {
- result = new ConflictStatement(testObject, useCaseStatement, method);
- } else {
- // TODO merge test
- result = null;
- }
- return result;
- }
-}
+/**
+ * Copyright (c) 2011, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.BeforeMatch;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
+import org.junit.Assert;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+/**
+ * This particular implementation of a runner will be used to run the tests of a use case.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class UseCaseRunner extends BlockJUnit4ClassRunner {
+ /** The method we are to invoke in order to retrieve the use case. */
+ private FrameworkMethod useCase;
+
+ /**
+ * Instantiates our runner.
+ *
+ * @param clazz
+ * The java class containing our tests.
+ * @param useCaseMethod
+ * The method we are to invoke in order to retrieve the use case.
+ * @throws InitializationError
+ * Thrown if the initialization failed somehow.
+ */
+ public UseCaseRunner(Class<?> clazz, FrameworkMethod useCaseMethod) throws InitializationError {
+ super(clazz);
+ this.useCase = useCaseMethod;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.BlockJUnit4ClassRunner#testName(org.junit.runners.model.FrameworkMethod)
+ */
+ @Override
+ protected String testName(FrameworkMethod method) {
+ // Replace the standard description to make it unique so that the JUnit view understands that these
+ // are two distinct tests.
+ final StringBuilder name = new StringBuilder();
+ name.append(super.testName(method));
+ name.append(" - "); //$NON-NLS-1$
+ name.append(useCase.getAnnotation(UseCase.class).value());
+
+ return name.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.ParentRunner#getName()
+ */
+ @Override
+ protected String getName() {
+ final StringBuilder name = new StringBuilder();
+ name.append(useCase.getAnnotation(UseCase.class).value());
+ return name.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
+ */
+ @Override
+ protected List<FrameworkMethod> computeTestMethods() {
+ final List<FrameworkMethod> allMethods = Lists.newArrayList(getTestClass().getAnnotatedMethods(
+ MatchTest.class));
+ allMethods.addAll(getTestClass().getAnnotatedMethods(DiffTest.class));
+ allMethods.addAll(getTestClass().getAnnotatedMethods(ConflictTest.class));
+
+ return allMethods;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.BlockJUnit4ClassRunner#methodBlock(org.junit.runners.model.FrameworkMethod)
+ */
+ @Override
+ protected Statement methodBlock(FrameworkMethod method) {
+ Object testObject = null;
+ try {
+ testObject = createTest();
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+
+ final ResultStatement<NotifierTuple> useCaseStatement = new UseCaseStatement(useCase, testObject);
+
+ final Statement result;
+ if (method.getAnnotation(MatchTest.class) != null) {
+ final List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeMatch.class);
+ result = new MatchStatement(testObject, useCaseStatement, befores, method);
+ } else if (method.getAnnotation(DiffTest.class) != null) {
+ result = new DiffStatement(testObject, useCaseStatement, method);
+ } else if (method.getAnnotation(ConflictTest.class) != null) {
+ result = new ConflictStatement(testObject, useCaseStatement, method);
+ } else {
+ // TODO merge test
+ result = null;
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseStatement.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseStatement.java
index bede48da4..457f0e2e8 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseStatement.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/framework/junit/internal/UseCaseStatement.java
@@ -1,72 +1,72 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.framework.junit.internal;
-
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
-import org.junit.Assert;
-import org.junit.runners.model.FrameworkMethod;
-
-/**
- * This will be used to invoke a method annotated with the {@link UseCase} annotation. These are expected to
- * return a {@link NotifierTuple} instance.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class UseCaseStatement extends ResultStatement<NotifierTuple> {
- /** The method we are to invoke in order to retrieve the use case. */
- private FrameworkMethod useCase;
-
- /** Target of the test. */
- private Object test;
-
- /** Result of the evaluation of {@link #useCase}. */
- private NotifierTuple result;
-
- /**
- * Instantiates our statement given the method we are to invoke in order to retrieve the use case, and the
- * target of the test.
- *
- * @param useCaseMethod
- * The method we are to invoke in order to retrieve the use case.
- * @param testObject
- * Target of the test.
- */
- public UseCaseStatement(FrameworkMethod useCaseMethod, Object testObject) {
- this.useCase = useCaseMethod;
- this.test = testObject;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.junit.runners.model.Statement#evaluate()
- */
- @Override
- public void evaluate() throws Throwable {
- if (result == null) {
- final Object tuple = useCase.invokeExplosively(test);
- Assert.assertTrue(useCase.getName() + " did not return a NotifierTuple.", //$NON-NLS-1$
- tuple instanceof NotifierTuple);
- result = (NotifierTuple)tuple;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.tests.framework.junit.internal.ResultStatement#getResult()
- */
- @Override
- public NotifierTuple getResult() {
- return result;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.framework.junit.internal;
+
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
+import org.junit.Assert;
+import org.junit.runners.model.FrameworkMethod;
+
+/**
+ * This will be used to invoke a method annotated with the {@link UseCase} annotation. These are expected to
+ * return a {@link NotifierTuple} instance.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class UseCaseStatement extends ResultStatement<NotifierTuple> {
+ /** The method we are to invoke in order to retrieve the use case. */
+ private FrameworkMethod useCase;
+
+ /** Target of the test. */
+ private Object test;
+
+ /** Result of the evaluation of {@link #useCase}. */
+ private NotifierTuple result;
+
+ /**
+ * Instantiates our statement given the method we are to invoke in order to retrieve the use case, and the
+ * target of the test.
+ *
+ * @param useCaseMethod
+ * The method we are to invoke in order to retrieve the use case.
+ * @param testObject
+ * Target of the test.
+ */
+ public UseCaseStatement(FrameworkMethod useCaseMethod, Object testObject) {
+ this.useCase = useCaseMethod;
+ this.test = testObject;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.junit.runners.model.Statement#evaluate()
+ */
+ @Override
+ public void evaluate() throws Throwable {
+ if (result == null) {
+ final Object tuple = useCase.invokeExplosively(test);
+ Assert.assertTrue(useCase.getName() + " did not return a NotifierTuple.", //$NON-NLS-1$
+ tuple instanceof NotifierTuple);
+ result = (NotifierTuple)tuple;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.tests.framework.junit.internal.ResultStatement#getResult()
+ */
+ @Override
+ public NotifierTuple getResult() {
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/DynamicInstanceComparisonTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/DynamicInstanceComparisonTest.java
index 37a97c004..c6d6fca2c 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/DynamicInstanceComparisonTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/DynamicInstanceComparisonTest.java
@@ -1,101 +1,101 @@
-/**
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.EMFCompare;
-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.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.fullcomparison.data.dynamic.DynamicInstancesInputData;
-import org.eclipse.emf.compare.tests.suite.AllTests;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * A very basic test of comparing and merging dynamic instances.
- *
- * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
- */
-@SuppressWarnings("nls")
-public class DynamicInstanceComparisonTest {
-
- DynamicInstancesInputData data = new DynamicInstancesInputData();
-
- Resource left;
-
- Resource right;
-
- Resource origin;
-
- final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
-
- @Before
- public void setUp() throws Exception {
- AllTests.fillEMFRegistries();
- left = data.getCompareLeft();
- right = data.getCompareRight();
- origin = data.getCompareRight();
- }
-
- @Test
- public void compare2Ways() throws IOException {
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison result = EMFCompare.builder().build().compare(scope);
- assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
- .getDifferences().size());
- }
-
- @Test
- public void compare3Ways() throws IOException {
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison result = EMFCompare.builder().build().compare(scope);
- assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
- .getDifferences().size());
- }
-
- @Test
- public void copyLeftToRight() throws IOException {
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison result = EMFCompare.builder().build().compare(scope);
- assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
- .getDifferences().size());
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllLeftToRight(result.getDifferences(), new BasicMonitor());
-
- assertEquals("We are supposed to have no difference as we merged everything", 0, EMFCompare.builder()
- .build().compare(scope).getDifferences().size());
- }
-
- @Test
- public void copyRightToLeft() throws IOException {
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison result = EMFCompare.builder().build().compare(scope);
- assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
- .getDifferences().size());
-
- final IBatchMerger merger = new BatchMerger(mergerRegistry);
- merger.copyAllRightToLeft(result.getDifferences(), new BasicMonitor());
-
- assertEquals("We are supposed to have no difference as we merged everything", 0, EMFCompare.builder()
- .build().compare(scope).getDifferences().size());
- }
-
-}
+/**
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.EMFCompare;
+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.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.fullcomparison.data.dynamic.DynamicInstancesInputData;
+import org.eclipse.emf.compare.tests.suite.AllTests;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * A very basic test of comparing and merging dynamic instances.
+ *
+ * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
+ */
+@SuppressWarnings("nls")
+public class DynamicInstanceComparisonTest {
+
+ DynamicInstancesInputData data = new DynamicInstancesInputData();
+
+ Resource left;
+
+ Resource right;
+
+ Resource origin;
+
+ final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Before
+ public void setUp() throws Exception {
+ AllTests.fillEMFRegistries();
+ left = data.getCompareLeft();
+ right = data.getCompareRight();
+ origin = data.getCompareRight();
+ }
+
+ @Test
+ public void compare2Ways() throws IOException {
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison result = EMFCompare.builder().build().compare(scope);
+ assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
+ .getDifferences().size());
+ }
+
+ @Test
+ public void compare3Ways() throws IOException {
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison result = EMFCompare.builder().build().compare(scope);
+ assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
+ .getDifferences().size());
+ }
+
+ @Test
+ public void copyLeftToRight() throws IOException {
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison result = EMFCompare.builder().build().compare(scope);
+ assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
+ .getDifferences().size());
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllLeftToRight(result.getDifferences(), new BasicMonitor());
+
+ assertEquals("We are supposed to have no difference as we merged everything", 0, EMFCompare.builder()
+ .build().compare(scope).getDifferences().size());
+ }
+
+ @Test
+ public void copyRightToLeft() throws IOException {
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison result = EMFCompare.builder().build().compare(scope);
+ assertEquals("We are supposed to have one difference (ADD/REMOVE of an instance)", 1, result
+ .getDifferences().size());
+
+ final IBatchMerger merger = new BatchMerger(mergerRegistry);
+ merger.copyAllRightToLeft(result.getDifferences(), new BasicMonitor());
+
+ assertEquals("We are supposed to have no difference as we merged everything", 0, EMFCompare.builder()
+ .build().compare(scope).getDifferences().size());
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/IdentifierComparisonTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/IdentifierComparisonTest.java
index 30e90a56d..ff5b63d63 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/IdentifierComparisonTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/IdentifierComparisonTest.java
@@ -1,379 +1,379 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison;
-
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAdded;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAddedToReference;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAllMatched;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertChangedAttribute;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertChangedReference;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertRemoved;
-import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertRemovedFromReference;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Lists;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Conflict;
-import org.eclipse.emf.compare.ConflictKind;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.MatchResource;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.framework.EMFCompareTestBase;
-import org.eclipse.emf.compare.tests.framework.IdentifierMatchValidator;
-import org.eclipse.emf.compare.tests.framework.NotifierTuple;
-import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.BeforeMatch;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
-import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
-import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.runner.RunWith;
-
-@RunWith(EMFCompareTestRunner.class)
-@SuppressWarnings("nls")
-public class IdentifierComparisonTest extends EMFCompareTestBase {
- private IdentifierMatchInputData inputData = new IdentifierMatchInputData();
-
- @UseCase("Extended library three-way")
- public NotifierTuple extlibrary3WayTuple() throws IOException {
- final Resource left = inputData.getExtlibraryLeft();
- final Resource right = inputData.getExtlibraryRight();
- final Resource origin = inputData.getExtlibraryOrigin();
-
- return new NotifierTuple(left, right, origin);
- }
-
- @UseCase("Extended library two-way")
- public NotifierTuple extlibrary2WayTuple() throws IOException {
- final Resource left = inputData.getExtlibraryLeft();
- final Resource right = inputData.getExtlibraryRight();
-
- return new NotifierTuple(left, right, null);
- }
-
- @BeforeMatch
- public void beforeMatch(NotifierTuple tuple) {
- assertNotNull(tuple);
- assertTrue(tuple.getLeft() instanceof Resource);
- assertTrue(tuple.getRight() instanceof Resource);
- // We have both two-way and three-way use cases here
- }
-
- @MatchTest
- public void testIdentifierMatch(IComparisonScope scope, Comparison comparison) {
- final Resource left = (Resource)scope.getLeft();
- final Resource right = (Resource)scope.getRight();
- final Resource origin = (Resource)scope.getOrigin();
- assertSame(Boolean.valueOf(origin != null), Boolean.valueOf(comparison.isThreeWay()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatchedResources().size()));
- final MatchResource matchedResource = comparison.getMatchedResources().get(0);
- assertEquals(left.getURI().toString(), matchedResource.getLeftURI());
- assertEquals(right.getURI().toString(), matchedResource.getRightURI());
- if (origin != null) {
- assertEquals(origin.getURI().toString(), matchedResource.getOriginURI());
- }
-
- // Validate that all matches point to sides that have the same IDs, and that there is only 1 Match for
- // one "ID" (if two EObjects on two different sides have the same ID, they share the same Match).
- final IdentifierMatchValidator validator = new IdentifierMatchValidator();
- validator.validate(comparison);
-
- // Make sure that we have a Match for all EObjects of this scope
- final List<EObject> leftChildren = getAllProperContent(left);
- final List<EObject> rightChildren = getAllProperContent(right);
- final List<EObject> originChildren = getAllProperContent(origin);
-
- assertAllMatched(leftChildren, comparison, scope);
- assertAllMatched(rightChildren, comparison, scope);
- assertAllMatched(originChildren, comparison, scope);
- }
-
- @DiffTest
- public void testIdentifierDiffTest(@SuppressWarnings("unused") IComparisonScope scope,
- Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // See file org.eclipse.emf.compare.tests.model.mock.CHANGES for the description of these
-
- assertAdded(differences, "extlibrary.BookCategory.Encyclopedia", DifferenceSource.LEFT);
- assertAdded(differences, "extlibrary.BookCategory.Dictionary", DifferenceSource.LEFT);
- assertAdded(differences, "extlibrary.Magazine", DifferenceSource.LEFT);
- assertAdded(differences, "extlibrary.Magazine.title", DifferenceSource.LEFT);
- assertAdded(differences, "extlibrary.Magazine.pages", DifferenceSource.LEFT);
- assertAdded(differences, "extlibrary.Person.fullName", DifferenceSource.LEFT);
-
- assertRemoved(differences, "extlibrary.Periodical", DifferenceSource.LEFT);
- assertRemoved(differences, "extlibrary.Periodical.issuesPerYear", DifferenceSource.LEFT);
- assertRemoved(differences, "extlibrary.Person.firstName", DifferenceSource.LEFT);
-
- assertChangedAttribute(differences, "extlibrary.Lendable", "name", "Lendable", "Borrowable",
- DifferenceSource.LEFT);
-
- assertAddedToReference(differences, "extlibrary.Magazine", "eSuperTypes",
- "extlibrary.CirculatingItem", DifferenceSource.LEFT);
- assertRemovedFromReference(differences, "extlibrary.Periodical", "eSuperTypes", "extlibrary.Item",
- DifferenceSource.LEFT);
-
- assertChangedReference(differences, "extlibrary.Magazine.title", "eType", null, "ecore.EString",
- DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Magazine.pages", "eType", null, "ecore.EInt",
- DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Person.fullName", "eType", null, "ecore.EString",
- DifferenceSource.LEFT);
-
- assertChangedReference(differences, "extlibrary.Periodical.issuesPerYear", "eType", "ecore.EInt",
- null, DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Person.firstName", "eType", "ecore.EString", null,
- DifferenceSource.LEFT);
-
- // some diffs change according to the presence of an origin.
- if (comparison.isThreeWay()) {
- // This one will be detected differently in two-way
- assertRemoved(differences, "extlibrary.Person.lastName", DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Person.lastName", "eType", "ecore.EString", null,
- DifferenceSource.LEFT);
-
- final DifferenceSource side = DifferenceSource.RIGHT;
- assertAdded(differences, "extlibrary.BookCategory.Manga", side);
- assertAdded(differences, "extlibrary.BookCategory.Manhwa", side);
- assertAdded(differences, "extlibrary.Book.subtitle", side);
- assertAdded(differences, "extlibrary.Magazine", side);
- assertAdded(differences, "extlibrary.TitledItem", side);
- assertAdded(differences, "extlibrary.TitledItem.title", side);
-
- assertRemoved(differences, "extlibrary.Book.title", side);
- assertRemoved(differences, "extlibrary.AudioVisualItem.title", side);
-
- assertAddedToReference(differences, "extlibrary.Book", "eSuperTypes", "extlibrary.TitledItem",
- side);
- assertAddedToReference(differences, "extlibrary.Periodical", "eSuperTypes",
- "extlibrary.TitledItem", side);
- assertAddedToReference(differences, "extlibrary.AudioVisualItem", "eSuperTypes",
- "extlibrary.TitledItem", side);
- assertAddedToReference(differences, "extlibrary.Magazine", "eSuperTypes",
- "extlibrary.Periodical", side);
-
- assertChangedReference(differences, "extlibrary.Book.subtitle", "eType", null, "ecore.EString",
- side);
- assertChangedReference(differences, "extlibrary.TitledItem.title", "eType", null,
- "ecore.EString", side);
-
- assertChangedReference(differences, "extlibrary.Book.title", "eType", "ecore.EString", null, side);
- assertChangedReference(differences, "extlibrary.AudioVisualItem.title", "eType", "ecore.EString",
- null, side);
-
- /*
- * The following are actually conflicts, most changes according to whether we are in three-way or
- * not.
- */
- assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
- "length", DifferenceSource.LEFT);
- // These are actually pseudo-conflicts : same diff on both sides
- assertRemoved(differences, "extlibrary.BookOnTape.reader", DifferenceSource.LEFT);
- assertRemoved(differences, "extlibrary.BookOnTape.reader", DifferenceSource.RIGHT);
- assertRemoved(differences, "extlibrary.Periodical.title", DifferenceSource.LEFT);
- assertRemoved(differences, "extlibrary.Periodical.title", DifferenceSource.RIGHT);
- assertChangedReference(differences, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
- null, DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
- null, DifferenceSource.RIGHT);
- assertChangedReference(differences, "extlibrary.Periodical.title", "eType", "ecore.EString",
- null, DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Periodical.title", "eType", "ecore.EString",
- null, DifferenceSource.RIGHT);
- /*
- * These changes can only be detected with an origin : lastName has been removed in the left model
- * and thus only the removal can be detected in two-way. Likewise, "minutesLength" has been
- * renamed in both left and right, and thus no mention of that value can be found in two-way
- */
- assertChangedAttribute(differences, "extlibrary.Person.familyName", "name", "lastName",
- "familyName", side);
- assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
- "minutes", side);
- } else {
- assertRemoved(differences, "extlibrary.Person.familyName", DifferenceSource.LEFT);
- assertChangedReference(differences, "extlibrary.Person.familyName", "eType", "ecore.EString",
- null, DifferenceSource.LEFT);
-
- final DifferenceSource side = DifferenceSource.LEFT;
- assertRemoved(differences, "extlibrary.BookCategory.Manga", side);
- assertRemoved(differences, "extlibrary.BookCategory.Manhwa", side);
- assertRemoved(differences, "extlibrary.Book.subtitle", side);
- assertRemoved(differences, "extlibrary.Magazine", side);
- assertRemoved(differences, "extlibrary.TitledItem", side);
- assertRemoved(differences, "extlibrary.TitledItem.title", side);
-
- assertAdded(differences, "extlibrary.Book.title", side);
- assertAdded(differences, "extlibrary.AudioVisualItem.title", side);
-
- assertRemovedFromReference(differences, "extlibrary.Book", "eSuperTypes",
- "extlibrary.TitledItem", side);
- assertRemovedFromReference(differences, "extlibrary.Periodical", "eSuperTypes",
- "extlibrary.TitledItem", side);
- assertRemovedFromReference(differences, "extlibrary.AudioVisualItem", "eSuperTypes",
- "extlibrary.TitledItem", side);
- assertRemovedFromReference(differences, "extlibrary.Magazine", "eSuperTypes",
- "extlibrary.Periodical", side);
-
- assertChangedReference(differences, "extlibrary.Book.subtitle", "eType", "ecore.EString", null,
- side);
- assertChangedReference(differences, "extlibrary.TitledItem.title", "eType", "ecore.EString",
- null, side);
-
- assertChangedReference(differences, "extlibrary.Book.title", "eType", null, "ecore.EString", side);
- assertChangedReference(differences, "extlibrary.AudioVisualItem.title", "eType", null,
- "ecore.EString", side);
-
- // This is a conflict, the expected diff is not the same in two-way
- assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutes",
- "length", DifferenceSource.LEFT);
- }
-
- // We should have no more differences than those
- assertTrue(differences.isEmpty());
- }
-
- @ConflictTest
- public void testIdentifierConflictTest(@SuppressWarnings("unused") IComparisonScope scope,
- Comparison comparison) {
- final List<Conflict> conflicts = comparison.getConflicts();
-
- if (!comparison.isThreeWay()) {
- assertTrue(conflicts.isEmpty());
- return;
- }
-
- assertEquals(5, conflicts.size());
-
- Conflict periodicalConflict = null;
- Conflict titleConflict = null;
- Conflict lastNameConflict = null;
- Conflict minutesLengthConflict = null;
- Conflict readerConflict = null;
-
- for (Conflict conflict : conflicts) {
- for (Diff diff : conflict.getDifferences()) {
- boolean breakLoop = false;
- final Match match = diff.getMatch();
- if (isMatchOf(match, "Periodical") && conflict.getDifferences().size() == 3) {
- periodicalConflict = conflict;
- breakLoop = true;
- } else if (isMatchOf(match, "Periodical")) {
- titleConflict = conflict;
- breakLoop = true;
- } else if (isMatchOf(match, "Person")) {
- lastNameConflict = conflict;
- breakLoop = true;
- } else if (isMatchOf(match, "BookOnTape")) {
- readerConflict = conflict;
- breakLoop = true;
- } else if (isMatchOf(match, "minutesLength")) {
- minutesLengthConflict = conflict;
- breakLoop = true;
- }
- if (breakLoop) {
- break;
- }
- }
- }
-
- assertNotNull(periodicalConflict);
- assertNotNull(titleConflict);
- assertNotNull(lastNameConflict);
- assertNotNull(minutesLengthConflict);
- assertNotNull(readerConflict);
-
- // These classic asserts will make the compiler happy.
- assert periodicalConflict != null;
- assert titleConflict != null;
- assert lastNameConflict != null;
- assert minutesLengthConflict != null;
- assert readerConflict != null;
-
- final List<Diff> periodicalDiffs = Lists.newArrayList(periodicalConflict.getDifferences());
- assertSame(ConflictKind.REAL, periodicalConflict.getKind());
- assertRemoved(periodicalDiffs, "extlibrary.Periodical", DifferenceSource.LEFT);
- assertAddedToReference(periodicalDiffs, "extlibrary.Periodical", "eSuperTypes",
- "extlibrary.TitledItem", DifferenceSource.RIGHT);
- assertAddedToReference(periodicalDiffs, "extlibrary.Magazine", "eSuperTypes",
- "extlibrary.Periodical", DifferenceSource.RIGHT);
- assertTrue(periodicalDiffs.isEmpty());
-
- final List<Diff> nameDiffs = Lists.newArrayList(lastNameConflict.getDifferences());
- assertSame(ConflictKind.REAL, lastNameConflict.getKind());
- assertRemoved(nameDiffs, "extlibrary.Person.lastName", DifferenceSource.LEFT);
- assertChangedAttribute(nameDiffs, "extlibrary.Person.familyName", "name", "lastName", "familyName",
- DifferenceSource.RIGHT);
- assertTrue(nameDiffs.isEmpty());
-
- final List<Diff> lengthDiffs = Lists.newArrayList(minutesLengthConflict.getDifferences());
- assertSame(ConflictKind.REAL, minutesLengthConflict.getKind());
- assertChangedAttribute(lengthDiffs, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
- "length", DifferenceSource.LEFT);
- assertChangedAttribute(lengthDiffs, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
- "minutes", DifferenceSource.RIGHT);
- assertTrue(lengthDiffs.isEmpty());
-
- final List<Diff> titleDiffs = Lists.newArrayList(titleConflict.getDifferences());
- assertSame(ConflictKind.PSEUDO, titleConflict.getKind());
- assertRemoved(titleDiffs, "extlibrary.Periodical.title", DifferenceSource.LEFT);
- assertChangedReference(titleDiffs, "extlibrary.Periodical.title", "eType", "ecore.EString", null,
- DifferenceSource.LEFT);
- assertChangedReference(titleDiffs, "extlibrary.Periodical.title", "eType", "ecore.EString", null,
- DifferenceSource.RIGHT);
- assertRemoved(titleDiffs, "extlibrary.Periodical.title", DifferenceSource.RIGHT);
- assertTrue(titleDiffs.isEmpty());
-
- final List<Diff> readerDiffs = Lists.newArrayList(readerConflict.getDifferences());
- assertSame(ConflictKind.PSEUDO, readerConflict.getKind());
- assertRemoved(readerDiffs, "extlibrary.BookOnTape.reader", DifferenceSource.LEFT);
- assertRemoved(readerDiffs, "extlibrary.BookOnTape.reader", DifferenceSource.RIGHT);
- assertChangedReference(readerDiffs, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
- null, DifferenceSource.LEFT);
- assertChangedReference(readerDiffs, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
- null, DifferenceSource.RIGHT);
- assertTrue(readerDiffs.isEmpty());
- }
-
- private boolean isMatchOf(Match match, String name) {
- boolean isMatch = false;
- if (match.getLeft() instanceof ENamedElement) {
- if (((ENamedElement)match.getLeft()).getName().equals(name)) {
- isMatch = true;
- }
- }
- if (!isMatch && match.getRight() instanceof ENamedElement) {
- if (((ENamedElement)match.getRight()).getName().equals(name)) {
- isMatch = true;
- }
- }
- if (!isMatch && match.getOrigin() instanceof ENamedElement) {
- if (((ENamedElement)match.getOrigin()).getName().equals(name)) {
- isMatch = true;
- }
- }
- return isMatch;
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison;
+
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAdded;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAddedToReference;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertAllMatched;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertChangedAttribute;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertChangedReference;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertRemoved;
+import static org.eclipse.emf.compare.tests.framework.EMFCompareAssert.assertRemovedFromReference;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Lists;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.framework.EMFCompareTestBase;
+import org.eclipse.emf.compare.tests.framework.IdentifierMatchValidator;
+import org.eclipse.emf.compare.tests.framework.NotifierTuple;
+import org.eclipse.emf.compare.tests.framework.junit.EMFCompareTestRunner;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.BeforeMatch;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.ConflictTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.DiffTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.MatchTest;
+import org.eclipse.emf.compare.tests.framework.junit.annotation.UseCase;
+import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.runner.RunWith;
+
+@RunWith(EMFCompareTestRunner.class)
+@SuppressWarnings("nls")
+public class IdentifierComparisonTest extends EMFCompareTestBase {
+ private IdentifierMatchInputData inputData = new IdentifierMatchInputData();
+
+ @UseCase("Extended library three-way")
+ public NotifierTuple extlibrary3WayTuple() throws IOException {
+ final Resource left = inputData.getExtlibraryLeft();
+ final Resource right = inputData.getExtlibraryRight();
+ final Resource origin = inputData.getExtlibraryOrigin();
+
+ return new NotifierTuple(left, right, origin);
+ }
+
+ @UseCase("Extended library two-way")
+ public NotifierTuple extlibrary2WayTuple() throws IOException {
+ final Resource left = inputData.getExtlibraryLeft();
+ final Resource right = inputData.getExtlibraryRight();
+
+ return new NotifierTuple(left, right, null);
+ }
+
+ @BeforeMatch
+ public void beforeMatch(NotifierTuple tuple) {
+ assertNotNull(tuple);
+ assertTrue(tuple.getLeft() instanceof Resource);
+ assertTrue(tuple.getRight() instanceof Resource);
+ // We have both two-way and three-way use cases here
+ }
+
+ @MatchTest
+ public void testIdentifierMatch(IComparisonScope scope, Comparison comparison) {
+ final Resource left = (Resource)scope.getLeft();
+ final Resource right = (Resource)scope.getRight();
+ final Resource origin = (Resource)scope.getOrigin();
+ assertSame(Boolean.valueOf(origin != null), Boolean.valueOf(comparison.isThreeWay()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatchedResources().size()));
+ final MatchResource matchedResource = comparison.getMatchedResources().get(0);
+ assertEquals(left.getURI().toString(), matchedResource.getLeftURI());
+ assertEquals(right.getURI().toString(), matchedResource.getRightURI());
+ if (origin != null) {
+ assertEquals(origin.getURI().toString(), matchedResource.getOriginURI());
+ }
+
+ // Validate that all matches point to sides that have the same IDs, and that there is only 1 Match for
+ // one "ID" (if two EObjects on two different sides have the same ID, they share the same Match).
+ final IdentifierMatchValidator validator = new IdentifierMatchValidator();
+ validator.validate(comparison);
+
+ // Make sure that we have a Match for all EObjects of this scope
+ final List<EObject> leftChildren = getAllProperContent(left);
+ final List<EObject> rightChildren = getAllProperContent(right);
+ final List<EObject> originChildren = getAllProperContent(origin);
+
+ assertAllMatched(leftChildren, comparison, scope);
+ assertAllMatched(rightChildren, comparison, scope);
+ assertAllMatched(originChildren, comparison, scope);
+ }
+
+ @DiffTest
+ public void testIdentifierDiffTest(@SuppressWarnings("unused") IComparisonScope scope,
+ Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // See file org.eclipse.emf.compare.tests.model.mock.CHANGES for the description of these
+
+ assertAdded(differences, "extlibrary.BookCategory.Encyclopedia", DifferenceSource.LEFT);
+ assertAdded(differences, "extlibrary.BookCategory.Dictionary", DifferenceSource.LEFT);
+ assertAdded(differences, "extlibrary.Magazine", DifferenceSource.LEFT);
+ assertAdded(differences, "extlibrary.Magazine.title", DifferenceSource.LEFT);
+ assertAdded(differences, "extlibrary.Magazine.pages", DifferenceSource.LEFT);
+ assertAdded(differences, "extlibrary.Person.fullName", DifferenceSource.LEFT);
+
+ assertRemoved(differences, "extlibrary.Periodical", DifferenceSource.LEFT);
+ assertRemoved(differences, "extlibrary.Periodical.issuesPerYear", DifferenceSource.LEFT);
+ assertRemoved(differences, "extlibrary.Person.firstName", DifferenceSource.LEFT);
+
+ assertChangedAttribute(differences, "extlibrary.Lendable", "name", "Lendable", "Borrowable",
+ DifferenceSource.LEFT);
+
+ assertAddedToReference(differences, "extlibrary.Magazine", "eSuperTypes",
+ "extlibrary.CirculatingItem", DifferenceSource.LEFT);
+ assertRemovedFromReference(differences, "extlibrary.Periodical", "eSuperTypes", "extlibrary.Item",
+ DifferenceSource.LEFT);
+
+ assertChangedReference(differences, "extlibrary.Magazine.title", "eType", null, "ecore.EString",
+ DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Magazine.pages", "eType", null, "ecore.EInt",
+ DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Person.fullName", "eType", null, "ecore.EString",
+ DifferenceSource.LEFT);
+
+ assertChangedReference(differences, "extlibrary.Periodical.issuesPerYear", "eType", "ecore.EInt",
+ null, DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Person.firstName", "eType", "ecore.EString", null,
+ DifferenceSource.LEFT);
+
+ // some diffs change according to the presence of an origin.
+ if (comparison.isThreeWay()) {
+ // This one will be detected differently in two-way
+ assertRemoved(differences, "extlibrary.Person.lastName", DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Person.lastName", "eType", "ecore.EString", null,
+ DifferenceSource.LEFT);
+
+ final DifferenceSource side = DifferenceSource.RIGHT;
+ assertAdded(differences, "extlibrary.BookCategory.Manga", side);
+ assertAdded(differences, "extlibrary.BookCategory.Manhwa", side);
+ assertAdded(differences, "extlibrary.Book.subtitle", side);
+ assertAdded(differences, "extlibrary.Magazine", side);
+ assertAdded(differences, "extlibrary.TitledItem", side);
+ assertAdded(differences, "extlibrary.TitledItem.title", side);
+
+ assertRemoved(differences, "extlibrary.Book.title", side);
+ assertRemoved(differences, "extlibrary.AudioVisualItem.title", side);
+
+ assertAddedToReference(differences, "extlibrary.Book", "eSuperTypes", "extlibrary.TitledItem",
+ side);
+ assertAddedToReference(differences, "extlibrary.Periodical", "eSuperTypes",
+ "extlibrary.TitledItem", side);
+ assertAddedToReference(differences, "extlibrary.AudioVisualItem", "eSuperTypes",
+ "extlibrary.TitledItem", side);
+ assertAddedToReference(differences, "extlibrary.Magazine", "eSuperTypes",
+ "extlibrary.Periodical", side);
+
+ assertChangedReference(differences, "extlibrary.Book.subtitle", "eType", null, "ecore.EString",
+ side);
+ assertChangedReference(differences, "extlibrary.TitledItem.title", "eType", null,
+ "ecore.EString", side);
+
+ assertChangedReference(differences, "extlibrary.Book.title", "eType", "ecore.EString", null, side);
+ assertChangedReference(differences, "extlibrary.AudioVisualItem.title", "eType", "ecore.EString",
+ null, side);
+
+ /*
+ * The following are actually conflicts, most changes according to whether we are in three-way or
+ * not.
+ */
+ assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
+ "length", DifferenceSource.LEFT);
+ // These are actually pseudo-conflicts : same diff on both sides
+ assertRemoved(differences, "extlibrary.BookOnTape.reader", DifferenceSource.LEFT);
+ assertRemoved(differences, "extlibrary.BookOnTape.reader", DifferenceSource.RIGHT);
+ assertRemoved(differences, "extlibrary.Periodical.title", DifferenceSource.LEFT);
+ assertRemoved(differences, "extlibrary.Periodical.title", DifferenceSource.RIGHT);
+ assertChangedReference(differences, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
+ null, DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
+ null, DifferenceSource.RIGHT);
+ assertChangedReference(differences, "extlibrary.Periodical.title", "eType", "ecore.EString",
+ null, DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Periodical.title", "eType", "ecore.EString",
+ null, DifferenceSource.RIGHT);
+ /*
+ * These changes can only be detected with an origin : lastName has been removed in the left model
+ * and thus only the removal can be detected in two-way. Likewise, "minutesLength" has been
+ * renamed in both left and right, and thus no mention of that value can be found in two-way
+ */
+ assertChangedAttribute(differences, "extlibrary.Person.familyName", "name", "lastName",
+ "familyName", side);
+ assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
+ "minutes", side);
+ } else {
+ assertRemoved(differences, "extlibrary.Person.familyName", DifferenceSource.LEFT);
+ assertChangedReference(differences, "extlibrary.Person.familyName", "eType", "ecore.EString",
+ null, DifferenceSource.LEFT);
+
+ final DifferenceSource side = DifferenceSource.LEFT;
+ assertRemoved(differences, "extlibrary.BookCategory.Manga", side);
+ assertRemoved(differences, "extlibrary.BookCategory.Manhwa", side);
+ assertRemoved(differences, "extlibrary.Book.subtitle", side);
+ assertRemoved(differences, "extlibrary.Magazine", side);
+ assertRemoved(differences, "extlibrary.TitledItem", side);
+ assertRemoved(differences, "extlibrary.TitledItem.title", side);
+
+ assertAdded(differences, "extlibrary.Book.title", side);
+ assertAdded(differences, "extlibrary.AudioVisualItem.title", side);
+
+ assertRemovedFromReference(differences, "extlibrary.Book", "eSuperTypes",
+ "extlibrary.TitledItem", side);
+ assertRemovedFromReference(differences, "extlibrary.Periodical", "eSuperTypes",
+ "extlibrary.TitledItem", side);
+ assertRemovedFromReference(differences, "extlibrary.AudioVisualItem", "eSuperTypes",
+ "extlibrary.TitledItem", side);
+ assertRemovedFromReference(differences, "extlibrary.Magazine", "eSuperTypes",
+ "extlibrary.Periodical", side);
+
+ assertChangedReference(differences, "extlibrary.Book.subtitle", "eType", "ecore.EString", null,
+ side);
+ assertChangedReference(differences, "extlibrary.TitledItem.title", "eType", "ecore.EString",
+ null, side);
+
+ assertChangedReference(differences, "extlibrary.Book.title", "eType", null, "ecore.EString", side);
+ assertChangedReference(differences, "extlibrary.AudioVisualItem.title", "eType", null,
+ "ecore.EString", side);
+
+ // This is a conflict, the expected diff is not the same in two-way
+ assertChangedAttribute(differences, "extlibrary.AudioVisualItem.length", "name", "minutes",
+ "length", DifferenceSource.LEFT);
+ }
+
+ // We should have no more differences than those
+ assertTrue(differences.isEmpty());
+ }
+
+ @ConflictTest
+ public void testIdentifierConflictTest(@SuppressWarnings("unused") IComparisonScope scope,
+ Comparison comparison) {
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ if (!comparison.isThreeWay()) {
+ assertTrue(conflicts.isEmpty());
+ return;
+ }
+
+ assertEquals(5, conflicts.size());
+
+ Conflict periodicalConflict = null;
+ Conflict titleConflict = null;
+ Conflict lastNameConflict = null;
+ Conflict minutesLengthConflict = null;
+ Conflict readerConflict = null;
+
+ for (Conflict conflict : conflicts) {
+ for (Diff diff : conflict.getDifferences()) {
+ boolean breakLoop = false;
+ final Match match = diff.getMatch();
+ if (isMatchOf(match, "Periodical") && conflict.getDifferences().size() == 3) {
+ periodicalConflict = conflict;
+ breakLoop = true;
+ } else if (isMatchOf(match, "Periodical")) {
+ titleConflict = conflict;
+ breakLoop = true;
+ } else if (isMatchOf(match, "Person")) {
+ lastNameConflict = conflict;
+ breakLoop = true;
+ } else if (isMatchOf(match, "BookOnTape")) {
+ readerConflict = conflict;
+ breakLoop = true;
+ } else if (isMatchOf(match, "minutesLength")) {
+ minutesLengthConflict = conflict;
+ breakLoop = true;
+ }
+ if (breakLoop) {
+ break;
+ }
+ }
+ }
+
+ assertNotNull(periodicalConflict);
+ assertNotNull(titleConflict);
+ assertNotNull(lastNameConflict);
+ assertNotNull(minutesLengthConflict);
+ assertNotNull(readerConflict);
+
+ // These classic asserts will make the compiler happy.
+ assert periodicalConflict != null;
+ assert titleConflict != null;
+ assert lastNameConflict != null;
+ assert minutesLengthConflict != null;
+ assert readerConflict != null;
+
+ final List<Diff> periodicalDiffs = Lists.newArrayList(periodicalConflict.getDifferences());
+ assertSame(ConflictKind.REAL, periodicalConflict.getKind());
+ assertRemoved(periodicalDiffs, "extlibrary.Periodical", DifferenceSource.LEFT);
+ assertAddedToReference(periodicalDiffs, "extlibrary.Periodical", "eSuperTypes",
+ "extlibrary.TitledItem", DifferenceSource.RIGHT);
+ assertAddedToReference(periodicalDiffs, "extlibrary.Magazine", "eSuperTypes",
+ "extlibrary.Periodical", DifferenceSource.RIGHT);
+ assertTrue(periodicalDiffs.isEmpty());
+
+ final List<Diff> nameDiffs = Lists.newArrayList(lastNameConflict.getDifferences());
+ assertSame(ConflictKind.REAL, lastNameConflict.getKind());
+ assertRemoved(nameDiffs, "extlibrary.Person.lastName", DifferenceSource.LEFT);
+ assertChangedAttribute(nameDiffs, "extlibrary.Person.familyName", "name", "lastName", "familyName",
+ DifferenceSource.RIGHT);
+ assertTrue(nameDiffs.isEmpty());
+
+ final List<Diff> lengthDiffs = Lists.newArrayList(minutesLengthConflict.getDifferences());
+ assertSame(ConflictKind.REAL, minutesLengthConflict.getKind());
+ assertChangedAttribute(lengthDiffs, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
+ "length", DifferenceSource.LEFT);
+ assertChangedAttribute(lengthDiffs, "extlibrary.AudioVisualItem.length", "name", "minutesLength",
+ "minutes", DifferenceSource.RIGHT);
+ assertTrue(lengthDiffs.isEmpty());
+
+ final List<Diff> titleDiffs = Lists.newArrayList(titleConflict.getDifferences());
+ assertSame(ConflictKind.PSEUDO, titleConflict.getKind());
+ assertRemoved(titleDiffs, "extlibrary.Periodical.title", DifferenceSource.LEFT);
+ assertChangedReference(titleDiffs, "extlibrary.Periodical.title", "eType", "ecore.EString", null,
+ DifferenceSource.LEFT);
+ assertChangedReference(titleDiffs, "extlibrary.Periodical.title", "eType", "ecore.EString", null,
+ DifferenceSource.RIGHT);
+ assertRemoved(titleDiffs, "extlibrary.Periodical.title", DifferenceSource.RIGHT);
+ assertTrue(titleDiffs.isEmpty());
+
+ final List<Diff> readerDiffs = Lists.newArrayList(readerConflict.getDifferences());
+ assertSame(ConflictKind.PSEUDO, readerConflict.getKind());
+ assertRemoved(readerDiffs, "extlibrary.BookOnTape.reader", DifferenceSource.LEFT);
+ assertRemoved(readerDiffs, "extlibrary.BookOnTape.reader", DifferenceSource.RIGHT);
+ assertChangedReference(readerDiffs, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
+ null, DifferenceSource.LEFT);
+ assertChangedReference(readerDiffs, "extlibrary.BookOnTape.reader", "eType", "extlibrary.Person",
+ null, DifferenceSource.RIGHT);
+ assertTrue(readerDiffs.isEmpty());
+ }
+
+ private boolean isMatchOf(Match match, String name) {
+ boolean isMatch = false;
+ if (match.getLeft() instanceof ENamedElement) {
+ if (((ENamedElement)match.getLeft()).getName().equals(name)) {
+ isMatch = true;
+ }
+ }
+ if (!isMatch && match.getRight() instanceof ENamedElement) {
+ if (((ENamedElement)match.getRight()).getName().equals(name)) {
+ isMatch = true;
+ }
+ }
+ if (!isMatch && match.getOrigin() instanceof ENamedElement) {
+ if (((ENamedElement)match.getOrigin()).getName().equals(name)) {
+ isMatch = true;
+ }
+ }
+ return isMatch;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/MatchPerformanceComparisonTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/MatchPerformanceComparisonTest.java
index e2efa3ca4..d4a031b64 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/MatchPerformanceComparisonTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/MatchPerformanceComparisonTest.java
@@ -1,95 +1,95 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison;
-
-import java.io.IOException;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.match.DefaultComparisonFactory;
-import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
-import org.eclipse.emf.compare.match.DefaultMatchEngine;
-import org.eclipse.emf.compare.match.IMatchEngine;
-import org.eclipse.emf.compare.match.eobject.EditionDistance;
-import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
-import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.fullcomparison.data.distance.DistanceMatchInputData;
-import org.eclipse.emf.compare.tests.suite.AllTests;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * A very crude performance test comparing the match per id and match per content time.
- *
- * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
- */
-public class MatchPerformanceComparisonTest {
-
- DistanceMatchInputData data = new DistanceMatchInputData();
-
- int nbIterations = 10;
-
- Resource left;
-
- Resource right;
-
- Resource origin;
-
- @SuppressWarnings("restriction")
- @Before
- public void setUp() throws Exception {
- AllTests.fillEMFRegistries();
- EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
-
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("uml", //$NON-NLS-1$
- new org.eclipse.uml2.uml.internal.resource.UMLResourceFactoryImpl());
- left = data.getNominalUMLLeft();
- right = data.getNominalUMLRight();
- origin = data.getNominalUMLOrigin();
- }
-
- @Test
- public void warmup() throws IOException {
- final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder().build());
- final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
- IMatchEngine matchEngine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- matchEngine.match(scope, new BasicMonitor());
- }
-
- @Test
- public void matchPerIdAlmostIdenticalModels() throws IOException {
- final IEObjectMatcher matcher = new IdentifierEObjectMatcher();
- IMatchEngine matchEngine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- for (int i = 0; i < nbIterations; i++) {
- matchEngine.match(scope, new BasicMonitor());
- }
- }
-
- @Test
- public void matchPerContentAlmostIdenticalModels() throws IOException {
- final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder().build());
- IMatchEngine matchEngine = new DefaultMatchEngine(contentMatcher, new DefaultComparisonFactory(
- new DefaultEqualityHelperFactory()));
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- for (int i = 0; i < nbIterations; i++) {
- matchEngine.match(scope, new BasicMonitor());
- }
- }
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.match.DefaultComparisonFactory;
+import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
+import org.eclipse.emf.compare.match.DefaultMatchEngine;
+import org.eclipse.emf.compare.match.IMatchEngine;
+import org.eclipse.emf.compare.match.eobject.EditionDistance;
+import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher;
+import org.eclipse.emf.compare.match.eobject.ProximityEObjectMatcher;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.fullcomparison.data.distance.DistanceMatchInputData;
+import org.eclipse.emf.compare.tests.suite.AllTests;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * A very crude performance test comparing the match per id and match per content time.
+ *
+ * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
+ */
+public class MatchPerformanceComparisonTest {
+
+ DistanceMatchInputData data = new DistanceMatchInputData();
+
+ int nbIterations = 10;
+
+ Resource left;
+
+ Resource right;
+
+ Resource origin;
+
+ @SuppressWarnings("restriction")
+ @Before
+ public void setUp() throws Exception {
+ AllTests.fillEMFRegistries();
+ EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("uml", //$NON-NLS-1$
+ new org.eclipse.uml2.uml.internal.resource.UMLResourceFactoryImpl());
+ left = data.getNominalUMLLeft();
+ right = data.getNominalUMLRight();
+ origin = data.getNominalUMLOrigin();
+ }
+
+ @Test
+ public void warmup() throws IOException {
+ final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder().build());
+ final IEObjectMatcher matcher = new IdentifierEObjectMatcher(contentMatcher);
+ IMatchEngine matchEngine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ matchEngine.match(scope, new BasicMonitor());
+ }
+
+ @Test
+ public void matchPerIdAlmostIdenticalModels() throws IOException {
+ final IEObjectMatcher matcher = new IdentifierEObjectMatcher();
+ IMatchEngine matchEngine = new DefaultMatchEngine(matcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ for (int i = 0; i < nbIterations; i++) {
+ matchEngine.match(scope, new BasicMonitor());
+ }
+ }
+
+ @Test
+ public void matchPerContentAlmostIdenticalModels() throws IOException {
+ final IEObjectMatcher contentMatcher = new ProximityEObjectMatcher(EditionDistance.builder().build());
+ IMatchEngine matchEngine = new DefaultMatchEngine(contentMatcher, new DefaultComparisonFactory(
+ new DefaultEqualityHelperFactory()));
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ for (int i = 0; i < nbIterations; i++) {
+ matchEngine.match(scope, new BasicMonitor());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-ancestor.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-ancestor.ecore
index 53c7c8077..1dc307823 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-ancestor.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-ancestor.ecore
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A"/>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-left.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-left.ecore
index 8ec498bdc..dbde4cd18 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-left.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-left.ecore
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="ASCII"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
- <ecore:EPackage name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A"/>
- </ecore:EPackage>
- <ecore:EPackage name="toDelete" nsURI="toDelete" nsPrefix="toDelete"/>
-</xmi:XMI>
+<?xml version="1.0" encoding="ASCII"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
+ <ecore:EPackage name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A"/>
+ </ecore:EPackage>
+ <ecore:EPackage name="toDelete" nsURI="toDelete" nsPrefix="toDelete"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-right.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-right.ecore
index 53c7c8077..1dc307823 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-right.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/390666-right.ecore
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A"/>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-left.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-left.ecore
index 86be27a6b..8ad2af12f 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-left.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-left.ecore
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="E"/>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="E"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-right.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-right.ecore
index e47f80058..72223e8a4 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-right.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391657-right.ecore
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" lowerBound="1" upperBound="-1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" lowerBound="1" upperBound="4"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a3" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" lowerBound="1" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" lowerBound="1" upperBound="4"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a3" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-left.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-left.ecore
index dbebbb7af..c0e4b9bdf 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-left.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-left.ecore
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root">
- <eSubpackages name="lib" nsURI="">
- <eClassifiers xsi:type="ecore:EClass" name="A"/>
- <eClassifiers xsi:type="ecore:EClass" name="B"/>
- <eClassifiers xsi:type="ecore:EClass" name="C"/>
- <eClassifiers xsi:type="ecore:EClass" name="D"/>
- <eClassifiers xsi:type="ecore:EClass" name="E"/>
- <eClassifiers xsi:type="ecore:EClass" name="F"/>
- <eClassifiers xsi:type="ecore:EClass" name="G"/>
- <eClassifiers xsi:type="ecore:EClass" name="H"/>
- <eClassifiers xsi:type="ecore:EClass" name="I"/>
- <eClassifiers xsi:type="ecore:EClass" name="J"/>
- <eClassifiers xsi:type="ecore:EClass" name="K"/>
- <eClassifiers xsi:type="ecore:EClass" name="L"/>
- <eClassifiers xsi:type="ecore:EClass" name="M"/>
- <eClassifiers xsi:type="ecore:EClass" name="N"/>
- </eSubpackages>
- <eSubpackages name="application">
- <eClassifiers xsi:type="ecore:EClass" name="TheReferencer" eSuperTypes="#//lib/A #//lib/B #//lib/C #//lib/D #//lib/E #//lib/F #//lib/G #//lib/H #//lib/I #//lib/J #//lib/K #//lib/L #//lib/M #//lib/N"/>
- </eSubpackages>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root">
+ <eSubpackages name="lib" nsURI="">
+ <eClassifiers xsi:type="ecore:EClass" name="A"/>
+ <eClassifiers xsi:type="ecore:EClass" name="B"/>
+ <eClassifiers xsi:type="ecore:EClass" name="C"/>
+ <eClassifiers xsi:type="ecore:EClass" name="D"/>
+ <eClassifiers xsi:type="ecore:EClass" name="E"/>
+ <eClassifiers xsi:type="ecore:EClass" name="F"/>
+ <eClassifiers xsi:type="ecore:EClass" name="G"/>
+ <eClassifiers xsi:type="ecore:EClass" name="H"/>
+ <eClassifiers xsi:type="ecore:EClass" name="I"/>
+ <eClassifiers xsi:type="ecore:EClass" name="J"/>
+ <eClassifiers xsi:type="ecore:EClass" name="K"/>
+ <eClassifiers xsi:type="ecore:EClass" name="L"/>
+ <eClassifiers xsi:type="ecore:EClass" name="M"/>
+ <eClassifiers xsi:type="ecore:EClass" name="N"/>
+ </eSubpackages>
+ <eSubpackages name="application">
+ <eClassifiers xsi:type="ecore:EClass" name="TheReferencer" eSuperTypes="#//lib/A #//lib/B #//lib/C #//lib/D #//lib/E #//lib/F #//lib/G #//lib/H #//lib/I #//lib/J #//lib/K #//lib/L #//lib/M #//lib/N"/>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-right.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-right.ecore
index 804bd5763..0681bb5b1 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-right.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/391798-right.ecore
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root">
- <eSubpackages name="lib" nsURI="">
- <eClassifiers xsi:type="ecore:EClass" name="A"/>
- <eClassifiers xsi:type="ecore:EClass" name="B"/>
- <eClassifiers xsi:type="ecore:EClass" name="C"/>
- <eClassifiers xsi:type="ecore:EClass" name="D"/>
- <eClassifiers xsi:type="ecore:EClass" name="E"/>
- <eClassifiers xsi:type="ecore:EClass" name="F"/>
- <eClassifiers xsi:type="ecore:EClass" name="G"/>
- <eClassifiers xsi:type="ecore:EClass" name="H"/>
- <eClassifiers xsi:type="ecore:EClass" name="I"/>
- <eClassifiers xsi:type="ecore:EClass" name="J"/>
- <eClassifiers xsi:type="ecore:EClass" name="K"/>
- <eClassifiers xsi:type="ecore:EClass" name="L"/>
- <eClassifiers xsi:type="ecore:EClass" name="M"/>
- <eClassifiers xsi:type="ecore:EClass" name="N"/>
- </eSubpackages>
- <eSubpackages name="application">
- <eClassifiers xsi:type="ecore:EClass" name="TheReferencer" eSuperTypes="#//lib/G #//lib/F #//lib/I #//lib/H #//lib/M #//lib/E #//lib/N #//lib/C #//lib/L #//lib/B #//lib/K #//lib/A #//lib/J #//lib/D"/>
- </eSubpackages>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root">
+ <eSubpackages name="lib" nsURI="">
+ <eClassifiers xsi:type="ecore:EClass" name="A"/>
+ <eClassifiers xsi:type="ecore:EClass" name="B"/>
+ <eClassifiers xsi:type="ecore:EClass" name="C"/>
+ <eClassifiers xsi:type="ecore:EClass" name="D"/>
+ <eClassifiers xsi:type="ecore:EClass" name="E"/>
+ <eClassifiers xsi:type="ecore:EClass" name="F"/>
+ <eClassifiers xsi:type="ecore:EClass" name="G"/>
+ <eClassifiers xsi:type="ecore:EClass" name="H"/>
+ <eClassifiers xsi:type="ecore:EClass" name="I"/>
+ <eClassifiers xsi:type="ecore:EClass" name="J"/>
+ <eClassifiers xsi:type="ecore:EClass" name="K"/>
+ <eClassifiers xsi:type="ecore:EClass" name="L"/>
+ <eClassifiers xsi:type="ecore:EClass" name="M"/>
+ <eClassifiers xsi:type="ecore:EClass" name="N"/>
+ </eSubpackages>
+ <eSubpackages name="application">
+ <eClassifiers xsi:type="ecore:EClass" name="TheReferencer" eSuperTypes="#//lib/G #//lib/F #//lib/I #//lib/H #//lib/M #//lib/E #//lib/N #//lib/C #//lib/L #//lib/B #//lib/K #//lib/A #//lib/J #//lib/D"/>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/DistanceMatchInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/DistanceMatchInputData.java
index 9befeca51..4640e4dfa 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/DistanceMatchInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/DistanceMatchInputData.java
@@ -1,109 +1,109 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison.data.distance;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-@SuppressWarnings("nls")
-public class DistanceMatchInputData extends AbstractInputData {
-
- public Resource getCompareLeft() throws IOException {
- return loadFromClassLoader("compareLeft.ecore");
- }
-
- public Resource getCompareRight() throws IOException {
- return loadFromClassLoader("compareRight.ecore");
- }
-
- public Resource getNominalUMLLeft() throws IOException {
- return loadFromClassLoader("agencyLeft.uml");
- }
-
- public Resource getNominalUMLRight() throws IOException {
- return loadFromClassLoader("agencyRight.uml");
- }
-
- public Resource getNominalUMLOrigin() throws IOException {
- return loadFromClassLoader("agencyOrigin.uml");
- }
-
- public Resource getVerySmallLeft() throws IOException {
- return loadFromClassLoader("verySmallLeft.ecore");
- }
-
- public Resource getVerySmallRight() throws IOException {
- return loadFromClassLoader("verySmallRight.ecore");
- }
-
- public Resource getPackageAddDeleteLeft() throws IOException {
- return loadFromClassLoader("package-add-delete.ecore");
- }
-
- public Resource getPackageAddDeleteRight() throws IOException {
- return loadFromClassLoader("package-add-deletev2.ecore");
- }
-
- public Resource getAbstractAndSuperLeft() throws IOException {
- return loadFromClassLoader("abstract-and-super.ecore");
- }
-
- public Resource getAbstractAndSuperRight() throws IOException {
- return loadFromClassLoader("abstract-and-superv2.ecore");
- }
-
- public Resource getFeatureUpdateDeleteLeft() throws IOException {
- return loadFromClassLoader("feature-update-delete.ecore");
- }
-
- public Resource getFeatureUpdateDeleteRight() throws IOException {
- return loadFromClassLoader("feature-update-deletev2.ecore");
- }
-
- public Resource getPackageAddRemoveNoRenameLeft() throws IOException {
- return loadFromClassLoader("add-remove-norename.ecore");
- }
-
- public Resource getPackageAddRemoveNoRenameRight() throws IOException {
- return loadFromClassLoader("add-remove-norenamev2.ecore");
- }
-
- public Resource get391657Right() throws IOException {
- return loadFromClassLoader("391657-right.ecore");
- }
-
- public Resource get391657Left() throws IOException {
- return loadFromClassLoader("391657-left.ecore");
- }
-
- public Resource get390666Left() throws IOException {
- return loadFromClassLoader("390666-left.ecore");
- }
-
- public Resource get390666Right() throws IOException {
- return loadFromClassLoader("390666-right.ecore");
- }
-
- public Resource get390666Ancestor() throws IOException {
- return loadFromClassLoader("390666-ancestor.ecore");
- }
-
- public Resource get391798Left() throws IOException {
- return loadFromClassLoader("391798-left.ecore");
- }
-
- public Resource get391798Right() throws IOException {
- return loadFromClassLoader("391798-right.ecore");
- }
-
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison.data.distance;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+@SuppressWarnings("nls")
+public class DistanceMatchInputData extends AbstractInputData {
+
+ public Resource getCompareLeft() throws IOException {
+ return loadFromClassLoader("compareLeft.ecore");
+ }
+
+ public Resource getCompareRight() throws IOException {
+ return loadFromClassLoader("compareRight.ecore");
+ }
+
+ public Resource getNominalUMLLeft() throws IOException {
+ return loadFromClassLoader("agencyLeft.uml");
+ }
+
+ public Resource getNominalUMLRight() throws IOException {
+ return loadFromClassLoader("agencyRight.uml");
+ }
+
+ public Resource getNominalUMLOrigin() throws IOException {
+ return loadFromClassLoader("agencyOrigin.uml");
+ }
+
+ public Resource getVerySmallLeft() throws IOException {
+ return loadFromClassLoader("verySmallLeft.ecore");
+ }
+
+ public Resource getVerySmallRight() throws IOException {
+ return loadFromClassLoader("verySmallRight.ecore");
+ }
+
+ public Resource getPackageAddDeleteLeft() throws IOException {
+ return loadFromClassLoader("package-add-delete.ecore");
+ }
+
+ public Resource getPackageAddDeleteRight() throws IOException {
+ return loadFromClassLoader("package-add-deletev2.ecore");
+ }
+
+ public Resource getAbstractAndSuperLeft() throws IOException {
+ return loadFromClassLoader("abstract-and-super.ecore");
+ }
+
+ public Resource getAbstractAndSuperRight() throws IOException {
+ return loadFromClassLoader("abstract-and-superv2.ecore");
+ }
+
+ public Resource getFeatureUpdateDeleteLeft() throws IOException {
+ return loadFromClassLoader("feature-update-delete.ecore");
+ }
+
+ public Resource getFeatureUpdateDeleteRight() throws IOException {
+ return loadFromClassLoader("feature-update-deletev2.ecore");
+ }
+
+ public Resource getPackageAddRemoveNoRenameLeft() throws IOException {
+ return loadFromClassLoader("add-remove-norename.ecore");
+ }
+
+ public Resource getPackageAddRemoveNoRenameRight() throws IOException {
+ return loadFromClassLoader("add-remove-norenamev2.ecore");
+ }
+
+ public Resource get391657Right() throws IOException {
+ return loadFromClassLoader("391657-right.ecore");
+ }
+
+ public Resource get391657Left() throws IOException {
+ return loadFromClassLoader("391657-left.ecore");
+ }
+
+ public Resource get390666Left() throws IOException {
+ return loadFromClassLoader("390666-left.ecore");
+ }
+
+ public Resource get390666Right() throws IOException {
+ return loadFromClassLoader("390666-right.ecore");
+ }
+
+ public Resource get390666Ancestor() throws IOException {
+ return loadFromClassLoader("390666-ancestor.ecore");
+ }
+
+ public Resource get391798Left() throws IOException {
+ return loadFromClassLoader("391798-left.ecore");
+ }
+
+ public Resource get391798Right() throws IOException {
+ return loadFromClassLoader("391798-right.ecore");
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norename.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norename.ecore
index 8f8235ede..e0a0ccd09 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norename.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norename.ecore
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="ExistsInBoth"/>
- <eClassifiers xsi:type="ecore:EClass" name="OnlyInDocument"/>
- <eSubpackages name="sub" nsURI="sub" nsPrefix="sub"/>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="ExistsInBoth"/>
+ <eClassifiers xsi:type="ecore:EClass" name="OnlyInDocument"/>
+ <eSubpackages name="sub" nsURI="sub" nsPrefix="sub"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norenamev2.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norenamev2.ecore
index 23bdf10ed..56456f400 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norenamev2.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/add-remove-norenamev2.ecore
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="ExistsInBoth"/>
- <eSubpackages name="sub" nsURI="sub" nsPrefix="sub">
- <eClassifiers xsi:type="ecore:EClass" name="OnlyInWorkingCopy"/>
- </eSubpackages>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="ExistsInBoth"/>
+ <eSubpackages name="sub" nsURI="sub" nsPrefix="sub">
+ <eClassifiers xsi:type="ecore:EClass" name="OnlyInWorkingCopy"/>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-delete.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-delete.ecore
index d4e1d1c55..35d493988 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-delete.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-delete.ecore
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-deletev2.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-deletev2.ecore
index e47f80058..72223e8a4 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-deletev2.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/feature-update-deletev2.ecore
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
- <eClassifiers xsi:type="ecore:EClass" name="A">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" lowerBound="1" upperBound="-1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" lowerBound="1" upperBound="4"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="a3" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testPackage" nsURI="testPackageURI" nsPrefix="testPackagePrefix">
+ <eClassifiers xsi:type="ecore:EClass" name="A">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a1" lowerBound="1" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a2" lowerBound="1" upperBound="4"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a3" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-delete.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-delete.ecore
index 7d31bd753..33ee15f3d 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-delete.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-delete.ecore
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- name="p1" nsURI="p1" nsPrefix="p1">
- <eSubpackages name="p2" nsURI="p2" nsPrefix="p2">
- <eSubpackages name="subPackage" nsURI="subPackage" nsPrefix="subPackage"/>
- </eSubpackages>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ name="p1" nsURI="p1" nsPrefix="p1">
+ <eSubpackages name="p2" nsURI="p2" nsPrefix="p2">
+ <eSubpackages name="subPackage" nsURI="subPackage" nsPrefix="subPackage"/>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-deletev2.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-deletev2.ecore
index d79390dcd..20a2c7f34 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-deletev2.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/distance/package-add-deletev2.ecore
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- name="p1" nsURI="p1" nsPrefix="p1">
- <eSubpackages name="p2" nsURI="p2" nsPrefix="p2"/>
- <eSubpackages name="another" nsURI="another" nsPrefix="another"/>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ name="p1" nsURI="p1" nsPrefix="p1">
+ <eSubpackages name="p2" nsURI="p2" nsPrefix="p2"/>
+ <eSubpackages name="another" nsURI="another" nsPrefix="another"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/dynamic/DynamicInstancesInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/dynamic/DynamicInstancesInputData.java
index 2d9e579db..95c722d5b 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/dynamic/DynamicInstancesInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/dynamic/DynamicInstancesInputData.java
@@ -1,90 +1,90 @@
-/**
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison.data.dynamic;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-
-@SuppressWarnings({"nls", "unchecked", })
-public class DynamicInstancesInputData extends AbstractInputData {
-
- private EPackage pak;
-
- private EClass testElement;
-
- private EClass container;
-
- private EObject containerInstance;
-
- public DynamicInstancesInputData() {
- pak = EcoreFactory.eINSTANCE.createEPackage();
- pak.setNsURI("testPackageNSURI");
- pak.setName("testPackage");
- pak.setNsPrefix("testPackagePrefix");
- testElement = EcoreFactory.eINSTANCE.createEClass();
- pak.getEClassifiers().add(testElement);
- testElement.setName("TestElement");
- container = EcoreFactory.eINSTANCE.createEClass();
- pak.getEClassifiers().add(container);
- container.setName("Container");
- EReference content = EcoreFactory.eINSTANCE.createEReference();
- content.setContainment(true);
- content.setEType(testElement);
- content.setName("content");
- content.setUpperBound(-1);
- container.getEStructuralFeatures().add(content);
- EAttribute name = EcoreFactory.eINSTANCE.createEAttribute();
- name.setEType(EcorePackage.eINSTANCE.getEString());
- name.setName("name");
- testElement.getEStructuralFeatures().add(name);
-
- containerInstance = EcoreUtil.create(container);
- EObject element1 = EcoreUtil.create(testElement);
- element1.eSet(testElement.getEStructuralFeature("name"), "some element");
- EObject element2 = EcoreUtil.create(testElement);
- element2.eSet(testElement.getEStructuralFeature("name"), "some other element");
- ((Collection<EObject>)containerInstance.eGet(container.getEStructuralFeature("content")))
- .add(element1);
- ((Collection<EObject>)containerInstance.eGet(container.getEStructuralFeature("content")))
- .add(element2);
-
- }
-
- public Resource getCompareLeft() throws IOException {
- Resource res = new XMIResourceImpl(URI.createURI("http://model.xmi", true));
- res.getContents().add(containerInstance);
- return res;
- }
-
- public Resource getCompareRight() throws IOException {
- EObject copy = EcoreUtil.copy(containerInstance);
- Resource res = new XMIResourceImpl(URI.createURI("http://modelv2.xmi", true));
- res.getContents().add(copy);
- EObject element3 = EcoreUtil.create(testElement);
- element3.eSet(testElement.getEStructuralFeature("name"), "added element");
- ((Collection<EObject>)copy.eGet(container.getEStructuralFeature("content"))).add(element3);
- return res;
- }
-
-}
+/**
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison.data.dynamic;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+
+@SuppressWarnings({"nls", "unchecked", })
+public class DynamicInstancesInputData extends AbstractInputData {
+
+ private EPackage pak;
+
+ private EClass testElement;
+
+ private EClass container;
+
+ private EObject containerInstance;
+
+ public DynamicInstancesInputData() {
+ pak = EcoreFactory.eINSTANCE.createEPackage();
+ pak.setNsURI("testPackageNSURI");
+ pak.setName("testPackage");
+ pak.setNsPrefix("testPackagePrefix");
+ testElement = EcoreFactory.eINSTANCE.createEClass();
+ pak.getEClassifiers().add(testElement);
+ testElement.setName("TestElement");
+ container = EcoreFactory.eINSTANCE.createEClass();
+ pak.getEClassifiers().add(container);
+ container.setName("Container");
+ EReference content = EcoreFactory.eINSTANCE.createEReference();
+ content.setContainment(true);
+ content.setEType(testElement);
+ content.setName("content");
+ content.setUpperBound(-1);
+ container.getEStructuralFeatures().add(content);
+ EAttribute name = EcoreFactory.eINSTANCE.createEAttribute();
+ name.setEType(EcorePackage.eINSTANCE.getEString());
+ name.setName("name");
+ testElement.getEStructuralFeatures().add(name);
+
+ containerInstance = EcoreUtil.create(container);
+ EObject element1 = EcoreUtil.create(testElement);
+ element1.eSet(testElement.getEStructuralFeature("name"), "some element");
+ EObject element2 = EcoreUtil.create(testElement);
+ element2.eSet(testElement.getEStructuralFeature("name"), "some other element");
+ ((Collection<EObject>)containerInstance.eGet(container.getEStructuralFeature("content")))
+ .add(element1);
+ ((Collection<EObject>)containerInstance.eGet(container.getEStructuralFeature("content")))
+ .add(element2);
+
+ }
+
+ public Resource getCompareLeft() throws IOException {
+ Resource res = new XMIResourceImpl(URI.createURI("http://model.xmi", true));
+ res.getContents().add(containerInstance);
+ return res;
+ }
+
+ public Resource getCompareRight() throws IOException {
+ EObject copy = EcoreUtil.copy(containerInstance);
+ Resource res = new XMIResourceImpl(URI.createURI("http://modelv2.xmi", true));
+ res.getContents().add(copy);
+ EObject element3 = EcoreUtil.create(testElement);
+ element3.eSet(testElement.getEStructuralFeature("name"), "added element");
+ ((Collection<EObject>)copy.eGet(container.getEStructuralFeature("content"))).add(element3);
+ return res;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/IdentifierMatchInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/IdentifierMatchInputData.java
index 4be9ed51e..ba23f4fdb 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/IdentifierMatchInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/IdentifierMatchInputData.java
@@ -1,36 +1,36 @@
-/**
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.fullcomparison.data.identifier;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- * Provides input models to the unit tests of the matching by id.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("nls")
-public class IdentifierMatchInputData extends AbstractInputData {
- public Resource getExtlibraryLeft() throws IOException {
- return loadFromClassLoader("extlibraryLeft.ecore");
- }
-
- public Resource getExtlibraryRight() throws IOException {
- return loadFromClassLoader("extlibraryRight.ecore");
- }
-
- public Resource getExtlibraryOrigin() throws IOException {
- return loadFromClassLoader("extlibraryOrigin.ecore");
- }
-}
+/**
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.fullcomparison.data.identifier;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * Provides input models to the unit tests of the matching by id.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@SuppressWarnings("nls")
+public class IdentifierMatchInputData extends AbstractInputData {
+ public Resource getExtlibraryLeft() throws IOException {
+ return loadFromClassLoader("extlibraryLeft.ecore");
+ }
+
+ public Resource getExtlibraryRight() throws IOException {
+ return loadFromClassLoader("extlibraryRight.ecore");
+ }
+
+ public Resource getExtlibraryOrigin() throws IOException {
+ return loadFromClassLoader("extlibraryOrigin.ecore");
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryLeft.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryLeft.ecore
index 65e2fb1e1..b26cef279 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryLeft.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryLeft.ecore
@@ -1,109 +1,109 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- <eLiterals xmi:id="_XID4MG9IEeG7V_vNzpYwOw" name="Encyclopedia" value="3" literal="Encyclopedia"/>
- <eLiterals xmi:id="_XIEfQG9IEeG7V_vNzpYwOw" name="Dictionary" value="4"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Borrowable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="length" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIJ-0G9IEeG7V_vNzpYwOw" name="fullName">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_XIKl4W9IEeG7V_vNzpYwOw" name="Magazine" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl429IEeG7V_vNzpYwOw" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl5W9IEeG7V_vNzpYwOw" name="pages">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ <eLiterals xmi:id="_XID4MG9IEeG7V_vNzpYwOw" name="Encyclopedia" value="3" literal="Encyclopedia"/>
+ <eLiterals xmi:id="_XIEfQG9IEeG7V_vNzpYwOw" name="Dictionary" value="4"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Borrowable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="length" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIJ-0G9IEeG7V_vNzpYwOw" name="fullName">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_XIKl4W9IEeG7V_vNzpYwOw" name="Magazine" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl429IEeG7V_vNzpYwOw" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_XIKl5W9IEeG7V_vNzpYwOw" name="pages">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryOrigin.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryOrigin.ecore
index 980acf487..c891aa81b 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryOrigin.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryOrigin.ecore
@@ -1,111 +1,111 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbRW60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutesLength" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpY260EeGkd4g88tZXfA" name="reader" eType="_15N3gm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="lastName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146VgW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbRW60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCUm60EeGkd4g88tZXfA" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutesLength" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpY260EeGkd4g88tZXfA" name="reader" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="lastName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryRight.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryRight.ecore
index f9cd2e823..09d5b0720 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryRight.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/fullcomparison/data/identifier/extlibraryRight.ecore
@@ -1,112 +1,112 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9MlYMG9IEeGekPcBm25hwQ" name="subtitle">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
- <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
- </eAnnotations>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
- <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
- <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
- </eAnnotations>
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
- <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
- <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
- <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
- <eLiterals xmi:id="_9Mw-YG9IEeGekPcBm25hwQ" name="Manga" value="3" literal="Manga"/>
- <eLiterals xmi:id="_9Mw-YW9IEeGekPcBm25hwQ" name="Manhwa" value="5"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutes" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="familyName" lowerBound="1">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
- <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ysW9IEeGekPcBm25hwQ" name="Magazine" eSuperTypes="_15LbQ260EeGkd4g88tZXfA"/>
- <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ys29IEeGekPcBm25hwQ" name="TitledItem">
- <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9M9ytG9IEeGekPcBm25hwQ" name="title">
- <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eStructuralFeatures>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:id="_14sTEG60EeGkd4g88tZXfA" name="extlibrary" nsURI="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" nsPrefix="extlib">
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_146VgG60EeGkd4g88tZXfA" name="Book" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_146Vg260EeGkd4g88tZXfA" name="pages" defaultValueLiteral="100">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_1468kW60EeGkd4g88tZXfA" name="category" eType="_15F7sG60EeGkd4g88tZXfA" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148KsG60EeGkd4g88tZXfA" name="author" lowerBound="1" eType="_15CRUW60EeGkd4g88tZXfA" eOpposite="_15EGgG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9MlYMG9IEeGekPcBm25hwQ" name="subtitle">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_148KsW60EeGkd4g88tZXfA" name="Library" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_148Ksm60EeGkd4g88tZXfA" name="name">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_148xwW60EeGkd4g88tZXfA" name="writers" upperBound="-1" eType="_15CRUW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_148xwm60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_148xw260EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_149Y0G60EeGkd4g88tZXfA" name="employees" upperBound="-1" eType="_15OekG60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_149Y0W60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_149Y0m60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15AcIG60EeGkd4g88tZXfA" name="borrowers" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
+ <eAnnotations xmi:id="_15AcIW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BDMG60EeGkd4g88tZXfA" key="group" value="#people"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMW60EeGkd4g88tZXfA" name="stock" ordered="false" upperBound="-1" eType="_15Hw4m60EeGkd4g88tZXfA" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BDMm60EeGkd4g88tZXfA" name="books" ordered="false" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" transient="true" derived="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQG60EeGkd4g88tZXfA" name="branches" upperBound="-1" eType="_148KsW60EeGkd4g88tZXfA" containment="true" eOpposite="_15BqQm60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15BqQm60EeGkd4g88tZXfA" name="parentBranch" eType="_148KsW60EeGkd4g88tZXfA" eOpposite="_15BqQG60EeGkd4g88tZXfA"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15BqRG60EeGkd4g88tZXfA" name="people" upperBound="-1">
+ <eAnnotations xmi:id="_15BqRW60EeGkd4g88tZXfA" source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details xmi:id="_15BqRm60EeGkd4g88tZXfA" key="kind" value="group"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15CRUW60EeGkd4g88tZXfA" name="Writer" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15CRUm60EeGkd4g88tZXfA" name="name" volatile="true" transient="true">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15EGgG60EeGkd4g88tZXfA" name="books" upperBound="-1" eType="_146VgG60EeGkd4g88tZXfA" eOpposite="_148KsG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" xmi:id="_15F7sG60EeGkd4g88tZXfA" name="BookCategory">
+ <eLiterals xmi:id="_15HJ0G60EeGkd4g88tZXfA" name="Mystery"/>
+ <eLiterals xmi:id="_15Hw4G60EeGkd4g88tZXfA" name="ScienceFiction" value="1"/>
+ <eLiterals xmi:id="_15Hw4W60EeGkd4g88tZXfA" name="Biography" value="2"/>
+ <eLiterals xmi:id="_9Mw-YG9IEeGekPcBm25hwQ" name="Manga" value="3" literal="Manga"/>
+ <eLiterals xmi:id="_9Mw-YW9IEeGekPcBm25hwQ" name="Manhwa" value="5"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15Hw4m60EeGkd4g88tZXfA" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15Hw4260EeGkd4g88tZXfA" name="publicationDate">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15IX8G60EeGkd4g88tZXfA" name="Lendable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15JmEG60EeGkd4g88tZXfA" name="copies" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15JmEm60EeGkd4g88tZXfA" name="borrowers" ordered="false" upperBound="-1" eType="_15NQcW60EeGkd4g88tZXfA" eOpposite="_15N3gG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQG60EeGkd4g88tZXfA" name="CirculatingItem" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _15IX8G60EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15LbQ260EeGkd4g88tZXfA" name="Periodical" abstract="true" eSuperTypes="_15Hw4m60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15LbR260EeGkd4g88tZXfA" name="issuesPerYear" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MCUG60EeGkd4g88tZXfA" name="AudioVisualItem" abstract="true" eSuperTypes="_15LbQG60EeGkd4g88tZXfA _9M9ys29IEeGekPcBm25hwQ">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVG60EeGkd4g88tZXfA" name="minutes" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15MCVm60EeGkd4g88tZXfA" name="damaged">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpYW60EeGkd4g88tZXfA" name="BookOnTape" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15MpZG60EeGkd4g88tZXfA" name="author" eType="_15CRUW60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15MpZm60EeGkd4g88tZXfA" name="VideoCassette" eSuperTypes="_15MCUG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15NQcG60EeGkd4g88tZXfA" name="cast" upperBound="-1" eType="_15N3gm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15NQcW60EeGkd4g88tZXfA" name="Borrower" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15N3gG60EeGkd4g88tZXfA" name="borrowed" upperBound="-1" eType="_15IX8G60EeGkd4g88tZXfA" eOpposite="_15JmEm60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15N3gm60EeGkd4g88tZXfA" name="Person" eSuperTypes="_15OelG60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3g260EeGkd4g88tZXfA" name="firstName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15N3hW60EeGkd4g88tZXfA" name="familyName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OekG60EeGkd4g88tZXfA" name="Employee" eSuperTypes="_15N3gm60EeGkd4g88tZXfA">
+ <eStructuralFeatures xsi:type="ecore:EReference" xmi:id="_15Oekm60EeGkd4g88tZXfA" name="manager" eType="_15OekG60EeGkd4g88tZXfA"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_15OelG60EeGkd4g88tZXfA" name="Addressable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_15OelW60EeGkd4g88tZXfA" name="address">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ysW9IEeGekPcBm25hwQ" name="Magazine" eSuperTypes="_15LbQ260EeGkd4g88tZXfA"/>
+ <eClassifiers xsi:type="ecore:EClass" xmi:id="_9M9ys29IEeGekPcBm25hwQ" name="TitledItem">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" xmi:id="_9M9ytG9IEeGekPcBm25hwQ" name="title">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ExtensionMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ExtensionMergeTest.java
index 76cad4282..9c407662c 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ExtensionMergeTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ExtensionMergeTest.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.merge;
-
-import static com.google.common.base.Predicates.and;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.merge.AbstractMerger;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ExtensionMergeTest {
- private IndividualDiffInputData input = new IndividualDiffInputData();
-
- @Test
- public void testInstantiationMerger() throws IOException {
- final Resource left = input.getAttributeMonoChangeLeft();
- final Resource right = input.getAttributeMonoChangeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- IMerger merger = getMerger(IMerger.RegistryImpl.createStandaloneInstance(), diff,
- AbstractMerger.class);
- merger.copyLeftToRight(diff, null);
-
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- public static IMerger getMerger(final IMerger.Registry registry, final Diff diff,
- final Class<? extends IMerger> expectedMerger) {
- IMerger merger = registry.getHighestRankingMerger(diff);
- assertNotNull("No merger has been found for the diff: " + diff, merger);
- assertTrue("The found merger is not the expexted Merger", expectedMerger.isInstance(merger));
- return merger;
- }
-
- private EObject getNodeNamed(Resource res, String name) {
- final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
- while (iterator.hasNext()) {
- final EObject next = iterator.next();
- final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
- if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
- return next;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.merge.AbstractMerger;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ExtensionMergeTest {
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ @Test
+ public void testInstantiationMerger() throws IOException {
+ final Resource left = input.getAttributeMonoChangeLeft();
+ final Resource right = input.getAttributeMonoChangeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ IMerger merger = getMerger(IMerger.RegistryImpl.createStandaloneInstance(), diff,
+ AbstractMerger.class);
+ merger.copyLeftToRight(diff, null);
+
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ public static IMerger getMerger(final IMerger.Registry registry, final Diff diff,
+ final Class<? extends IMerger> expectedMerger) {
+ IMerger merger = registry.getHighestRankingMerger(diff);
+ assertNotNull("No merger has been found for the diff: " + diff, merger);
+ assertTrue("The found merger is not the expexted Merger", expectedMerger.isInstance(merger));
+ return merger;
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeOutOfScopeValuesTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeOutOfScopeValuesTest.java
index fb653cbe2..b41b4a71a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeOutOfScopeValuesTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeOutOfScopeValuesTest.java
@@ -1,2186 +1,2186 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.merge;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.junit.Test;
-
-@SuppressWarnings({"nls", "unchecked" })
-public class IndividualMergeOutOfScopeValuesTest {
- private IndividualDiffInputData input = new IndividualDiffInputData();
-
- private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
-
- @Test
- public void testReferenceMonoChange2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource right = input.getReferenceMonoChangeRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource right = input.getReferenceMonoChangeRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource right = input.getReferenceMonoChangeRightOutOfScope();
- final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- // We need left and right to point to the same proxy uri after the merge
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
- // Though the origin did not change and still points to the "old" proxy
- assertFalse(((InternalEObject)leftValue).eProxyURI().equals(
- ((InternalEObject)originValue).eProxyURI()));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource right = input.getReferenceMonoChangeRightOutOfScope();
- final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- // We need left and right to point to the same proxy uri after the merge
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
- // And coincidentally, "origin" also points to that same proxy in this case
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)originValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoChangeRightOutOfScope();
- final Resource right = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- // We need left and right to point to the same proxy uri after the merge
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
- // And coincidentally, "origin" also points to that same proxy in this case
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)originValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoChangeRightOutOfScope();
- final Resource right = input.getReferenceMonoChangeLeftOutOfScope();
- final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- // We need left and right to point to the same proxy uri after the merge
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
- // Though the origin did not change and still points to the "old" proxy
- assertFalse(((InternalEObject)leftValue).eProxyURI().equals(
- ((InternalEObject)originValue).eProxyURI()));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoSetLeftOutOfScope();
- final Resource right = input.getReferenceMonoSetRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoSetLeftOutOfScope();
- final Resource right = input.getReferenceMonoSetRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoSetLeftOutOfScope();
- final Resource right = input.getReferenceMonoSetRightOutOfScope();
- final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertNull(originValue);
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoSetLeftOutOfScope();
- final Resource right = input.getReferenceMonoSetRightOutOfScope();
- final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
- assertNull(originValue);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoSetRightOutOfScope();
- final Resource right = input.getReferenceMonoSetLeftOutOfScope();
- final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
- assertNull(originValue);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoSetRightOutOfScope();
- final Resource right = input.getReferenceMonoSetLeftOutOfScope();
- final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertNull(originValue);
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
- final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
- assertTrue(originValue.eIsProxy());
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
- final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoUnsetRightOutOfScope();
- final Resource right = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertTrue(leftValue.eIsProxy());
- assertTrue(rightValue.eIsProxy());
- assertTrue(originValue.eIsProxy());
-
- assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoUnsetRightOutOfScope();
- final Resource right = input.getReferenceMonoUnsetLeftOutOfScope();
- final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
- final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
- final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
-
- assertNull(leftValue);
- assertNull(rightValue);
- assertTrue(originValue.eIsProxy());
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiAddLeftOutOfScope();
- final Resource right = input.getReferenceMultiAddRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiAddLeftOutOfScope();
- final Resource right = input.getReferenceMultiAddRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiAddLeftOutOfScope();
- final Resource right = input.getReferenceMultiAddRightOutOfScope();
- final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
- assertEquals(2, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(-1, originProxyIndex);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiAddLeftOutOfScope();
- final Resource right = input.getReferenceMultiAddRightOutOfScope();
- final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
- assertEquals(-1, originProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiAddRightOutOfScope();
- final Resource right = input.getReferenceMultiAddLeftOutOfScope();
- final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
- assertEquals(-1, originProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiAddRightOutOfScope();
- final Resource right = input.getReferenceMultiAddLeftOutOfScope();
- final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
- assertEquals(2, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(-1, originProxyIndex);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiDelLeftOutOfScope();
- final Resource right = input.getReferenceMultiDelRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiDelLeftOutOfScope();
- final Resource right = input.getReferenceMultiDelRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiDelLeftOutOfScope();
- final Resource right = input.getReferenceMultiDelRightOutOfScope();
- final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(3, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
- // "deleted" value is the third (0-based)
- assertEquals(2, originProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiDelRightOutOfScope();
- final Resource right = input.getReferenceMultiDelLeftOutOfScope();
- final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(3, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertEquals(-1, leftProxyIndex);
- assertEquals(-1, rightProxyIndex);
- // "deleted" value is the third (0-based)
- assertEquals(2, originProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiDelRightOutOfScope();
- final Resource right = input.getReferenceMultiDelLeftOutOfScope();
- final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
- assertEquals(3, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- // "deleted" value is the third (0-based)
- assertEquals(2, originProxyIndex);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiDelLeftOutOfScope();
- final Resource right = input.getReferenceMultiDelRightOutOfScope();
- final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(3, leftValue.size());
- assertEquals(3, rightValue.size());
- assertEquals(3, originValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = -1;
- int rightProxyIndex = -1;
- int originProxyIndex = -1;
- for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
- final EObject candidate = leftValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- leftProxyIndex = i;
- }
- }
- for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
- final EObject candidate = rightValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- rightProxyIndex = i;
- }
- }
- for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
- final EObject candidate = originValue.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- originProxyIndex = i;
- }
- }
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- // "deleted" value is the third (0-based)
- assertEquals(2, originProxyIndex);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource right = input.getReferenceMultiMoveRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource right = input.getReferenceMultiMoveRightOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource right = input.getReferenceMultiMoveRightOutOfScope();
- final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
- assertEquals(rightProxyIndex, originProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
- assertFalse(leftProxyIndex == originProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource right = input.getReferenceMultiMoveRightOutOfScope();
- final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
- assertEquals(rightProxyIndex, originProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
- assertEquals(leftProxyIndex, originProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiMoveRightOutOfScope();
- final Resource right = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
- assertEquals(leftProxyIndex, originProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
- assertEquals(leftProxyIndex, originProxyIndex);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiMove3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiMoveRightOutOfScope();
- final Resource right = input.getReferenceMultiMoveLeftOutOfScope();
- final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- assertTrue(differences.get(0) instanceof ReferenceChange);
-
- final ReferenceChange diff = (ReferenceChange)differences.get(0);
-
- assertTrue(diff.getValue().eIsProxy());
- assertEquals(featureName, diff.getReference().getName());
-
- final EObject leftDiffContainer = getNodeNamed(left, "origin");
- final EObject rightDiffContainer = getNodeNamed(right, "origin");
- final EObject originDiffContainer = getNodeNamed(origin, "origin");
- assertSame(leftDiffContainer, diff.getMatch().getLeft());
- assertSame(rightDiffContainer, diff.getMatch().getRight());
- assertSame(originDiffContainer, diff.getMatch().getOrigin());
-
- final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, rightValue.size());
-
- final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
- int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertFalse(leftProxyIndex == rightProxyIndex);
- assertEquals(leftProxyIndex, originProxyIndex);
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- // The proxy should not have been resolved by the merge operation
- assertTrue(diff.getValue().eIsProxy());
-
- leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
- rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
- originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
-
- assertEquals(2, leftValue.size());
- assertEquals(2, rightValue.size());
- assertEquals(2, originValue.size());
-
- leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
- rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
- originProxyIndex = findProxyIndexIn(proxyURI, originValue);
-
- assertTrue(leftProxyIndex != -1);
- assertTrue(rightProxyIndex != -1);
- assertTrue(originProxyIndex != -1);
- assertEquals(leftProxyIndex, rightProxyIndex);
- assertFalse(leftProxyIndex == originProxyIndex);
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- private EObject getNodeNamed(Resource res, String name) {
- final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
- while (iterator.hasNext()) {
- final EObject next = iterator.next();
- final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
- if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
- return next;
- }
- }
- return null;
- }
-
- private int findProxyIndexIn(URI proxyURI, List<EObject> list) {
- for (int i = 0; i < list.size(); i++) {
- final EObject candidate = list.get(i);
- if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
- return i;
- }
- }
- return -1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+@SuppressWarnings({"nls", "unchecked" })
+public class IndividualMergeOutOfScopeValuesTest {
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testReferenceMonoChange2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource right = input.getReferenceMonoChangeRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource right = input.getReferenceMonoChangeRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource right = input.getReferenceMonoChangeRightOutOfScope();
+ final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ // We need left and right to point to the same proxy uri after the merge
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+ // Though the origin did not change and still points to the "old" proxy
+ assertFalse(((InternalEObject)leftValue).eProxyURI().equals(
+ ((InternalEObject)originValue).eProxyURI()));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource right = input.getReferenceMonoChangeRightOutOfScope();
+ final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ // We need left and right to point to the same proxy uri after the merge
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+ // And coincidentally, "origin" also points to that same proxy in this case
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)originValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoChangeRightOutOfScope();
+ final Resource right = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ // We need left and right to point to the same proxy uri after the merge
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+ // And coincidentally, "origin" also points to that same proxy in this case
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)originValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoChangeRightOutOfScope();
+ final Resource right = input.getReferenceMonoChangeLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoChangeOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ // We need left and right to point to the same proxy uri after the merge
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+ // Though the origin did not change and still points to the "old" proxy
+ assertFalse(((InternalEObject)leftValue).eProxyURI().equals(
+ ((InternalEObject)originValue).eProxyURI()));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoSetRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoSetRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoSetRightOutOfScope();
+ final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertNull(originValue);
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoSetRightOutOfScope();
+ final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+ assertNull(originValue);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoSetRightOutOfScope();
+ final Resource right = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+ assertNull(originValue);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoSetRightOutOfScope();
+ final Resource right = input.getReferenceMonoSetLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoSetOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertNull(originValue);
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
+ final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+ assertTrue(originValue.eIsProxy());
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetRightOutOfScope();
+ final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoUnsetRightOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertTrue(leftValue.eIsProxy());
+ assertTrue(rightValue.eIsProxy());
+ assertTrue(originValue.eIsProxy());
+
+ assertEquals(((InternalEObject)leftValue).eProxyURI(), ((InternalEObject)rightValue).eProxyURI());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoUnsetRightOutOfScope();
+ final Resource right = input.getReferenceMonoUnsetLeftOutOfScope();
+ final Resource origin = input.getReferenceMonoUnsetOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final EObject leftValue = (EObject)leftDiffContainer.eGet(feature, false);
+ final EObject rightValue = (EObject)rightDiffContainer.eGet(feature, false);
+ final EObject originValue = (EObject)originDiffContainer.eGet(feature, false);
+
+ assertNull(leftValue);
+ assertNull(rightValue);
+ assertTrue(originValue.eIsProxy());
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource right = input.getReferenceMultiAddRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource right = input.getReferenceMultiAddRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource right = input.getReferenceMultiAddRightOutOfScope();
+ final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(-1, originProxyIndex);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource right = input.getReferenceMultiAddRightOutOfScope();
+ final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+ assertEquals(-1, originProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiAddRightOutOfScope();
+ final Resource right = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+ assertEquals(-1, originProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiAddRightOutOfScope();
+ final Resource right = input.getReferenceMultiAddLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiAddOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(-1, originProxyIndex);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource right = input.getReferenceMultiDelRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource right = input.getReferenceMultiDelRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource right = input.getReferenceMultiDelRightOutOfScope();
+ final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(3, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+ // "deleted" value is the third (0-based)
+ assertEquals(2, originProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiDelRightOutOfScope();
+ final Resource right = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(3, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertEquals(-1, leftProxyIndex);
+ assertEquals(-1, rightProxyIndex);
+ // "deleted" value is the third (0-based)
+ assertEquals(2, originProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiDelRightOutOfScope();
+ final Resource right = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+ assertEquals(3, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ // "deleted" value is the third (0-based)
+ assertEquals(2, originProxyIndex);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeftOutOfScope();
+ final Resource right = input.getReferenceMultiDelRightOutOfScope();
+ final Resource origin = input.getReferenceMultiDelOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ final List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ final List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(3, leftValue.size());
+ assertEquals(3, rightValue.size());
+ assertEquals(3, originValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = -1;
+ int rightProxyIndex = -1;
+ int originProxyIndex = -1;
+ for (int i = 0; i < leftValue.size() && leftProxyIndex == -1; i++) {
+ final EObject candidate = leftValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ leftProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < rightValue.size() && rightProxyIndex == -1; i++) {
+ final EObject candidate = rightValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ rightProxyIndex = i;
+ }
+ }
+ for (int i = 0; i < originValue.size() && originProxyIndex == -1; i++) {
+ final EObject candidate = originValue.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ originProxyIndex = i;
+ }
+ }
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ // "deleted" value is the third (0-based)
+ assertEquals(2, originProxyIndex);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource right = input.getReferenceMultiMoveRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource right = input.getReferenceMultiMoveRightOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource right = input.getReferenceMultiMoveRightOutOfScope();
+ final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+ assertEquals(rightProxyIndex, originProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+ assertFalse(leftProxyIndex == originProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource right = input.getReferenceMultiMoveRightOutOfScope();
+ final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+ assertEquals(rightProxyIndex, originProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+ assertEquals(leftProxyIndex, originProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiMoveRightOutOfScope();
+ final Resource right = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+ assertEquals(leftProxyIndex, originProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+ assertEquals(leftProxyIndex, originProxyIndex);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiMove3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiMoveRightOutOfScope();
+ final Resource right = input.getReferenceMultiMoveLeftOutOfScope();
+ final Resource origin = input.getReferenceMultiMoveOriginOutOfScope();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ assertTrue(differences.get(0) instanceof ReferenceChange);
+
+ final ReferenceChange diff = (ReferenceChange)differences.get(0);
+
+ assertTrue(diff.getValue().eIsProxy());
+ assertEquals(featureName, diff.getReference().getName());
+
+ final EObject leftDiffContainer = getNodeNamed(left, "origin");
+ final EObject rightDiffContainer = getNodeNamed(right, "origin");
+ final EObject originDiffContainer = getNodeNamed(origin, "origin");
+ assertSame(leftDiffContainer, diff.getMatch().getLeft());
+ assertSame(rightDiffContainer, diff.getMatch().getRight());
+ assertSame(originDiffContainer, diff.getMatch().getOrigin());
+
+ final EStructuralFeature feature = leftDiffContainer.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ List<EObject> leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ List<EObject> rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ List<EObject> originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, rightValue.size());
+
+ final URI proxyURI = ((InternalEObject)diff.getValue()).eProxyURI();
+ int leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ int rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ int originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertFalse(leftProxyIndex == rightProxyIndex);
+ assertEquals(leftProxyIndex, originProxyIndex);
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ // The proxy should not have been resolved by the merge operation
+ assertTrue(diff.getValue().eIsProxy());
+
+ leftValue = (List<EObject>)leftDiffContainer.eGet(feature, false);
+ rightValue = (List<EObject>)rightDiffContainer.eGet(feature, false);
+ originValue = (List<EObject>)originDiffContainer.eGet(feature, false);
+
+ assertEquals(2, leftValue.size());
+ assertEquals(2, rightValue.size());
+ assertEquals(2, originValue.size());
+
+ leftProxyIndex = findProxyIndexIn(proxyURI, leftValue);
+ rightProxyIndex = findProxyIndexIn(proxyURI, rightValue);
+ originProxyIndex = findProxyIndexIn(proxyURI, originValue);
+
+ assertTrue(leftProxyIndex != -1);
+ assertTrue(rightProxyIndex != -1);
+ assertTrue(originProxyIndex != -1);
+ assertEquals(leftProxyIndex, rightProxyIndex);
+ assertFalse(leftProxyIndex == originProxyIndex);
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+
+ private int findProxyIndexIn(URI proxyURI, List<EObject> list) {
+ for (int i = 0; i < list.size(); i++) {
+ final EObject candidate = list.get(i);
+ if (candidate.eIsProxy() && proxyURI.equals(((InternalEObject)candidate).eProxyURI())) {
+ return i;
+ }
+ }
+ return -1;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeTest.java
index d73baba3b..a79da3652 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/IndividualMergeTest.java
@@ -1,2388 +1,2388 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.merge;
-
-import static com.google.common.base.Predicates.and;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-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.DifferenceSource;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class IndividualMergeTest {
- private IndividualDiffInputData input = new IndividualDiffInputData();
-
- private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
-
- @Test
- public void testAttributeMonoChange2WayLtR() throws IOException {
- final Resource left = input.getAttributeMonoChangeLeft();
- final Resource right = input.getAttributeMonoChangeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoChange2WayRtL() throws IOException {
- final Resource left = input.getAttributeMonoChangeLeft();
- final Resource right = input.getAttributeMonoChangeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoChange3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMonoChangeLeft();
- final Resource right = input.getAttributeMonoChangeRight();
- final Resource origin = input.getAttributeMonoChangeOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoChange3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMonoChangeLeft();
- final Resource right = input.getAttributeMonoChangeRight();
- final Resource origin = input.getAttributeMonoChangeOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoChange3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoChangeRight();
- final Resource right = input.getAttributeMonoChangeLeft();
- final Resource origin = input.getAttributeMonoChangeOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoChange3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoChangeRight();
- final Resource right = input.getAttributeMonoChangeLeft();
- final Resource origin = input.getAttributeMonoChangeOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, "originValue", "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet2WayLtR() throws IOException {
- final Resource left = input.getAttributeMonoSetLeft();
- final Resource right = input.getAttributeMonoSetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet2WayRtL() throws IOException {
- final Resource left = input.getAttributeMonoSetLeft();
- final Resource right = input.getAttributeMonoSetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMonoSetLeft();
- final Resource right = input.getAttributeMonoSetRight();
- final Resource origin = input.getAttributeMonoSetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMonoSetLeft();
- final Resource right = input.getAttributeMonoSetRight();
- final Resource origin = input.getAttributeMonoSetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoSetRight();
- final Resource right = input.getAttributeMonoSetLeft();
- final Resource origin = input.getAttributeMonoSetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoSet3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoSetRight();
- final Resource right = input.getAttributeMonoSetLeft();
- final Resource origin = input.getAttributeMonoSetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, null, "leftValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("leftValue", originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset2WayLtR() throws IOException {
- final Resource left = input.getAttributeMonoUnsetLeft();
- final Resource right = input.getAttributeMonoUnsetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset2WayRtL() throws IOException {
- final Resource left = input.getAttributeMonoUnsetLeft();
- final Resource right = input.getAttributeMonoUnsetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMonoUnsetLeft();
- final Resource right = input.getAttributeMonoUnsetRight();
- final Resource origin = input.getAttributeMonoUnsetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMonoUnsetLeft();
- final Resource right = input.getAttributeMonoUnsetRight();
- final Resource origin = input.getAttributeMonoUnsetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoUnsetRight();
- final Resource right = input.getAttributeMonoUnsetLeft();
- final Resource origin = input.getAttributeMonoUnsetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertEquals("originValue", originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMonoUnset3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMonoUnsetRight();
- final Resource right = input.getAttributeMonoUnsetLeft();
- final Resource origin = input.getAttributeMonoUnsetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedAttribute("root.origin", featureName, "originValue", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd2WayLtR() throws IOException {
- final Resource left = input.getAttributeMultiAddLeft();
- final Resource right = input.getAttributeMultiAddRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd2WayRtL() throws IOException {
- final Resource left = input.getAttributeMultiAddLeft();
- final Resource right = input.getAttributeMultiAddRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMultiAddLeft();
- final Resource right = input.getAttributeMultiAddRight();
- final Resource origin = input.getAttributeMultiAddOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMultiAddLeft();
- final Resource right = input.getAttributeMultiAddRight();
- final Resource origin = input.getAttributeMultiAddOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiAddRight();
- final Resource right = input.getAttributeMultiAddLeft();
- final Resource origin = input.getAttributeMultiAddOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiAdd3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiAddRight();
- final Resource right = input.getAttributeMultiAddLeft();
- final Resource origin = input.getAttributeMultiAddOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- addedToAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel2WayLtR() throws IOException {
- final Resource left = input.getAttributeMultiDelLeft();
- final Resource right = input.getAttributeMultiDelRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel2WayRtL() throws IOException {
- final Resource left = input.getAttributeMultiDelLeft();
- final Resource right = input.getAttributeMultiDelRight();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMultiDelLeft();
- final Resource right = input.getAttributeMultiDelRight();
- final Resource origin = input.getAttributeMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMultiDelLeft();
- final Resource right = input.getAttributeMultiDelRight();
- final Resource origin = input.getAttributeMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiDelRight();
- final Resource right = input.getAttributeMultiDelLeft();
- final Resource origin = input.getAttributeMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains("value1"));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testAttributeMultiDel3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiDelRight();
- final Resource right = input.getAttributeMultiDelLeft();
- final Resource origin = input.getAttributeMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- removedFromAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains("value1"));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove2WayLtR() throws IOException {
- final Resource left = input.getAttributeMultiMoveLeft();
- final Resource right = input.getAttributeMultiMoveRight();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(left, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove2WayRtL() throws IOException {
- final Resource left = input.getAttributeMultiMoveLeft();
- final Resource right = input.getAttributeMultiMoveRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(right, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getAttributeMultiMoveLeft();
- final Resource right = input.getAttributeMultiMoveRight();
- final Resource origin = input.getAttributeMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(left, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getAttributeMultiMoveLeft();
- final Resource right = input.getAttributeMultiMoveRight();
- final Resource origin = input.getAttributeMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(origin, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiMoveRight();
- final Resource right = input.getAttributeMultiMoveLeft();
- final Resource origin = input.getAttributeMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(origin, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testAttributeMultiMove3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getAttributeMultiMoveRight();
- final Resource right = input.getAttributeMultiMoveLeft();
- final Resource origin = input.getAttributeMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedAttribute";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- movedInAttribute("root.origin", featureName, "value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(right, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeft();
- final Resource right = input.getReferenceMonoChangeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "targetValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeft();
- final Resource right = input.getReferenceMonoChangeRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "originValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeft();
- final Resource right = input.getReferenceMonoChangeRight();
- final Resource origin = input.getReferenceMonoChangeOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "targetValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoChangeLeft();
- final Resource right = input.getReferenceMonoChangeRight();
- final Resource origin = input.getReferenceMonoChangeOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "originValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoChangeRight();
- final Resource right = input.getReferenceMonoChangeLeft();
- final Resource origin = input.getReferenceMonoChangeOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "originValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoChange3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoChangeRight();
- final Resource right = input.getReferenceMonoChangeLeft();
- final Resource origin = input.getReferenceMonoChangeOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "targetValue");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoSetLeft();
- final Resource right = input.getReferenceMonoSetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "left");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoSetLeft();
- final Resource right = input.getReferenceMonoSetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoSetLeft();
- final Resource right = input.getReferenceMonoSetRight();
- final Resource origin = input.getReferenceMonoSetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "left");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoSetLeft();
- final Resource right = input.getReferenceMonoSetRight();
- final Resource origin = input.getReferenceMonoSetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoSetRight();
- final Resource right = input.getReferenceMonoSetLeft();
- final Resource origin = input.getReferenceMonoSetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoSet3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoSetRight();
- final Resource right = input.getReferenceMonoSetLeft();
- final Resource origin = input.getReferenceMonoSetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, null, "root.left")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "left");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset2WayLtR() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeft();
- final Resource right = input.getReferenceMonoUnsetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset2WayRtL() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeft();
- final Resource right = input.getReferenceMonoUnsetRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeft();
- final Resource right = input.getReferenceMonoUnsetRight();
- final Resource origin = input.getReferenceMonoUnsetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMonoUnsetLeft();
- final Resource right = input.getReferenceMonoUnsetRight();
- final Resource origin = input.getReferenceMonoUnsetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoUnsetRight();
- final Resource right = input.getReferenceMonoUnsetLeft();
- final Resource origin = input.getReferenceMonoUnsetOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertSame(targetNode, originNode.eGet(feature));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMonoUnset3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMonoUnsetRight();
- final Resource right = input.getReferenceMonoUnsetLeft();
- final Resource origin = input.getReferenceMonoUnsetOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "singleValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- changedReference("root.origin", featureName, "root.target", null)));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- assertNull(originNode.eGet(feature));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiAddLeft();
- final Resource right = input.getReferenceMultiAddRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiAddLeft();
- final Resource right = input.getReferenceMultiAddRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiAddLeft();
- final Resource right = input.getReferenceMultiAddRight();
- final Resource origin = input.getReferenceMultiAddOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiAddLeft();
- final Resource right = input.getReferenceMultiAddRight();
- final Resource origin = input.getReferenceMultiAddOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiAddRight();
- final Resource right = input.getReferenceMultiAddLeft();
- final Resource origin = input.getReferenceMultiAddOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiAdd3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiAddRight();
- final Resource right = input.getReferenceMultiAddLeft();
- final Resource origin = input.getReferenceMultiAddOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- addedToReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiDelLeft();
- final Resource right = input.getReferenceMultiDelRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiDelLeft();
- final Resource right = input.getReferenceMultiDelRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiDelLeft();
- final Resource right = input.getReferenceMultiDelRight();
- final Resource origin = input.getReferenceMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiDelLeft();
- final Resource right = input.getReferenceMultiDelRight();
- final Resource origin = input.getReferenceMultiDelOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiDelRight();
- final Resource right = input.getReferenceMultiDelLeft();
- final Resource origin = input.getReferenceMultiDelOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(right, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(right, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertTrue(((Collection<?>)featureValue).contains(targetNode));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testReferenceMultiDel3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiDelRight();
- final Resource right = input.getReferenceMultiDelLeft();
- final Resource origin = input.getReferenceMultiDelOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- removedFromReference("root.origin", featureName, "root.target")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject originNode = getNodeNamed(left, "origin");
- assertNotNull(originNode);
- final EObject targetNode = getNodeNamed(left, "target");
- assertNotNull(targetNode);
- final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object featureValue = originNode.eGet(feature);
- assertTrue(featureValue instanceof Collection<?>);
- assertFalse(((Collection<?>)featureValue).contains(targetNode));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove2WayLtR() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeft();
- final Resource right = input.getReferenceMultiMoveRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(left, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove2WayRtL() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeft();
- final Resource right = input.getReferenceMultiMoveRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(right, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove3WayLeftChangeLtR() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeft();
- final Resource right = input.getReferenceMultiMoveRight();
- final Resource origin = input.getReferenceMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(left, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove3WayLeftChangeRtL() throws IOException {
- final Resource left = input.getReferenceMultiMoveLeft();
- final Resource right = input.getReferenceMultiMoveRight();
- final Resource origin = input.getReferenceMultiMoveOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(origin, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove3WayRightChangeLtR() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiMoveRight();
- final Resource right = input.getReferenceMultiMoveLeft();
- final Resource origin = input.getReferenceMultiMoveOrigin();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(right, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(origin, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testReferenceMultiMove3WayRightChangeRtL() throws IOException {
- // In order to have changes on the right side, we'll invert right and left
- final Resource left = input.getReferenceMultiMoveRight();
- final Resource right = input.getReferenceMultiMoveLeft();
- final Resource origin = input.getReferenceMultiMoveOrigin();
-
- IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- final String featureName = "multiValuedReference";
- final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
- movedInReference("root.origin", featureName, "root.value1")));
-
- mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
- final EObject targetNode = getNodeNamed(left, "origin");
- assertNotNull(targetNode);
- final EObject sourceNode = getNodeNamed(right, "origin");
- assertNotNull(sourceNode);
- final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
- assertNotNull(feature);
-
- final Object targetFeatureValue = targetNode.eGet(feature);
- final Object sourceFeatureValue = sourceNode.eGet(feature);
- assertTrue(targetFeatureValue instanceof List<?>);
- assertTrue(sourceFeatureValue instanceof List<?>);
- assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
- ((List<EObject>)sourceFeatureValue));
-
- // We should have no difference between left and right ... though they might be different from origin
- scope = new DefaultComparisonScope(left, right, null);
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- /**
- * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
- * matter.
- *
- * @param list1
- * First of the two lists to compare.
- * @param list2
- * Second of the two lists to compare.
- */
- private static <T> void assertEqualContents(List<T> list1, List<T> list2) {
- final int size = list1.size();
- assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
-
- for (int i = 0; i < size; i++) {
- final Object object1 = list1.get(i);
- final Object object2 = list2.get(i);
- assertEquals(object1, object2);
- }
- }
-
- /**
- * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
- * matter.
- *
- * @param list1
- * First of the two lists to compare.
- * @param list2
- * Second of the two lists to compare.
- */
- private static <T extends EObject> void assertEqualContents(Comparison comparison, List<T> list1,
- List<T> list2) {
- final int size = list1.size();
- assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
-
- boolean list2IsOrigin = false;
- for (int i = 0; i < size; i++) {
- final EObject eObject1 = list1.get(i);
- final EObject eObject2 = list2.get(i);
- final Match match = comparison.getMatch(eObject1);
- if (match.getLeft() == eObject1) {
- if (i == 0) {
- if (match.getOrigin() == eObject2) {
- list2IsOrigin = true;
- } else {
- assertSame(match.getRight(), eObject2);
- }
- } else if (list2IsOrigin) {
- assertSame(match.getOrigin(), eObject2);
- } else {
- assertSame(match.getRight(), eObject2);
- }
- } else {
- assertSame(match.getRight(), eObject1);
- if (i == 0) {
- if (match.getOrigin() == eObject2) {
- list2IsOrigin = true;
- } else {
- assertSame(match.getLeft(), eObject2);
- }
- } else if (list2IsOrigin) {
- assertSame(match.getOrigin(), eObject2);
- } else {
- assertSame(match.getLeft(), eObject2);
- }
- }
- }
- }
-
- private EObject getNodeNamed(Resource res, String name) {
- final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
- while (iterator.hasNext()) {
- final EObject next = iterator.next();
- final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
- if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
- return next;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.movedInReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromAttribute;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+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.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class IndividualMergeTest {
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testAttributeMonoChange2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMonoChangeLeft();
+ final Resource right = input.getAttributeMonoChangeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoChange2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMonoChangeLeft();
+ final Resource right = input.getAttributeMonoChangeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoChange3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMonoChangeLeft();
+ final Resource right = input.getAttributeMonoChangeRight();
+ final Resource origin = input.getAttributeMonoChangeOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoChange3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMonoChangeLeft();
+ final Resource right = input.getAttributeMonoChangeRight();
+ final Resource origin = input.getAttributeMonoChangeOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoChange3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoChangeRight();
+ final Resource right = input.getAttributeMonoChangeLeft();
+ final Resource origin = input.getAttributeMonoChangeOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoChange3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoChangeRight();
+ final Resource right = input.getAttributeMonoChangeLeft();
+ final Resource origin = input.getAttributeMonoChangeOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, "originValue", "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMonoSetLeft();
+ final Resource right = input.getAttributeMonoSetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMonoSetLeft();
+ final Resource right = input.getAttributeMonoSetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMonoSetLeft();
+ final Resource right = input.getAttributeMonoSetRight();
+ final Resource origin = input.getAttributeMonoSetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMonoSetLeft();
+ final Resource right = input.getAttributeMonoSetRight();
+ final Resource origin = input.getAttributeMonoSetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoSetRight();
+ final Resource right = input.getAttributeMonoSetLeft();
+ final Resource origin = input.getAttributeMonoSetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoSet3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoSetRight();
+ final Resource right = input.getAttributeMonoSetLeft();
+ final Resource origin = input.getAttributeMonoSetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, null, "leftValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("leftValue", originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMonoUnsetLeft();
+ final Resource right = input.getAttributeMonoUnsetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMonoUnsetLeft();
+ final Resource right = input.getAttributeMonoUnsetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMonoUnsetLeft();
+ final Resource right = input.getAttributeMonoUnsetRight();
+ final Resource origin = input.getAttributeMonoUnsetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMonoUnsetLeft();
+ final Resource right = input.getAttributeMonoUnsetRight();
+ final Resource origin = input.getAttributeMonoUnsetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoUnsetRight();
+ final Resource right = input.getAttributeMonoUnsetLeft();
+ final Resource origin = input.getAttributeMonoUnsetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertEquals("originValue", originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMonoUnset3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMonoUnsetRight();
+ final Resource right = input.getAttributeMonoUnsetLeft();
+ final Resource origin = input.getAttributeMonoUnsetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedAttribute("root.origin", featureName, "originValue", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMultiAddLeft();
+ final Resource right = input.getAttributeMultiAddRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMultiAddLeft();
+ final Resource right = input.getAttributeMultiAddRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMultiAddLeft();
+ final Resource right = input.getAttributeMultiAddRight();
+ final Resource origin = input.getAttributeMultiAddOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMultiAddLeft();
+ final Resource right = input.getAttributeMultiAddRight();
+ final Resource origin = input.getAttributeMultiAddOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiAddRight();
+ final Resource right = input.getAttributeMultiAddLeft();
+ final Resource origin = input.getAttributeMultiAddOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiAdd3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiAddRight();
+ final Resource right = input.getAttributeMultiAddLeft();
+ final Resource origin = input.getAttributeMultiAddOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ addedToAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMultiDelLeft();
+ final Resource right = input.getAttributeMultiDelRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMultiDelLeft();
+ final Resource right = input.getAttributeMultiDelRight();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMultiDelLeft();
+ final Resource right = input.getAttributeMultiDelRight();
+ final Resource origin = input.getAttributeMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMultiDelLeft();
+ final Resource right = input.getAttributeMultiDelRight();
+ final Resource origin = input.getAttributeMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiDelRight();
+ final Resource right = input.getAttributeMultiDelLeft();
+ final Resource origin = input.getAttributeMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains("value1"));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testAttributeMultiDel3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiDelRight();
+ final Resource right = input.getAttributeMultiDelLeft();
+ final Resource origin = input.getAttributeMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ removedFromAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains("value1"));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove2WayLtR() throws IOException {
+ final Resource left = input.getAttributeMultiMoveLeft();
+ final Resource right = input.getAttributeMultiMoveRight();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(left, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove2WayRtL() throws IOException {
+ final Resource left = input.getAttributeMultiMoveLeft();
+ final Resource right = input.getAttributeMultiMoveRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(right, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getAttributeMultiMoveLeft();
+ final Resource right = input.getAttributeMultiMoveRight();
+ final Resource origin = input.getAttributeMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(left, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getAttributeMultiMoveLeft();
+ final Resource right = input.getAttributeMultiMoveRight();
+ final Resource origin = input.getAttributeMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(origin, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiMoveRight();
+ final Resource right = input.getAttributeMultiMoveLeft();
+ final Resource origin = input.getAttributeMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(origin, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAttributeMultiMove3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getAttributeMultiMoveRight();
+ final Resource right = input.getAttributeMultiMoveLeft();
+ final Resource origin = input.getAttributeMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedAttribute";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ movedInAttribute("root.origin", featureName, "value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(right, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(((List<Object>)targetFeatureValue), ((List<Object>)sourceFeatureValue));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeft();
+ final Resource right = input.getReferenceMonoChangeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "targetValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeft();
+ final Resource right = input.getReferenceMonoChangeRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "originValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeft();
+ final Resource right = input.getReferenceMonoChangeRight();
+ final Resource origin = input.getReferenceMonoChangeOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "targetValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoChangeLeft();
+ final Resource right = input.getReferenceMonoChangeRight();
+ final Resource origin = input.getReferenceMonoChangeOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "originValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoChangeRight();
+ final Resource right = input.getReferenceMonoChangeLeft();
+ final Resource origin = input.getReferenceMonoChangeOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "originValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoChange3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoChangeRight();
+ final Resource right = input.getReferenceMonoChangeLeft();
+ final Resource origin = input.getReferenceMonoChangeOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, "root.originValue", "root.targetValue")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "targetValue");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeft();
+ final Resource right = input.getReferenceMonoSetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "left");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeft();
+ final Resource right = input.getReferenceMonoSetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeft();
+ final Resource right = input.getReferenceMonoSetRight();
+ final Resource origin = input.getReferenceMonoSetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "left");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoSetLeft();
+ final Resource right = input.getReferenceMonoSetRight();
+ final Resource origin = input.getReferenceMonoSetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoSetRight();
+ final Resource right = input.getReferenceMonoSetLeft();
+ final Resource origin = input.getReferenceMonoSetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoSet3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoSetRight();
+ final Resource right = input.getReferenceMonoSetLeft();
+ final Resource origin = input.getReferenceMonoSetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, null, "root.left")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "left");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeft();
+ final Resource right = input.getReferenceMonoUnsetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeft();
+ final Resource right = input.getReferenceMonoUnsetRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeft();
+ final Resource right = input.getReferenceMonoUnsetRight();
+ final Resource origin = input.getReferenceMonoUnsetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMonoUnsetLeft();
+ final Resource right = input.getReferenceMonoUnsetRight();
+ final Resource origin = input.getReferenceMonoUnsetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoUnsetRight();
+ final Resource right = input.getReferenceMonoUnsetLeft();
+ final Resource origin = input.getReferenceMonoUnsetOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertSame(targetNode, originNode.eGet(feature));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMonoUnset3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMonoUnsetRight();
+ final Resource right = input.getReferenceMonoUnsetLeft();
+ final Resource origin = input.getReferenceMonoUnsetOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "singleValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ changedReference("root.origin", featureName, "root.target", null)));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ assertNull(originNode.eGet(feature));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeft();
+ final Resource right = input.getReferenceMultiAddRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeft();
+ final Resource right = input.getReferenceMultiAddRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeft();
+ final Resource right = input.getReferenceMultiAddRight();
+ final Resource origin = input.getReferenceMultiAddOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiAddLeft();
+ final Resource right = input.getReferenceMultiAddRight();
+ final Resource origin = input.getReferenceMultiAddOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiAddRight();
+ final Resource right = input.getReferenceMultiAddLeft();
+ final Resource origin = input.getReferenceMultiAddOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiAdd3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiAddRight();
+ final Resource right = input.getReferenceMultiAddLeft();
+ final Resource origin = input.getReferenceMultiAddOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ addedToReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeft();
+ final Resource right = input.getReferenceMultiDelRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeft();
+ final Resource right = input.getReferenceMultiDelRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeft();
+ final Resource right = input.getReferenceMultiDelRight();
+ final Resource origin = input.getReferenceMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiDelLeft();
+ final Resource right = input.getReferenceMultiDelRight();
+ final Resource origin = input.getReferenceMultiDelOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiDelRight();
+ final Resource right = input.getReferenceMultiDelLeft();
+ final Resource origin = input.getReferenceMultiDelOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(right, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(right, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertTrue(((Collection<?>)featureValue).contains(targetNode));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testReferenceMultiDel3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiDelRight();
+ final Resource right = input.getReferenceMultiDelLeft();
+ final Resource origin = input.getReferenceMultiDelOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ removedFromReference("root.origin", featureName, "root.target")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject originNode = getNodeNamed(left, "origin");
+ assertNotNull(originNode);
+ final EObject targetNode = getNodeNamed(left, "target");
+ assertNotNull(targetNode);
+ final EStructuralFeature feature = originNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object featureValue = originNode.eGet(feature);
+ assertTrue(featureValue instanceof Collection<?>);
+ assertFalse(((Collection<?>)featureValue).contains(targetNode));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove2WayLtR() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeft();
+ final Resource right = input.getReferenceMultiMoveRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(left, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove2WayRtL() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeft();
+ final Resource right = input.getReferenceMultiMoveRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(right, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove3WayLeftChangeLtR() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeft();
+ final Resource right = input.getReferenceMultiMoveRight();
+ final Resource origin = input.getReferenceMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(left, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove3WayLeftChangeRtL() throws IOException {
+ final Resource left = input.getReferenceMultiMoveLeft();
+ final Resource right = input.getReferenceMultiMoveRight();
+ final Resource origin = input.getReferenceMultiMoveOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(origin, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove3WayRightChangeLtR() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiMoveRight();
+ final Resource right = input.getReferenceMultiMoveLeft();
+ final Resource origin = input.getReferenceMultiMoveOrigin();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(right, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(origin, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testReferenceMultiMove3WayRightChangeRtL() throws IOException {
+ // In order to have changes on the right side, we'll invert right and left
+ final Resource left = input.getReferenceMultiMoveRight();
+ final Resource right = input.getReferenceMultiMoveLeft();
+ final Resource origin = input.getReferenceMultiMoveOrigin();
+
+ IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ final String featureName = "multiValuedReference";
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ movedInReference("root.origin", featureName, "root.value1")));
+
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+ final EObject targetNode = getNodeNamed(left, "origin");
+ assertNotNull(targetNode);
+ final EObject sourceNode = getNodeNamed(right, "origin");
+ assertNotNull(sourceNode);
+ final EStructuralFeature feature = targetNode.eClass().getEStructuralFeature(featureName);
+ assertNotNull(feature);
+
+ final Object targetFeatureValue = targetNode.eGet(feature);
+ final Object sourceFeatureValue = sourceNode.eGet(feature);
+ assertTrue(targetFeatureValue instanceof List<?>);
+ assertTrue(sourceFeatureValue instanceof List<?>);
+ assertEqualContents(comparison, ((List<EObject>)targetFeatureValue),
+ ((List<EObject>)sourceFeatureValue));
+
+ // We should have no difference between left and right ... though they might be different from origin
+ scope = new DefaultComparisonScope(left, right, null);
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ /**
+ * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
+ * matter.
+ *
+ * @param list1
+ * First of the two lists to compare.
+ * @param list2
+ * Second of the two lists to compare.
+ */
+ private static <T> void assertEqualContents(List<T> list1, List<T> list2) {
+ final int size = list1.size();
+ assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
+
+ for (int i = 0; i < size; i++) {
+ final Object object1 = list1.get(i);
+ final Object object2 = list2.get(i);
+ assertEquals(object1, object2);
+ }
+ }
+
+ /**
+ * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
+ * matter.
+ *
+ * @param list1
+ * First of the two lists to compare.
+ * @param list2
+ * Second of the two lists to compare.
+ */
+ private static <T extends EObject> void assertEqualContents(Comparison comparison, List<T> list1,
+ List<T> list2) {
+ final int size = list1.size();
+ assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
+
+ boolean list2IsOrigin = false;
+ for (int i = 0; i < size; i++) {
+ final EObject eObject1 = list1.get(i);
+ final EObject eObject2 = list2.get(i);
+ final Match match = comparison.getMatch(eObject1);
+ if (match.getLeft() == eObject1) {
+ if (i == 0) {
+ if (match.getOrigin() == eObject2) {
+ list2IsOrigin = true;
+ } else {
+ assertSame(match.getRight(), eObject2);
+ }
+ } else if (list2IsOrigin) {
+ assertSame(match.getOrigin(), eObject2);
+ } else {
+ assertSame(match.getRight(), eObject2);
+ }
+ } else {
+ assertSame(match.getRight(), eObject1);
+ if (i == 0) {
+ if (match.getOrigin() == eObject2) {
+ list2IsOrigin = true;
+ } else {
+ assertSame(match.getLeft(), eObject2);
+ }
+ } else if (list2IsOrigin) {
+ assertSame(match.getOrigin(), eObject2);
+ } else {
+ assertSame(match.getLeft(), eObject2);
+ }
+ }
+ }
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/MultipleMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/MultipleMergeTest.java
index 9a67eab3a..825636213 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/MultipleMergeTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/MultipleMergeTest.java
@@ -1,1127 +1,1127 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.merge;
-
-import static com.google.common.base.Predicates.and;
-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.fromSide;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.Collections;
-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.DifferenceSource;
-import org.eclipse.emf.compare.DifferenceState;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.merge.IMerger;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.conflict.data.ConflictInputData;
-import org.eclipse.emf.compare.tests.equi.data.EquiInputData;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class MultipleMergeTest {
- // We'll use input from various other tests
- private ConflictInputData conflictInput = new ConflictInputData();
-
- private EquiInputData equivalenceInput = new EquiInputData();
-
- private IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
-
- @Test
- public void testComplexUseCaseLtoR1() throws IOException {
- final Resource left = conflictInput.getComplexLeft();
- final Resource origin = conflictInput.getComplexOrigin();
- final Resource right = conflictInput.getComplexRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
- /*
- * This use case features 12 distinct differences of all types, adding up to 3 real conflict and 2
- * pseudo conflicts.
- */
- // 1 - Left : Node8 added
- // 2 - Left : Node9 added
- // 3 - Left : Node1 moved
- // 4 - Left : Node0 added
- // 5 - Left : Node5 removed
- // 6 - Left : Node6 removed
- // 7 - Left : Node7 removed
-
- // 8 - Right : Node6 moved
- // 9 - Right : Node9 added
- // 10 - Right : Node0 added
- // 11 - Right : Node1 moved
- // 12 - Right : Node5 removed
-
- // Real conflict : 6 and 8 (Moving and deleting the same value)
- // Real conflict : 2 and 9 (Adding the same value at different indices)
- // Real conflict : 4 and 10 (Adding the same value at different indices)
-
- // Pseudo conflict : 3 and 11 (Moving the same value to the same index on both sides)
- // Pseudo conflict : 5 and 12 (Removing the same value on both sides)
-
- // For reference
- // "original" is : {Node1, Node2, Node3, Node4, Node5, Node6, Node7}
- // "left" is : {Node8, Node9, Node2, Node3, Node4, Node1, Node0}
- // "right" is : {Node6, Node2, Node9, Node3, Node0, Node1, Node4, Node7}
-
- // Merge all, left to right, in order. Resolve conflicts by taking left side.
-
- // merge 1 (add Node8)
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node8")));
- // LCS is currently {2, 3, 4}. Insertion index is right before 2.
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertValueIndexIs(diff1, false, 1);
-
- // merge 2 (add Node9). Since there is a conflict, merge 9 right beforehand
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node9")));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
- // Revert addition of Node9 in right
- mergerRegistry.getHighestRankingMerger(diff9).copyLeftToRight(diff9, new BasicMonitor());
- // LCS is now {8, 2, 3, 4}. Insertion should be right after 8
- mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
- assertValueIndexIs(diff2, false, 2);
-
- // merge 3 (move Node1). Since there is a conflict, merge 11 beforehand
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
- // revert move of Node 1 in right. It should be re-positioned right before 2
- mergerRegistry.getHighestRankingMerger(diff11).copyLeftToRight(diff11, new BasicMonitor());
- assertValueIndexIs(diff11, false, 3);
- // LCS is {8, 9, 2, 3, 4}. 1 should be moved right after 4.
- mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
- assertValueIndexIs(diff3, false, 7);
-
- // merge 4 (add Node0). There is a conflict. Merge 10 beforehand.
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node0")));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
- // revert addition of 0 in right
- mergerRegistry.getHighestRankingMerger(diff10).copyLeftToRight(diff10, new BasicMonitor());
- // LCS is now {8, 9, 2, 3, 4, 1}. 0 should be added right after 1
- mergerRegistry.getHighestRankingMerger(diff4).copyLeftToRight(diff4, new BasicMonitor());
- assertValueIndexIs(diff4, false, 7);
-
- // merge 5 (remove Node5). There is a conflict, but it is a pseudo-conflict.
- // These diffs won't even be presented to the user, but let's merge them nonetheless.
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
- mergerRegistry.getHighestRankingMerger(diff12).copyLeftToRight(diff12, new BasicMonitor());
- assertValueIndexIs(diff12, false, -1);
- mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
- assertValueIndexIs(diff5, false, -1);
-
- // merge 6 (remove Node6). There is a conflict. Merge 8 beforehand.
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
- // Revert move of 6 in right.
- mergerRegistry.getHighestRankingMerger(diff8).copyLeftToRight(diff8, new BasicMonitor());
- assertValueIndexIs(diff8, false, 5);
- mergerRegistry.getHighestRankingMerger(diff6).copyLeftToRight(diff6, new BasicMonitor());
- assertValueIndexIs(diff6, false, -1);
-
- // merge 7 (remove Node7)
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
- mergerRegistry.getHighestRankingMerger(diff7).copyLeftToRight(diff7, new BasicMonitor());
- assertValueIndexIs(diff7, false, -1);
-
- // Left and Right should now be equal
- final EObject leftContainer = diff7.getMatch().getLeft();
- final EObject rightContainer = diff7.getMatch().getRight();
- final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
- final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
- assertEqualContents(comparison, leftContents, rightContents);
- }
-
- @Test
- public void testComplexUseCaseLtoR2() throws IOException {
- final Resource left = conflictInput.getComplexLeft();
- final Resource origin = conflictInput.getComplexOrigin();
- final Resource right = conflictInput.getComplexRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // See description of the changes in #testComplexUseCaseLtoR1
- // Merge all, left to right, in arbitrary order. Resolve conflicts by taking left side.
-
- // merge 3 (move Node1). Since there is a conflict, merge 11 beforehand
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
- // revert move of Node 1 in right. It should be re-positioned right before 2
- mergerRegistry.getHighestRankingMerger(diff11).copyLeftToRight(diff11, new BasicMonitor());
- assertValueIndexIs(diff11, false, 1);
- // Merge move of 1. Should be moved right after 4.
- mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
- assertValueIndexIs(diff3, false, 6);
-
- // merge 6 (add Node6). There is a conflict. Merge 8 beforehand.
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
- // Revert move of 6 in right.
- mergerRegistry.getHighestRankingMerger(diff8).copyLeftToRight(diff8, new BasicMonitor());
- assertValueIndexIs(diff8, false, 5);
- mergerRegistry.getHighestRankingMerger(diff6).copyLeftToRight(diff6, new BasicMonitor());
- assertValueIndexIs(diff6, false, -1);
-
- // merge 7 (remove Node7)
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
- mergerRegistry.getHighestRankingMerger(diff7).copyLeftToRight(diff7, new BasicMonitor());
- assertValueIndexIs(diff7, false, -1);
-
- // merge 4 (add Node0). There is a conflict. Merge 10 beforehand.
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node0")));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
- // revert addition of 0 in right
- mergerRegistry.getHighestRankingMerger(diff10).copyLeftToRight(diff10, new BasicMonitor());
- assertValueIndexIs(diff10, false, -1);
- mergerRegistry.getHighestRankingMerger(diff4).copyLeftToRight(diff4, new BasicMonitor());
- assertValueIndexIs(diff4, false, 5);
-
- // merge 1 (add Node8)
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node8")));
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertValueIndexIs(diff1, false, 0);
-
- // merge 2 (add Node9). Since there is a conflict, merge 9 right beforehand
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node9")));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
- // Revert addition of Node9 in right
- mergerRegistry.getHighestRankingMerger(diff9).copyLeftToRight(diff9, new BasicMonitor());
- assertValueIndexIs(diff9, false, -1);
- mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
- assertValueIndexIs(diff2, false, 1);
-
- // merge 5 (remove Node5). There is a conflict, but it is a pseudo-conflict.
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
- // revert remove
- mergerRegistry.getHighestRankingMerger(diff12).copyLeftToRight(diff12, new BasicMonitor());
- assertValueIndexIs(diff12, false, -1);
- // apply remove
- mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
- assertValueIndexIs(diff5, false, -1);
-
- // Left and Right should now be equal
- final EObject leftContainer = diff7.getMatch().getLeft();
- final EObject rightContainer = diff7.getMatch().getRight();
- final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
- final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
- assertEqualContents(comparison, leftContents, rightContents);
- }
-
- @Test
- public void testComplexUseCaseRtoL1() throws IOException {
- final Resource left = conflictInput.getComplexLeft();
- final Resource origin = conflictInput.getComplexOrigin();
- final Resource right = conflictInput.getComplexRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // See description of the changes in #testComplexUseCaseLtoR1
- // Merge all, right to left, in order. Resolve conflicts by taking right side.
-
- // merge 8 (move Node6). There is a conflict. Merge 6 beforehand.
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
- // Revert remove of 6 in left.
- mergerRegistry.getHighestRankingMerger(diff6).copyRightToLeft(diff6, new BasicMonitor());
- assertValueIndexIs(diff6, true, 5);
- // apply the move in left
- mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
- assertValueIndexIs(diff8, true, 2);
-
- // merge 9 (add Node9). Since there is a conflict, merge 2 right beforehand
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node9")));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
- // Revert addition in left
- mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
- assertValueIndexIs(diff2, true, -1);
- mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
- assertValueIndexIs(diff9, true, 3);
-
- // merge 10 (add Node0). There is a conflict. Merge 4 beforehand.
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node0")));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
- // Revert addition in left
- mergerRegistry.getHighestRankingMerger(diff4).copyRightToLeft(diff4, new BasicMonitor());
- assertValueIndexIs(diff4, true, -1);
- mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
- assertValueIndexIs(diff10, true, 5);
-
- // merge 11 (move Node1). Since there is a conflict, merge 3 beforehand
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
- // Revert move of 1 in left
- mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
- assertValueIndexIs(diff3, true, 2);
- mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
- assertValueIndexIs(diff11, true, 6);
-
- // merge 12 (remove Node5). Merge 5 beforehand.
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
- // revert remove in left
- mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
- assertValueIndexIs(diff5, true, -1);
- mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
- assertValueIndexIs(diff12, true, -1);
-
- // merge 1 (add Node8). This will remove Node8
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node8")));
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- assertValueIndexIs(diff1, false, -1);
-
- // merge 7 (remove Node7). This will re-add Node7
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
- mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
- assertValueIndexIs(diff7, false, 7);
-
- // Left and Right should now be equal
- final EObject leftContainer = diff7.getMatch().getLeft();
- final EObject rightContainer = diff7.getMatch().getRight();
- final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
- final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
- assertEqualContents(comparison, leftContents, rightContents);
- }
-
- @Test
- public void testComplexUseCaseRtoL2() throws IOException {
- final Resource left = conflictInput.getComplexLeft();
- final Resource origin = conflictInput.getComplexOrigin();
- final Resource right = conflictInput.getComplexRight();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // "original" is : {Node1, Node2, Node3, Node4, Node5, Node6, Node7}
- // "left" is : {Node8, Node9, Node2, Node3, Node4, Node1, Node0}
- // "right" is : {Node6, Node2, Node9, Node3, Node0, Node1, Node4, Node7}
-
- // See description of the changes in #testComplexUseCaseLtoR1
- // Merge all, right to left, in arbitrary order. Resolve conflicts by taking right side.
-
- // merge 12 (remove Node5). Merge 5 beforehand.
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
- // revert remove in left
- mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
- assertValueIndexIs(diff5, true, -1);
- mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
- assertValueIndexIs(diff12, true, -1);
-
- // merge 10 (add Node0). There is a conflict. Merge 4 beforehand.
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node0")));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
- // Revert addition in left
- mergerRegistry.getHighestRankingMerger(diff4).copyRightToLeft(diff4, new BasicMonitor());
- assertValueIndexIs(diff4, true, -1);
- mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
- assertValueIndexIs(diff10, true, 4);
-
- // merge 7 (remove Node7). This will re-add Node7
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
- mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
- assertValueIndexIs(diff7, false, 7);
-
- // merge 9 (add Node9). Since there is a conflict, merge 2 right beforehand
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node9")));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
- // Revert addition in left
- mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
- assertValueIndexIs(diff2, true, -1);
- mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
- assertValueIndexIs(diff9, true, 2);
-
- // merge 1 (add Node8). This will remove Node8
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), added("Root.Node8")));
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- assertValueIndexIs(diff1, false, -1);
-
- // merge 8 (move Node6). There is a conflict. Merge 6 beforehand.
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
- // Revert remove of 6 in left.
- mergerRegistry.getHighestRankingMerger(diff6).copyRightToLeft(diff6, new BasicMonitor());
- assertValueIndexIs(diff6, true, 5);
- // apply the move in left
- mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
- assertValueIndexIs(diff8, true, 0);
-
- // merge 11 (move Node1). Since there is a conflict, merge 3 beforehand
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
- fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
- // Revert move of 1 in left
- mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
- assertValueIndexIs(diff3, true, 1);
- mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
- assertValueIndexIs(diff11, true, 5);
-
- // Left and Right should now be equal
- final EObject leftContainer = diff7.getMatch().getLeft();
- final EObject rightContainer = diff7.getMatch().getRight();
- final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
- final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
- assertEqualContents(comparison, leftContents, rightContents);
- }
-
- @Test
- public void testEquivalenceA1LtoR() throws IOException {
- final Resource left = equivalenceInput.getA1Left();
- final Resource right = equivalenceInput.getA1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 6 differences, equivalent by pairs
- assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
- // diff5 is equivalent to diff6
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", null, "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", null, "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.C", "destination", "Requirements.D"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.D", "source", null, "Requirements.C"));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.E", "destination", "Requirements.F"));
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.F", "source", "Requirements.E"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- // Check that diff1 got properly merged
- assertMerged(comparison, diff1, false, false);
- // And validate that diff2 got merged as an equivalent diff
- assertMerged(comparison, diff2, false, false);
-
- mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
- // Check that diff3 got properly merged
- assertMerged(comparison, diff3, false, false);
- // And validate that diff4 got merged as an equivalent diff
- assertMerged(comparison, diff4, false, false);
-
- mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
- // Check that diff5 got properly merged
- assertMerged(comparison, diff5, false, false);
- // And validate that diff6 got merged as an equivalent diff
- assertMerged(comparison, diff6, false, false);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceA1RtoL() throws IOException {
- final Resource left = equivalenceInput.getA1Left();
- final Resource right = equivalenceInput.getA1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 6 differences, equivalent by pairs
- assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
- // diff5 is equivalent to diff6
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", null, "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", null, "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.C", "destination", "Requirements.D"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.D", "source", null, "Requirements.C"));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.E", "destination", "Requirements.F"));
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.F", "source", "Requirements.E"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- // Check that diff1 got properly merged (we're unsetting values)
- assertMerged(comparison, diff1, true, true);
- // And validate that diff2 got merged as an equivalent diff
- assertMerged(comparison, diff2, true, true);
-
- mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
- assertMerged(comparison, diff3, true, true);
- assertMerged(comparison, diff4, true, true);
-
- mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
- assertMerged(comparison, diff5, true, true);
- assertMerged(comparison, diff6, true, true);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceA4LtoR() throws IOException {
- final Resource left = equivalenceInput.getA4Left();
- final Resource right = equivalenceInput.getA4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 4 differences, equivalent by pairs
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.A", "destination", "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.B", "source", "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.B", "destination", "Requirements.A"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.A", "source", "Requirements.B"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, false, false);
- assertMerged(comparison, diff2, false, false);
-
- mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
- assertMerged(comparison, diff3, false, false);
- assertMerged(comparison, diff4, false, false);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceA4RtoL() throws IOException {
- final Resource left = equivalenceInput.getA4Left();
- final Resource right = equivalenceInput.getA4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 4 differences, equivalent by pairs
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.A", "destination", "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.B", "source", "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.B", "destination", "Requirements.A"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.A", "source", "Requirements.B"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, true, true);
- assertMerged(comparison, diff2, true, true);
-
- mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
- assertMerged(comparison, diff3, true, true);
- assertMerged(comparison, diff4, true, true);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceA5LtoR() throws IOException {
- final Resource left = equivalenceInput.getA5Left();
- final Resource right = equivalenceInput.getA5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 12 differences, 3 equivalent pairs, some dependencies
- assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
- // diff5 is equivalent to diff6
-
- // diff1 depends on diff7 and diff 8
- // diff2 also depends on 7 and 8 (equivalent diffs have the same requires)
- // 3 and 4 both depend on 9 and 10
- // 5 and 6 both depend on 11 and 12
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", null, "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", null, "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.C", "destination", "Requirements.D"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.D", "source", null, "Requirements.C"));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.E", "destination", "Requirements.F"));
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.F", "source", "Requirements.E"));
-
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.A"));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.B"));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.D"));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.E"));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.F"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, false, false);
- assertMerged(comparison, diff2, false, false);
- assertSame(DifferenceState.MERGED, diff7.getState());
- assertSame(DifferenceState.MERGED, diff8.getState());
-
- mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
- assertMerged(comparison, diff3, false, false);
- assertMerged(comparison, diff4, false, false);
- assertSame(DifferenceState.MERGED, diff9.getState());
- assertSame(DifferenceState.MERGED, diff10.getState());
-
- mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
- assertMerged(comparison, diff5, false, false);
- assertMerged(comparison, diff6, false, false);
- assertSame(DifferenceState.MERGED, diff11.getState());
- assertSame(DifferenceState.MERGED, diff12.getState());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceA5RtoL() throws IOException {
- final Resource left = equivalenceInput.getA5Left();
- final Resource right = equivalenceInput.getA5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 12 differences, 3 equivalent pairs, some dependencies
- assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
-
- // diff1 is equivalent to diff2
- // diff3 is equivalent to diff4
- // diff5 is equivalent to diff6
-
- // diff1 depends on diff7 and diff 8
- // diff2 also depends on 7 and 8 (equivalent diffs have the same requires)
- // 3 and 4 both depend on 9 and 10
- // 5 and 6 both depend on 11 and 12
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", null, "Requirements.B"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", null, "Requirements.A"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.C", "destination", "Requirements.D"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.D", "source", null, "Requirements.C"));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.E", "destination", "Requirements.F"));
- final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements.F", "source", "Requirements.E"));
-
- final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.A"));
- final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.B"));
- final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.D"));
- final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.E"));
- final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.F"));
-
- // Removing the link between A and B does not necessarily means removing A and B
- // The "required" diffs will ne be merged
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, true, true);
- assertMerged(comparison, diff2, true, true);
- assertSame(DifferenceState.UNRESOLVED, diff7.getState());
- assertSame(DifferenceState.UNRESOLVED, diff8.getState());
-
- mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
- assertMerged(comparison, diff3, true, true);
- assertMerged(comparison, diff4, true, true);
- assertSame(DifferenceState.UNRESOLVED, diff9.getState());
- assertSame(DifferenceState.UNRESOLVED, diff10.getState());
-
- mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
- assertMerged(comparison, diff5, true, true);
- assertMerged(comparison, diff6, true, true);
- assertSame(DifferenceState.UNRESOLVED, diff11.getState());
- assertSame(DifferenceState.UNRESOLVED, diff12.getState());
-
- // Merge the 6 remaining diffs
- mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
- mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
- mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
- mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
- mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
- mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceC2LtoR1() throws IOException {
- final Resource left = equivalenceInput.getC2Left();
- final Resource right = equivalenceInput.getC2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 4 differences
- // 1 : added C
- // 2 : changed reference "destination" of A to C
- // 3 : unset reference "source" of B
- // 4 : changed reference "source" of C to A
- // 2, 3 and 4 are equivalent
- // 2 and 4 require 1
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", "Requirements.A", null));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.C", "source", null, "Requirements.A"));
-
- mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
- assertSame(DifferenceState.MERGED, diff1.getState());
- assertMerged(comparison, diff2, false, false);
- assertMerged(comparison, diff3, true, false);
- assertMerged(comparison, diff4, false, false);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceC2LtoR2() throws IOException {
- final Resource left = equivalenceInput.getC2Left();
- final Resource right = equivalenceInput.getC2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 4 differences
- // 1 : added C
- // 2 : changed reference "destination" of A to C
- // 3 : unset reference "source" of B
- // 4 : changed reference "source" of C to A
- // 2, 3 and 4 are equivalent
- // 2 and 4 require 1
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", "Requirements.A", null));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.C", "source", null, "Requirements.A"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertSame(DifferenceState.MERGED, diff1.getState());
- assertSame(DifferenceState.UNRESOLVED, diff2.getState());
- assertSame(DifferenceState.UNRESOLVED, diff3.getState());
- assertSame(DifferenceState.UNRESOLVED, diff4.getState());
-
- mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
- assertMerged(comparison, diff2, false, false);
- assertMerged(comparison, diff3, true, false);
- assertMerged(comparison, diff4, false, false);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceC2RtoL() throws IOException {
- final Resource left = equivalenceInput.getC2Left();
- final Resource right = equivalenceInput.getC2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 4 differences
- // 1 : added C
- // 2 : changed reference "destination" of A to C
- // 3 : unset reference "source" of B
- // 4 : changed reference "source" of C to A
- // 2, 3 and 4 are equivalent
- // 2 and 4 require 1
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", "Requirements.A", null));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.C", "source", null, "Requirements.A"));
-
- mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
- assertSame(DifferenceState.UNRESOLVED, diff1.getState());
- assertMerged(comparison, diff3, false, true);
- assertMerged(comparison, diff4, true, true);
- /*
- * Diff 2 is a little more complicated than the usual. We are on a mono-valued refrence, and the merge
- * operation is actually resetting the value to its original state. We will need to check that.
- */
- final EObject nodeA = diff2.getMatch().getLeft();
- final EObject nodeB = diff3.getMatch().getLeft();
- assertEquals("A", nodeA.eGet(nodeA.eClass().getEStructuralFeature("name")));
- assertEquals("B", nodeB.eGet(nodeB.eClass().getEStructuralFeature("name")));
- assertSame(nodeB, nodeA.eGet(diff2.getReference()));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceC4LtoR() throws IOException {
- final Resource left = equivalenceInput.getC4Left();
- final Resource right = equivalenceInput.getC4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 5 differences
- // 1 : added C
- // 2 : removed B
- // 3 : changed reference "destination" of A to C
- // 4 : unset reference "source" of B
- // 5 : changed reference "source" of C to A
- // 3, 4 and 5 are equivalent
- // 2 requires 3 and 4
- // 3 and 5 require 1
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- removedFromReference("Requirements", "containmentRef1", "Requirements.B"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", "Requirements.A", null));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.C", "source", null, "Requirements.A"));
-
- mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, false, false);
- assertSame(DifferenceState.UNRESOLVED, diff2.getState());
- assertSame(DifferenceState.UNRESOLVED, diff3.getState());
- assertSame(DifferenceState.UNRESOLVED, diff4.getState());
- assertSame(DifferenceState.UNRESOLVED, diff5.getState());
-
- mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
- // B has been deleted : unset element in right
- assertMerged(comparison, diff2, true, false);
- // Change A.destination from "B" to "C"
- assertMerged(comparison, diff3, false, false);
- // Unsetting B.source. B is no longer in either right or left. We'll have to manually check.
- assertSame(DifferenceState.MERGED, diff4.getState());
- assertNull(diff4.getMatch().getLeft());
- assertNull(diff4.getMatch().getRight());
- // 2 required 3, which is equivalent to 5. 5 should thus have been merged too
- assertMerged(comparison, diff5, false, false);
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- @Test
- public void testEquivalenceC4RtoL() throws IOException {
- final Resource left = equivalenceInput.getC4Left();
- final Resource right = equivalenceInput.getC4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- Comparison comparison = EMFCompare.builder().build().compare(scope);
-
- final List<Diff> differences = comparison.getDifferences();
-
- // Initially 5 differences
- // 1 : added C
- // 2 : removed B
- // 3 : changed reference "destination" of A to C
- // 4 : unset reference "source" of B
- // 5 : changed reference "source" of C to A
- // 3, 4 and 5 are equivalent
- // 2 requires 3 and 4
- // 3 and 5 require 1
- assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
-
- final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
- addedToReference("Requirements", "containmentRef1", "Requirements.C"));
- final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
- removedFromReference("Requirements", "containmentRef1", "Requirements.B"));
- final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
- final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.B", "source", "Requirements.A", null));
- final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
- changedReference("Requirements.C", "source", null, "Requirements.A"));
-
- // 1 is required by 3, which is required by 2 and equivalent to 4 and 5.
- // Resetting 1 should thus reset all other diffs.
- mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
- assertMerged(comparison, diff1, true, true);
- assertMerged(comparison, diff2, false, true);
-
- // C has been removed, thus the value match of diff3 has neither left nor right.
- assertSame(DifferenceState.MERGED, diff3.getState());
- final EObject nodeA = diff3.getMatch().getLeft();
- final EObject nodeB = diff4.getMatch().getLeft();
- assertSame(nodeB, nodeA.eGet(diff3.getReference()));
-
- assertMerged(comparison, diff4, false, true);
-
- assertSame(DifferenceState.MERGED, diff5.getState());
- assertNull(diff5.getMatch().getLeft());
- assertNull(diff5.getMatch().getRight());
-
- comparison = EMFCompare.builder().build().compare(scope);
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
- }
-
- /**
- * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
- * matter.
- *
- * @param list1
- * First of the two lists to compare.
- * @param list2
- * Second of the two lists to compare.
- */
- private static <T extends EObject> void assertEqualContents(Comparison comparison, List<T> list1,
- List<T> list2) {
- final int size = list1.size();
- assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
-
- for (int i = 0; i < size; i++) {
- final EObject eObject1 = list1.get(i);
- final EObject eObject2 = list2.get(i);
- final Match match = comparison.getMatch(eObject1);
- if (match.getLeft() == eObject1) {
- assertEquals(match.getRight(), eObject2);
- } else {
- assertEquals(match.getRight(), eObject1);
- assertEquals(match.getLeft(), eObject2);
- }
- }
- }
-
- /* NOTE : not meant for containment changes */
- private static void assertMerged(Comparison comparison, ReferenceChange referenceChange, boolean unset,
- boolean rightToLeft) {
- assertSame(referenceChange.getState(), DifferenceState.MERGED);
-
- final EObject container;
- if (rightToLeft) {
- container = referenceChange.getMatch().getLeft();
- } else {
- container = referenceChange.getMatch().getRight();
- }
-
- final EReference ref = referenceChange.getReference();
- final Match valueMatch = comparison.getMatch(referenceChange.getValue());
- if (unset && ref.isContainment()) {
- assertNull(valueMatch);
- } else if (ref.isMany()) {
- @SuppressWarnings("unchecked")
- final List<EObject> refValue = (List<EObject>)container.eGet(ref);
- if (rightToLeft && unset) {
- assertTrue(!refValue.contains(valueMatch.getLeft()));
- } else if (rightToLeft) {
- assertTrue(refValue.contains(valueMatch.getLeft()));
- } else if (unset) {
- assertTrue(!refValue.contains(valueMatch.getRight()));
- } else {
- assertTrue(refValue.contains(valueMatch.getRight()));
- }
- } else {
- final EObject refValue = (EObject)container.eGet(ref);
- if (unset) {
- assertSame(null, refValue);
- } else if (rightToLeft) {
- assertSame(valueMatch.getLeft(), refValue);
- } else {
- assertSame(valueMatch.getRight(), refValue);
- }
- }
- }
-
- private static void assertValueIndexIs(ReferenceChange diff, boolean rightToLeft, int expectedIndex) {
- final Match containerMatch = diff.getMatch();
- final Match valueMatch = containerMatch.getComparison().getMatch(diff.getValue());
-
- if (rightToLeft) {
- if (expectedIndex != -1) {
- assertNotNull(valueMatch.getLeft());
- assertSame(containerMatch.getLeft().eResource(), valueMatch.getLeft().eResource());
- final EObject addedToLeft = valueMatch.getLeft();
- final List<EObject> values = getAsList(containerMatch.getLeft(), diff.getReference());
- assertSame(Integer.valueOf(expectedIndex), Integer.valueOf(values.indexOf(addedToLeft)));
- } else {
- assertTrue(valueMatch == null || valueMatch.getLeft() == null);
- }
- } else {
- if (expectedIndex != -1) {
- assertNotNull(valueMatch.getRight());
- assertSame(containerMatch.getRight().eResource(), valueMatch.getRight().eResource());
- final EObject addedToRight = valueMatch.getRight();
- final List<EObject> values = getAsList(containerMatch.getRight(), diff.getReference());
- assertSame(Integer.valueOf(expectedIndex), Integer.valueOf(values.indexOf(addedToRight)));
- } else {
- assertTrue(valueMatch == null || valueMatch.getRight() == null);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private static List<EObject> getAsList(EObject object, EReference feature) {
- if (object != null) {
- Object value = object.eGet(feature, false);
- final List<EObject> asList;
- if (value instanceof List) {
- asList = (List<EObject>)value;
- } else if (value instanceof Iterable) {
- asList = ImmutableList.copyOf((Iterable<EObject>)value);
- } else if (value != null) {
- asList = ImmutableList.of((EObject)value);
- } else {
- asList = Collections.emptyList();
- }
- return asList;
- }
- return Collections.emptyList();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+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.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collections;
+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.DifferenceSource;
+import org.eclipse.emf.compare.DifferenceState;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.conflict.data.ConflictInputData;
+import org.eclipse.emf.compare.tests.equi.data.EquiInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class MultipleMergeTest {
+ // We'll use input from various other tests
+ private ConflictInputData conflictInput = new ConflictInputData();
+
+ private EquiInputData equivalenceInput = new EquiInputData();
+
+ private IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testComplexUseCaseLtoR1() throws IOException {
+ final Resource left = conflictInput.getComplexLeft();
+ final Resource origin = conflictInput.getComplexOrigin();
+ final Resource right = conflictInput.getComplexRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ /*
+ * This use case features 12 distinct differences of all types, adding up to 3 real conflict and 2
+ * pseudo conflicts.
+ */
+ // 1 - Left : Node8 added
+ // 2 - Left : Node9 added
+ // 3 - Left : Node1 moved
+ // 4 - Left : Node0 added
+ // 5 - Left : Node5 removed
+ // 6 - Left : Node6 removed
+ // 7 - Left : Node7 removed
+
+ // 8 - Right : Node6 moved
+ // 9 - Right : Node9 added
+ // 10 - Right : Node0 added
+ // 11 - Right : Node1 moved
+ // 12 - Right : Node5 removed
+
+ // Real conflict : 6 and 8 (Moving and deleting the same value)
+ // Real conflict : 2 and 9 (Adding the same value at different indices)
+ // Real conflict : 4 and 10 (Adding the same value at different indices)
+
+ // Pseudo conflict : 3 and 11 (Moving the same value to the same index on both sides)
+ // Pseudo conflict : 5 and 12 (Removing the same value on both sides)
+
+ // For reference
+ // "original" is : {Node1, Node2, Node3, Node4, Node5, Node6, Node7}
+ // "left" is : {Node8, Node9, Node2, Node3, Node4, Node1, Node0}
+ // "right" is : {Node6, Node2, Node9, Node3, Node0, Node1, Node4, Node7}
+
+ // Merge all, left to right, in order. Resolve conflicts by taking left side.
+
+ // merge 1 (add Node8)
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node8")));
+ // LCS is currently {2, 3, 4}. Insertion index is right before 2.
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertValueIndexIs(diff1, false, 1);
+
+ // merge 2 (add Node9). Since there is a conflict, merge 9 right beforehand
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node9")));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
+ // Revert addition of Node9 in right
+ mergerRegistry.getHighestRankingMerger(diff9).copyLeftToRight(diff9, new BasicMonitor());
+ // LCS is now {8, 2, 3, 4}. Insertion should be right after 8
+ mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
+ assertValueIndexIs(diff2, false, 2);
+
+ // merge 3 (move Node1). Since there is a conflict, merge 11 beforehand
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
+ // revert move of Node 1 in right. It should be re-positioned right before 2
+ mergerRegistry.getHighestRankingMerger(diff11).copyLeftToRight(diff11, new BasicMonitor());
+ assertValueIndexIs(diff11, false, 3);
+ // LCS is {8, 9, 2, 3, 4}. 1 should be moved right after 4.
+ mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
+ assertValueIndexIs(diff3, false, 7);
+
+ // merge 4 (add Node0). There is a conflict. Merge 10 beforehand.
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node0")));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
+ // revert addition of 0 in right
+ mergerRegistry.getHighestRankingMerger(diff10).copyLeftToRight(diff10, new BasicMonitor());
+ // LCS is now {8, 9, 2, 3, 4, 1}. 0 should be added right after 1
+ mergerRegistry.getHighestRankingMerger(diff4).copyLeftToRight(diff4, new BasicMonitor());
+ assertValueIndexIs(diff4, false, 7);
+
+ // merge 5 (remove Node5). There is a conflict, but it is a pseudo-conflict.
+ // These diffs won't even be presented to the user, but let's merge them nonetheless.
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
+ mergerRegistry.getHighestRankingMerger(diff12).copyLeftToRight(diff12, new BasicMonitor());
+ assertValueIndexIs(diff12, false, -1);
+ mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
+ assertValueIndexIs(diff5, false, -1);
+
+ // merge 6 (remove Node6). There is a conflict. Merge 8 beforehand.
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
+ // Revert move of 6 in right.
+ mergerRegistry.getHighestRankingMerger(diff8).copyLeftToRight(diff8, new BasicMonitor());
+ assertValueIndexIs(diff8, false, 5);
+ mergerRegistry.getHighestRankingMerger(diff6).copyLeftToRight(diff6, new BasicMonitor());
+ assertValueIndexIs(diff6, false, -1);
+
+ // merge 7 (remove Node7)
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
+ mergerRegistry.getHighestRankingMerger(diff7).copyLeftToRight(diff7, new BasicMonitor());
+ assertValueIndexIs(diff7, false, -1);
+
+ // Left and Right should now be equal
+ final EObject leftContainer = diff7.getMatch().getLeft();
+ final EObject rightContainer = diff7.getMatch().getRight();
+ final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
+ final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
+ assertEqualContents(comparison, leftContents, rightContents);
+ }
+
+ @Test
+ public void testComplexUseCaseLtoR2() throws IOException {
+ final Resource left = conflictInput.getComplexLeft();
+ final Resource origin = conflictInput.getComplexOrigin();
+ final Resource right = conflictInput.getComplexRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // See description of the changes in #testComplexUseCaseLtoR1
+ // Merge all, left to right, in arbitrary order. Resolve conflicts by taking left side.
+
+ // merge 3 (move Node1). Since there is a conflict, merge 11 beforehand
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
+ // revert move of Node 1 in right. It should be re-positioned right before 2
+ mergerRegistry.getHighestRankingMerger(diff11).copyLeftToRight(diff11, new BasicMonitor());
+ assertValueIndexIs(diff11, false, 1);
+ // Merge move of 1. Should be moved right after 4.
+ mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
+ assertValueIndexIs(diff3, false, 6);
+
+ // merge 6 (add Node6). There is a conflict. Merge 8 beforehand.
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
+ // Revert move of 6 in right.
+ mergerRegistry.getHighestRankingMerger(diff8).copyLeftToRight(diff8, new BasicMonitor());
+ assertValueIndexIs(diff8, false, 5);
+ mergerRegistry.getHighestRankingMerger(diff6).copyLeftToRight(diff6, new BasicMonitor());
+ assertValueIndexIs(diff6, false, -1);
+
+ // merge 7 (remove Node7)
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
+ mergerRegistry.getHighestRankingMerger(diff7).copyLeftToRight(diff7, new BasicMonitor());
+ assertValueIndexIs(diff7, false, -1);
+
+ // merge 4 (add Node0). There is a conflict. Merge 10 beforehand.
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node0")));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
+ // revert addition of 0 in right
+ mergerRegistry.getHighestRankingMerger(diff10).copyLeftToRight(diff10, new BasicMonitor());
+ assertValueIndexIs(diff10, false, -1);
+ mergerRegistry.getHighestRankingMerger(diff4).copyLeftToRight(diff4, new BasicMonitor());
+ assertValueIndexIs(diff4, false, 5);
+
+ // merge 1 (add Node8)
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node8")));
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertValueIndexIs(diff1, false, 0);
+
+ // merge 2 (add Node9). Since there is a conflict, merge 9 right beforehand
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node9")));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
+ // Revert addition of Node9 in right
+ mergerRegistry.getHighestRankingMerger(diff9).copyLeftToRight(diff9, new BasicMonitor());
+ assertValueIndexIs(diff9, false, -1);
+ mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
+ assertValueIndexIs(diff2, false, 1);
+
+ // merge 5 (remove Node5). There is a conflict, but it is a pseudo-conflict.
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
+ // revert remove
+ mergerRegistry.getHighestRankingMerger(diff12).copyLeftToRight(diff12, new BasicMonitor());
+ assertValueIndexIs(diff12, false, -1);
+ // apply remove
+ mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
+ assertValueIndexIs(diff5, false, -1);
+
+ // Left and Right should now be equal
+ final EObject leftContainer = diff7.getMatch().getLeft();
+ final EObject rightContainer = diff7.getMatch().getRight();
+ final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
+ final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
+ assertEqualContents(comparison, leftContents, rightContents);
+ }
+
+ @Test
+ public void testComplexUseCaseRtoL1() throws IOException {
+ final Resource left = conflictInput.getComplexLeft();
+ final Resource origin = conflictInput.getComplexOrigin();
+ final Resource right = conflictInput.getComplexRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // See description of the changes in #testComplexUseCaseLtoR1
+ // Merge all, right to left, in order. Resolve conflicts by taking right side.
+
+ // merge 8 (move Node6). There is a conflict. Merge 6 beforehand.
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
+ // Revert remove of 6 in left.
+ mergerRegistry.getHighestRankingMerger(diff6).copyRightToLeft(diff6, new BasicMonitor());
+ assertValueIndexIs(diff6, true, 5);
+ // apply the move in left
+ mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
+ assertValueIndexIs(diff8, true, 2);
+
+ // merge 9 (add Node9). Since there is a conflict, merge 2 right beforehand
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node9")));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
+ // Revert addition in left
+ mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
+ assertValueIndexIs(diff2, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
+ assertValueIndexIs(diff9, true, 3);
+
+ // merge 10 (add Node0). There is a conflict. Merge 4 beforehand.
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node0")));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
+ // Revert addition in left
+ mergerRegistry.getHighestRankingMerger(diff4).copyRightToLeft(diff4, new BasicMonitor());
+ assertValueIndexIs(diff4, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
+ assertValueIndexIs(diff10, true, 5);
+
+ // merge 11 (move Node1). Since there is a conflict, merge 3 beforehand
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
+ // Revert move of 1 in left
+ mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
+ assertValueIndexIs(diff3, true, 2);
+ mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
+ assertValueIndexIs(diff11, true, 6);
+
+ // merge 12 (remove Node5). Merge 5 beforehand.
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
+ // revert remove in left
+ mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
+ assertValueIndexIs(diff5, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
+ assertValueIndexIs(diff12, true, -1);
+
+ // merge 1 (add Node8). This will remove Node8
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node8")));
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ assertValueIndexIs(diff1, false, -1);
+
+ // merge 7 (remove Node7). This will re-add Node7
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
+ mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
+ assertValueIndexIs(diff7, false, 7);
+
+ // Left and Right should now be equal
+ final EObject leftContainer = diff7.getMatch().getLeft();
+ final EObject rightContainer = diff7.getMatch().getRight();
+ final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
+ final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
+ assertEqualContents(comparison, leftContents, rightContents);
+ }
+
+ @Test
+ public void testComplexUseCaseRtoL2() throws IOException {
+ final Resource left = conflictInput.getComplexLeft();
+ final Resource origin = conflictInput.getComplexOrigin();
+ final Resource right = conflictInput.getComplexRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // "original" is : {Node1, Node2, Node3, Node4, Node5, Node6, Node7}
+ // "left" is : {Node8, Node9, Node2, Node3, Node4, Node1, Node0}
+ // "right" is : {Node6, Node2, Node9, Node3, Node0, Node1, Node4, Node7}
+
+ // See description of the changes in #testComplexUseCaseLtoR1
+ // Merge all, right to left, in arbitrary order. Resolve conflicts by taking right side.
+
+ // merge 12 (remove Node5). Merge 5 beforehand.
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node5")));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), removed("Root.Node5")));
+ // revert remove in left
+ mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
+ assertValueIndexIs(diff5, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
+ assertValueIndexIs(diff12, true, -1);
+
+ // merge 10 (add Node0). There is a conflict. Merge 4 beforehand.
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node0")));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node0")));
+ // Revert addition in left
+ mergerRegistry.getHighestRankingMerger(diff4).copyRightToLeft(diff4, new BasicMonitor());
+ assertValueIndexIs(diff4, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
+ assertValueIndexIs(diff10, true, 4);
+
+ // merge 7 (remove Node7). This will re-add Node7
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node7")));
+ mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
+ assertValueIndexIs(diff7, false, 7);
+
+ // merge 9 (add Node9). Since there is a conflict, merge 2 right beforehand
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node9")));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), added("Root.Node9")));
+ // Revert addition in left
+ mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
+ assertValueIndexIs(diff2, true, -1);
+ mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
+ assertValueIndexIs(diff9, true, 2);
+
+ // merge 1 (add Node8). This will remove Node8
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), added("Root.Node8")));
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ assertValueIndexIs(diff1, false, -1);
+
+ // merge 8 (move Node6). There is a conflict. Merge 6 beforehand.
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), removed("Root.Node6")));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node6", "containmentRef1")));
+ // Revert remove of 6 in left.
+ mergerRegistry.getHighestRankingMerger(diff6).copyRightToLeft(diff6, new BasicMonitor());
+ assertValueIndexIs(diff6, true, 5);
+ // apply the move in left
+ mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
+ assertValueIndexIs(diff8, true, 0);
+
+ // merge 11 (move Node1). Since there is a conflict, merge 3 beforehand
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.LEFT), moved("Root.Node1", "containmentRef1")));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(), and(
+ fromSide(DifferenceSource.RIGHT), moved("Root.Node1", "containmentRef1")));
+ // Revert move of 1 in left
+ mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
+ assertValueIndexIs(diff3, true, 1);
+ mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
+ assertValueIndexIs(diff11, true, 5);
+
+ // Left and Right should now be equal
+ final EObject leftContainer = diff7.getMatch().getLeft();
+ final EObject rightContainer = diff7.getMatch().getRight();
+ final List<EObject> leftContents = getAsList(leftContainer, diff7.getReference());
+ final List<EObject> rightContents = getAsList(rightContainer, diff7.getReference());
+ assertEqualContents(comparison, leftContents, rightContents);
+ }
+
+ @Test
+ public void testEquivalenceA1LtoR() throws IOException {
+ final Resource left = equivalenceInput.getA1Left();
+ final Resource right = equivalenceInput.getA1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 6 differences, equivalent by pairs
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+ // diff5 is equivalent to diff6
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", null, "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", null, "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.C", "destination", "Requirements.D"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.D", "source", null, "Requirements.C"));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.E", "destination", "Requirements.F"));
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.F", "source", "Requirements.E"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ // Check that diff1 got properly merged
+ assertMerged(comparison, diff1, false, false);
+ // And validate that diff2 got merged as an equivalent diff
+ assertMerged(comparison, diff2, false, false);
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
+ // Check that diff3 got properly merged
+ assertMerged(comparison, diff3, false, false);
+ // And validate that diff4 got merged as an equivalent diff
+ assertMerged(comparison, diff4, false, false);
+
+ mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
+ // Check that diff5 got properly merged
+ assertMerged(comparison, diff5, false, false);
+ // And validate that diff6 got merged as an equivalent diff
+ assertMerged(comparison, diff6, false, false);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceA1RtoL() throws IOException {
+ final Resource left = equivalenceInput.getA1Left();
+ final Resource right = equivalenceInput.getA1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 6 differences, equivalent by pairs
+ assertSame(Integer.valueOf(6), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+ // diff5 is equivalent to diff6
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", null, "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", null, "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.C", "destination", "Requirements.D"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.D", "source", null, "Requirements.C"));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.E", "destination", "Requirements.F"));
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.F", "source", "Requirements.E"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ // Check that diff1 got properly merged (we're unsetting values)
+ assertMerged(comparison, diff1, true, true);
+ // And validate that diff2 got merged as an equivalent diff
+ assertMerged(comparison, diff2, true, true);
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
+ assertMerged(comparison, diff3, true, true);
+ assertMerged(comparison, diff4, true, true);
+
+ mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
+ assertMerged(comparison, diff5, true, true);
+ assertMerged(comparison, diff6, true, true);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceA4LtoR() throws IOException {
+ final Resource left = equivalenceInput.getA4Left();
+ final Resource right = equivalenceInput.getA4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 4 differences, equivalent by pairs
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.A", "destination", "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.B", "source", "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.B", "destination", "Requirements.A"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.A", "source", "Requirements.B"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, false, false);
+ assertMerged(comparison, diff2, false, false);
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
+ assertMerged(comparison, diff3, false, false);
+ assertMerged(comparison, diff4, false, false);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceA4RtoL() throws IOException {
+ final Resource left = equivalenceInput.getA4Left();
+ final Resource right = equivalenceInput.getA4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 4 differences, equivalent by pairs
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.A", "destination", "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.B", "source", "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.B", "destination", "Requirements.A"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.A", "source", "Requirements.B"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, true, true);
+ assertMerged(comparison, diff2, true, true);
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
+ assertMerged(comparison, diff3, true, true);
+ assertMerged(comparison, diff4, true, true);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceA5LtoR() throws IOException {
+ final Resource left = equivalenceInput.getA5Left();
+ final Resource right = equivalenceInput.getA5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 12 differences, 3 equivalent pairs, some dependencies
+ assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+ // diff5 is equivalent to diff6
+
+ // diff1 depends on diff7 and diff 8
+ // diff2 also depends on 7 and 8 (equivalent diffs have the same requires)
+ // 3 and 4 both depend on 9 and 10
+ // 5 and 6 both depend on 11 and 12
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", null, "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", null, "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.C", "destination", "Requirements.D"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.D", "source", null, "Requirements.C"));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.E", "destination", "Requirements.F"));
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.F", "source", "Requirements.E"));
+
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.A"));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.B"));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.D"));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.E"));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.F"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, false, false);
+ assertMerged(comparison, diff2, false, false);
+ assertSame(DifferenceState.MERGED, diff7.getState());
+ assertSame(DifferenceState.MERGED, diff8.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyLeftToRight(diff3, new BasicMonitor());
+ assertMerged(comparison, diff3, false, false);
+ assertMerged(comparison, diff4, false, false);
+ assertSame(DifferenceState.MERGED, diff9.getState());
+ assertSame(DifferenceState.MERGED, diff10.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff5).copyLeftToRight(diff5, new BasicMonitor());
+ assertMerged(comparison, diff5, false, false);
+ assertMerged(comparison, diff6, false, false);
+ assertSame(DifferenceState.MERGED, diff11.getState());
+ assertSame(DifferenceState.MERGED, diff12.getState());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceA5RtoL() throws IOException {
+ final Resource left = equivalenceInput.getA5Left();
+ final Resource right = equivalenceInput.getA5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 12 differences, 3 equivalent pairs, some dependencies
+ assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
+
+ // diff1 is equivalent to diff2
+ // diff3 is equivalent to diff4
+ // diff5 is equivalent to diff6
+
+ // diff1 depends on diff7 and diff 8
+ // diff2 also depends on 7 and 8 (equivalent diffs have the same requires)
+ // 3 and 4 both depend on 9 and 10
+ // 5 and 6 both depend on 11 and 12
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", null, "Requirements.B"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", null, "Requirements.A"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.C", "destination", "Requirements.D"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.D", "source", null, "Requirements.C"));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.E", "destination", "Requirements.F"));
+ final ReferenceChange diff6 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements.F", "source", "Requirements.E"));
+
+ final ReferenceChange diff7 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.A"));
+ final ReferenceChange diff8 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.B"));
+ final ReferenceChange diff9 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff10 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.D"));
+ final ReferenceChange diff11 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.E"));
+ final ReferenceChange diff12 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.F"));
+
+ // Removing the link between A and B does not necessarily means removing A and B
+ // The "required" diffs will ne be merged
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, true, true);
+ assertMerged(comparison, diff2, true, true);
+ assertSame(DifferenceState.UNRESOLVED, diff7.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff8.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff3).copyRightToLeft(diff3, new BasicMonitor());
+ assertMerged(comparison, diff3, true, true);
+ assertMerged(comparison, diff4, true, true);
+ assertSame(DifferenceState.UNRESOLVED, diff9.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff10.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff5).copyRightToLeft(diff5, new BasicMonitor());
+ assertMerged(comparison, diff5, true, true);
+ assertMerged(comparison, diff6, true, true);
+ assertSame(DifferenceState.UNRESOLVED, diff11.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff12.getState());
+
+ // Merge the 6 remaining diffs
+ mergerRegistry.getHighestRankingMerger(diff7).copyRightToLeft(diff7, new BasicMonitor());
+ mergerRegistry.getHighestRankingMerger(diff8).copyRightToLeft(diff8, new BasicMonitor());
+ mergerRegistry.getHighestRankingMerger(diff9).copyRightToLeft(diff9, new BasicMonitor());
+ mergerRegistry.getHighestRankingMerger(diff10).copyRightToLeft(diff10, new BasicMonitor());
+ mergerRegistry.getHighestRankingMerger(diff11).copyRightToLeft(diff11, new BasicMonitor());
+ mergerRegistry.getHighestRankingMerger(diff12).copyRightToLeft(diff12, new BasicMonitor());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceC2LtoR1() throws IOException {
+ final Resource left = equivalenceInput.getC2Left();
+ final Resource right = equivalenceInput.getC2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 4 differences
+ // 1 : added C
+ // 2 : changed reference "destination" of A to C
+ // 3 : unset reference "source" of B
+ // 4 : changed reference "source" of C to A
+ // 2, 3 and 4 are equivalent
+ // 2 and 4 require 1
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", "Requirements.A", null));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.C", "source", null, "Requirements.A"));
+
+ mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
+ assertSame(DifferenceState.MERGED, diff1.getState());
+ assertMerged(comparison, diff2, false, false);
+ assertMerged(comparison, diff3, true, false);
+ assertMerged(comparison, diff4, false, false);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceC2LtoR2() throws IOException {
+ final Resource left = equivalenceInput.getC2Left();
+ final Resource right = equivalenceInput.getC2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 4 differences
+ // 1 : added C
+ // 2 : changed reference "destination" of A to C
+ // 3 : unset reference "source" of B
+ // 4 : changed reference "source" of C to A
+ // 2, 3 and 4 are equivalent
+ // 2 and 4 require 1
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", "Requirements.A", null));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.C", "source", null, "Requirements.A"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertSame(DifferenceState.MERGED, diff1.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff2.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff3.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff4.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
+ assertMerged(comparison, diff2, false, false);
+ assertMerged(comparison, diff3, true, false);
+ assertMerged(comparison, diff4, false, false);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceC2RtoL() throws IOException {
+ final Resource left = equivalenceInput.getC2Left();
+ final Resource right = equivalenceInput.getC2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 4 differences
+ // 1 : added C
+ // 2 : changed reference "destination" of A to C
+ // 3 : unset reference "source" of B
+ // 4 : changed reference "source" of C to A
+ // 2, 3 and 4 are equivalent
+ // 2 and 4 require 1
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", "Requirements.A", null));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.C", "source", null, "Requirements.A"));
+
+ mergerRegistry.getHighestRankingMerger(diff2).copyRightToLeft(diff2, new BasicMonitor());
+ assertSame(DifferenceState.UNRESOLVED, diff1.getState());
+ assertMerged(comparison, diff3, false, true);
+ assertMerged(comparison, diff4, true, true);
+ /*
+ * Diff 2 is a little more complicated than the usual. We are on a mono-valued refrence, and the merge
+ * operation is actually resetting the value to its original state. We will need to check that.
+ */
+ final EObject nodeA = diff2.getMatch().getLeft();
+ final EObject nodeB = diff3.getMatch().getLeft();
+ assertEquals("A", nodeA.eGet(nodeA.eClass().getEStructuralFeature("name")));
+ assertEquals("B", nodeB.eGet(nodeB.eClass().getEStructuralFeature("name")));
+ assertSame(nodeB, nodeA.eGet(diff2.getReference()));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceC4LtoR() throws IOException {
+ final Resource left = equivalenceInput.getC4Left();
+ final Resource right = equivalenceInput.getC4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 5 differences
+ // 1 : added C
+ // 2 : removed B
+ // 3 : changed reference "destination" of A to C
+ // 4 : unset reference "source" of B
+ // 5 : changed reference "source" of C to A
+ // 3, 4 and 5 are equivalent
+ // 2 requires 3 and 4
+ // 3 and 5 require 1
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ removedFromReference("Requirements", "containmentRef1", "Requirements.B"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", "Requirements.A", null));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.C", "source", null, "Requirements.A"));
+
+ mergerRegistry.getHighestRankingMerger(diff1).copyLeftToRight(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, false, false);
+ assertSame(DifferenceState.UNRESOLVED, diff2.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff3.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff4.getState());
+ assertSame(DifferenceState.UNRESOLVED, diff5.getState());
+
+ mergerRegistry.getHighestRankingMerger(diff2).copyLeftToRight(diff2, new BasicMonitor());
+ // B has been deleted : unset element in right
+ assertMerged(comparison, diff2, true, false);
+ // Change A.destination from "B" to "C"
+ assertMerged(comparison, diff3, false, false);
+ // Unsetting B.source. B is no longer in either right or left. We'll have to manually check.
+ assertSame(DifferenceState.MERGED, diff4.getState());
+ assertNull(diff4.getMatch().getLeft());
+ assertNull(diff4.getMatch().getRight());
+ // 2 required 3, which is equivalent to 5. 5 should thus have been merged too
+ assertMerged(comparison, diff5, false, false);
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testEquivalenceC4RtoL() throws IOException {
+ final Resource left = equivalenceInput.getC4Left();
+ final Resource right = equivalenceInput.getC4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+
+ // Initially 5 differences
+ // 1 : added C
+ // 2 : removed B
+ // 3 : changed reference "destination" of A to C
+ // 4 : unset reference "source" of B
+ // 5 : changed reference "source" of C to A
+ // 3, 4 and 5 are equivalent
+ // 2 requires 3 and 4
+ // 3 and 5 require 1
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+
+ final ReferenceChange diff1 = (ReferenceChange)Iterators.find(differences.iterator(),
+ addedToReference("Requirements", "containmentRef1", "Requirements.C"));
+ final ReferenceChange diff2 = (ReferenceChange)Iterators.find(differences.iterator(),
+ removedFromReference("Requirements", "containmentRef1", "Requirements.B"));
+ final ReferenceChange diff3 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.A", "destination", "Requirements.B", "Requirements.C"));
+ final ReferenceChange diff4 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.B", "source", "Requirements.A", null));
+ final ReferenceChange diff5 = (ReferenceChange)Iterators.find(differences.iterator(),
+ changedReference("Requirements.C", "source", null, "Requirements.A"));
+
+ // 1 is required by 3, which is required by 2 and equivalent to 4 and 5.
+ // Resetting 1 should thus reset all other diffs.
+ mergerRegistry.getHighestRankingMerger(diff1).copyRightToLeft(diff1, new BasicMonitor());
+ assertMerged(comparison, diff1, true, true);
+ assertMerged(comparison, diff2, false, true);
+
+ // C has been removed, thus the value match of diff3 has neither left nor right.
+ assertSame(DifferenceState.MERGED, diff3.getState());
+ final EObject nodeA = diff3.getMatch().getLeft();
+ final EObject nodeB = diff4.getMatch().getLeft();
+ assertSame(nodeB, nodeA.eGet(diff3.getReference()));
+
+ assertMerged(comparison, diff4, false, true);
+
+ assertSame(DifferenceState.MERGED, diff5.getState());
+ assertNull(diff5.getMatch().getLeft());
+ assertNull(diff5.getMatch().getRight());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ /**
+ * Ensures that the two given lists contain the same elements in the same order. The kind of list does not
+ * matter.
+ *
+ * @param list1
+ * First of the two lists to compare.
+ * @param list2
+ * Second of the two lists to compare.
+ */
+ private static <T extends EObject> void assertEqualContents(Comparison comparison, List<T> list1,
+ List<T> list2) {
+ final int size = list1.size();
+ assertSame(Integer.valueOf(size), Integer.valueOf(list2.size()));
+
+ for (int i = 0; i < size; i++) {
+ final EObject eObject1 = list1.get(i);
+ final EObject eObject2 = list2.get(i);
+ final Match match = comparison.getMatch(eObject1);
+ if (match.getLeft() == eObject1) {
+ assertEquals(match.getRight(), eObject2);
+ } else {
+ assertEquals(match.getRight(), eObject1);
+ assertEquals(match.getLeft(), eObject2);
+ }
+ }
+ }
+
+ /* NOTE : not meant for containment changes */
+ private static void assertMerged(Comparison comparison, ReferenceChange referenceChange, boolean unset,
+ boolean rightToLeft) {
+ assertSame(referenceChange.getState(), DifferenceState.MERGED);
+
+ final EObject container;
+ if (rightToLeft) {
+ container = referenceChange.getMatch().getLeft();
+ } else {
+ container = referenceChange.getMatch().getRight();
+ }
+
+ final EReference ref = referenceChange.getReference();
+ final Match valueMatch = comparison.getMatch(referenceChange.getValue());
+ if (unset && ref.isContainment()) {
+ assertNull(valueMatch);
+ } else if (ref.isMany()) {
+ @SuppressWarnings("unchecked")
+ final List<EObject> refValue = (List<EObject>)container.eGet(ref);
+ if (rightToLeft && unset) {
+ assertTrue(!refValue.contains(valueMatch.getLeft()));
+ } else if (rightToLeft) {
+ assertTrue(refValue.contains(valueMatch.getLeft()));
+ } else if (unset) {
+ assertTrue(!refValue.contains(valueMatch.getRight()));
+ } else {
+ assertTrue(refValue.contains(valueMatch.getRight()));
+ }
+ } else {
+ final EObject refValue = (EObject)container.eGet(ref);
+ if (unset) {
+ assertSame(null, refValue);
+ } else if (rightToLeft) {
+ assertSame(valueMatch.getLeft(), refValue);
+ } else {
+ assertSame(valueMatch.getRight(), refValue);
+ }
+ }
+ }
+
+ private static void assertValueIndexIs(ReferenceChange diff, boolean rightToLeft, int expectedIndex) {
+ final Match containerMatch = diff.getMatch();
+ final Match valueMatch = containerMatch.getComparison().getMatch(diff.getValue());
+
+ if (rightToLeft) {
+ if (expectedIndex != -1) {
+ assertNotNull(valueMatch.getLeft());
+ assertSame(containerMatch.getLeft().eResource(), valueMatch.getLeft().eResource());
+ final EObject addedToLeft = valueMatch.getLeft();
+ final List<EObject> values = getAsList(containerMatch.getLeft(), diff.getReference());
+ assertSame(Integer.valueOf(expectedIndex), Integer.valueOf(values.indexOf(addedToLeft)));
+ } else {
+ assertTrue(valueMatch == null || valueMatch.getLeft() == null);
+ }
+ } else {
+ if (expectedIndex != -1) {
+ assertNotNull(valueMatch.getRight());
+ assertSame(containerMatch.getRight().eResource(), valueMatch.getRight().eResource());
+ final EObject addedToRight = valueMatch.getRight();
+ final List<EObject> values = getAsList(containerMatch.getRight(), diff.getReference());
+ assertSame(Integer.valueOf(expectedIndex), Integer.valueOf(values.indexOf(addedToRight)));
+ } else {
+ assertTrue(valueMatch == null || valueMatch.getRight() == null);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static List<EObject> getAsList(EObject object, EReference feature) {
+ if (object != null) {
+ Object value = object.eGet(feature, false);
+ final List<EObject> asList;
+ if (value instanceof List) {
+ asList = (List<EObject>)value;
+ } else if (value instanceof Iterable) {
+ asList = ImmutableList.copyOf((Iterable<EObject>)value);
+ } else if (value != null) {
+ asList = ImmutableList.of((EObject)value);
+ } else {
+ asList = Collections.emptyList();
+ }
+ return asList;
+ }
+ return Collections.emptyList();
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
index 4c4dfbf74..852eee985 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
@@ -1,336 +1,336 @@
-/**
- * Copyright (c) 2012, 2013 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- */
-package org.eclipse.emf.compare.tests.merge.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- * Provides input models to the unit tests of the matching by id.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("nls")
-public class IndividualDiffInputData extends AbstractInputData {
- public Resource getAttributeMonoChangeLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemonochange/left.nodes");
- }
-
- public Resource getAttributeMonoChangeOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemonochange/origin.nodes");
- }
-
- public Resource getAttributeMonoChangeRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemonochange/right.nodes");
- }
-
- public Resource getAttributeMonoSetLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemonoset/left.nodes");
- }
-
- public Resource getAttributeMonoSetOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemonoset/origin.nodes");
- }
-
- public Resource getAttributeMonoSetRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemonoset/right.nodes");
- }
-
- public Resource getAttributeMonoUnsetLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemonounset/left.nodes");
- }
-
- public Resource getAttributeMonoUnsetOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemonounset/origin.nodes");
- }
-
- public Resource getAttributeMonoUnsetRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemonounset/right.nodes");
- }
-
- public Resource getAttributeMultiAddLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemultiadd/left.nodes");
- }
-
- public Resource getAttributeMultiAddOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemultiadd/origin.nodes");
- }
-
- public Resource getAttributeMultiAddRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemultiadd/right.nodes");
- }
-
- public Resource getAttributeMultiDelLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemultidel/left.nodes");
- }
-
- public Resource getAttributeMultiDelOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemultidel/origin.nodes");
- }
-
- public Resource getAttributeMultiDelRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemultidel/right.nodes");
- }
-
- public Resource getAttributeMultiMoveLeft() throws IOException {
- return loadFromClassLoader("fullscope/attributemultimove/left.nodes");
- }
-
- public Resource getAttributeMultiMoveOrigin() throws IOException {
- return loadFromClassLoader("fullscope/attributemultimove/origin.nodes");
- }
-
- public Resource getAttributeMultiMoveRight() throws IOException {
- return loadFromClassLoader("fullscope/attributemultimove/right.nodes");
- }
-
- public Resource getReferenceMonoChangeLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemonochange/left.nodes");
- }
-
- public Resource getReferenceMonoChangeOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemonochange/origin.nodes");
- }
-
- public Resource getReferenceMonoChangeRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemonochange/right.nodes");
- }
-
- public Resource getReferenceMonoSetLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemonoset/left.nodes");
- }
-
- public Resource getReferenceMonoSetOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemonoset/origin.nodes");
- }
-
- public Resource getReferenceMonoSetRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemonoset/right.nodes");
- }
-
- public Resource getReferenceMonoUnsetLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemonounset/left.nodes");
- }
-
- public Resource getReferenceMonoUnsetOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemonounset/origin.nodes");
- }
-
- public Resource getReferenceMonoUnsetRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemonounset/right.nodes");
- }
-
- public Resource getReferenceMultiAddLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemultiadd/left.nodes");
- }
-
- public Resource getReferenceMultiAddOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemultiadd/origin.nodes");
- }
-
- public Resource getReferenceMultiAddRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemultiadd/right.nodes");
- }
-
- public Resource getReferenceMultiDelLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemultidel/left.nodes");
- }
-
- public Resource getReferenceMultiDelOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemultidel/origin.nodes");
- }
-
- public Resource getReferenceMultiDelRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemultidel/right.nodes");
- }
-
- public Resource getReferenceMultiMoveLeft() throws IOException {
- return loadFromClassLoader("fullscope/referencemultimove/left.nodes");
- }
-
- public Resource getReferenceMultiMoveOrigin() throws IOException {
- return loadFromClassLoader("fullscope/referencemultimove/origin.nodes");
- }
-
- public Resource getReferenceMultiMoveRight() throws IOException {
- return loadFromClassLoader("fullscope/referencemultimove/right.nodes");
- }
-
- public Resource getReferenceMonoChangeLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonochange/left.nodes");
- }
-
- public Resource getReferenceMonoChangeOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonochange/origin.nodes");
- }
-
- public Resource getReferenceMonoChangeRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonochange/right.nodes");
- }
-
- public Resource getReferenceMonoSetLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonoset/left.nodes");
- }
-
- public Resource getReferenceMonoSetOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonoset/origin.nodes");
- }
-
- public Resource getReferenceMonoSetRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonoset/right.nodes");
- }
-
- public Resource getReferenceMonoUnsetLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonounset/left.nodes");
- }
-
- public Resource getReferenceMonoUnsetOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonounset/origin.nodes");
- }
-
- public Resource getReferenceMonoUnsetRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemonounset/right.nodes");
- }
-
- public Resource getReferenceMultiAddLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultiadd/left.nodes");
- }
-
- public Resource getReferenceMultiAddOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultiadd/origin.nodes");
- }
-
- public Resource getReferenceMultiAddRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultiadd/right.nodes");
- }
-
- public Resource getReferenceMultiDelLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultidel/left.nodes");
- }
-
- public Resource getReferenceMultiDelOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultidel/origin.nodes");
- }
-
- public Resource getReferenceMultiDelRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultidel/right.nodes");
- }
-
- public Resource getReferenceMultiMoveLeftOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultimove/left.nodes");
- }
-
- public Resource getReferenceMultiMoveOriginOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultimove/origin.nodes");
- }
-
- public Resource getReferenceMultiMoveRightOutOfScope() throws IOException {
- return loadFromClassLoader("outofscope/referencemultimove/right.nodes");
- }
-
- public Resource getLeftAddRightDeleteLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftadd_rightdelete/left.ecore");
- }
-
- public Resource getLeftAddRightDeleteOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftadd_rightdelete/origin.ecore");
- }
-
- public Resource getLeftAddRightDeleteRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftadd_rightdelete/right.ecore");
- }
-
- public Resource getLeftDeleteRightAddLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightadd/left.ecore");
- }
-
- public Resource getLeftDeleteRightAddOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightadd/origin.ecore");
- }
-
- public Resource getLeftDeleteRightAddRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightadd/right.ecore");
- }
-
- public Resource getLeftDeleteRightSetLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightset/left.ecore");
- }
-
- public Resource getLeftDeleteRightSetOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightset/origin.ecore");
- }
-
- public Resource getLeftDeleteRightSetRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightset/right.ecore");
- }
-
- public Resource getLeftSetRightDeleteLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightdelete/left.ecore");
- }
-
- public Resource getLeftSetRightDeleteOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightdelete/origin.ecore");
- }
-
- public Resource getLeftSetRightDeleteRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightdelete/right.ecore");
- }
-
- public Resource getLeftSetRightUnsetLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightunset/left.ecore");
- }
-
- public Resource getLeftSetRightUnsetOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightunset/origin.ecore");
- }
-
- public Resource getLeftSetRightUnsetRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftset_rightunset/right.ecore");
- }
-
- public Resource getLeftUnsetRightSetLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftunset_rightset/left.ecore");
- }
-
- public Resource getLeftUnsetRightSetOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftunset_rightset/origin.ecore");
- }
-
- public Resource getLeftUnsetRightSetRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftunset_rightset/right.ecore");
- }
-
- public Resource getLeftDeleteRightMoveLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightmove/left.ecore");
- }
-
- public Resource getLeftDeleteRightMoveOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightmove/origin.ecore");
- }
-
- public Resource getLeftDeleteRightMoveRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftdelete_rightmove/right.ecore");
- }
-
- public Resource getLeftMoveRightDeleteLeftConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftmove_rightdelete/left.ecore");
- }
-
- public Resource getLeftMoveRightDeleteOriginConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftmove_rightdelete/origin.ecore");
- }
-
- public Resource getLeftMoveRightDeleteRightConflictScope() throws IOException {
- return loadFromClassLoader("conflictscope/leftmove_rightdelete/right.ecore");
- }
-}
+/**
+ * Copyright (c) 2012, 2013 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.merge.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * Provides input models to the unit tests of the matching by id.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+@SuppressWarnings("nls")
+public class IndividualDiffInputData extends AbstractInputData {
+ public Resource getAttributeMonoChangeLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonochange/left.nodes");
+ }
+
+ public Resource getAttributeMonoChangeOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonochange/origin.nodes");
+ }
+
+ public Resource getAttributeMonoChangeRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonochange/right.nodes");
+ }
+
+ public Resource getAttributeMonoSetLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonoset/left.nodes");
+ }
+
+ public Resource getAttributeMonoSetOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonoset/origin.nodes");
+ }
+
+ public Resource getAttributeMonoSetRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonoset/right.nodes");
+ }
+
+ public Resource getAttributeMonoUnsetLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonounset/left.nodes");
+ }
+
+ public Resource getAttributeMonoUnsetOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonounset/origin.nodes");
+ }
+
+ public Resource getAttributeMonoUnsetRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemonounset/right.nodes");
+ }
+
+ public Resource getAttributeMultiAddLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultiadd/left.nodes");
+ }
+
+ public Resource getAttributeMultiAddOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultiadd/origin.nodes");
+ }
+
+ public Resource getAttributeMultiAddRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultiadd/right.nodes");
+ }
+
+ public Resource getAttributeMultiDelLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultidel/left.nodes");
+ }
+
+ public Resource getAttributeMultiDelOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultidel/origin.nodes");
+ }
+
+ public Resource getAttributeMultiDelRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultidel/right.nodes");
+ }
+
+ public Resource getAttributeMultiMoveLeft() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultimove/left.nodes");
+ }
+
+ public Resource getAttributeMultiMoveOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultimove/origin.nodes");
+ }
+
+ public Resource getAttributeMultiMoveRight() throws IOException {
+ return loadFromClassLoader("fullscope/attributemultimove/right.nodes");
+ }
+
+ public Resource getReferenceMonoChangeLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonochange/left.nodes");
+ }
+
+ public Resource getReferenceMonoChangeOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonochange/origin.nodes");
+ }
+
+ public Resource getReferenceMonoChangeRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonochange/right.nodes");
+ }
+
+ public Resource getReferenceMonoSetLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonoset/left.nodes");
+ }
+
+ public Resource getReferenceMonoSetOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonoset/origin.nodes");
+ }
+
+ public Resource getReferenceMonoSetRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonoset/right.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonounset/left.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonounset/origin.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemonounset/right.nodes");
+ }
+
+ public Resource getReferenceMultiAddLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultiadd/left.nodes");
+ }
+
+ public Resource getReferenceMultiAddOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultiadd/origin.nodes");
+ }
+
+ public Resource getReferenceMultiAddRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultiadd/right.nodes");
+ }
+
+ public Resource getReferenceMultiDelLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultidel/left.nodes");
+ }
+
+ public Resource getReferenceMultiDelOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultidel/origin.nodes");
+ }
+
+ public Resource getReferenceMultiDelRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultidel/right.nodes");
+ }
+
+ public Resource getReferenceMultiMoveLeft() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultimove/left.nodes");
+ }
+
+ public Resource getReferenceMultiMoveOrigin() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultimove/origin.nodes");
+ }
+
+ public Resource getReferenceMultiMoveRight() throws IOException {
+ return loadFromClassLoader("fullscope/referencemultimove/right.nodes");
+ }
+
+ public Resource getReferenceMonoChangeLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonochange/left.nodes");
+ }
+
+ public Resource getReferenceMonoChangeOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonochange/origin.nodes");
+ }
+
+ public Resource getReferenceMonoChangeRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonochange/right.nodes");
+ }
+
+ public Resource getReferenceMonoSetLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonoset/left.nodes");
+ }
+
+ public Resource getReferenceMonoSetOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonoset/origin.nodes");
+ }
+
+ public Resource getReferenceMonoSetRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonoset/right.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonounset/left.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonounset/origin.nodes");
+ }
+
+ public Resource getReferenceMonoUnsetRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemonounset/right.nodes");
+ }
+
+ public Resource getReferenceMultiAddLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultiadd/left.nodes");
+ }
+
+ public Resource getReferenceMultiAddOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultiadd/origin.nodes");
+ }
+
+ public Resource getReferenceMultiAddRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultiadd/right.nodes");
+ }
+
+ public Resource getReferenceMultiDelLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultidel/left.nodes");
+ }
+
+ public Resource getReferenceMultiDelOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultidel/origin.nodes");
+ }
+
+ public Resource getReferenceMultiDelRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultidel/right.nodes");
+ }
+
+ public Resource getReferenceMultiMoveLeftOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultimove/left.nodes");
+ }
+
+ public Resource getReferenceMultiMoveOriginOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultimove/origin.nodes");
+ }
+
+ public Resource getReferenceMultiMoveRightOutOfScope() throws IOException {
+ return loadFromClassLoader("outofscope/referencemultimove/right.nodes");
+ }
+
+ public Resource getLeftAddRightDeleteLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftadd_rightdelete/left.ecore");
+ }
+
+ public Resource getLeftAddRightDeleteOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftadd_rightdelete/origin.ecore");
+ }
+
+ public Resource getLeftAddRightDeleteRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftadd_rightdelete/right.ecore");
+ }
+
+ public Resource getLeftDeleteRightAddLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightadd/left.ecore");
+ }
+
+ public Resource getLeftDeleteRightAddOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightadd/origin.ecore");
+ }
+
+ public Resource getLeftDeleteRightAddRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightadd/right.ecore");
+ }
+
+ public Resource getLeftDeleteRightSetLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightset/left.ecore");
+ }
+
+ public Resource getLeftDeleteRightSetOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightset/origin.ecore");
+ }
+
+ public Resource getLeftDeleteRightSetRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightset/right.ecore");
+ }
+
+ public Resource getLeftSetRightDeleteLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightdelete/left.ecore");
+ }
+
+ public Resource getLeftSetRightDeleteOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightdelete/origin.ecore");
+ }
+
+ public Resource getLeftSetRightDeleteRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightdelete/right.ecore");
+ }
+
+ public Resource getLeftSetRightUnsetLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightunset/left.ecore");
+ }
+
+ public Resource getLeftSetRightUnsetOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightunset/origin.ecore");
+ }
+
+ public Resource getLeftSetRightUnsetRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftset_rightunset/right.ecore");
+ }
+
+ public Resource getLeftUnsetRightSetLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftunset_rightset/left.ecore");
+ }
+
+ public Resource getLeftUnsetRightSetOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftunset_rightset/origin.ecore");
+ }
+
+ public Resource getLeftUnsetRightSetRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftunset_rightset/right.ecore");
+ }
+
+ public Resource getLeftDeleteRightMoveLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightmove/left.ecore");
+ }
+
+ public Resource getLeftDeleteRightMoveOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightmove/origin.ecore");
+ }
+
+ public Resource getLeftDeleteRightMoveRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftdelete_rightmove/right.ecore");
+ }
+
+ public Resource getLeftMoveRightDeleteLeftConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftmove_rightdelete/left.ecore");
+ }
+
+ public Resource getLeftMoveRightDeleteOriginConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftmove_rightdelete/origin.ecore");
+ }
+
+ public Resource getLeftMoveRightDeleteRightConflictScope() throws IOException {
+ return loadFromClassLoader("conflictscope/leftmove_rightdelete/right.ecore");
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/postprocess/data/PostProcessInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/postprocess/data/PostProcessInputData.java
index 9e86e6240..b92e48bca 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/postprocess/data/PostProcessInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/postprocess/data/PostProcessInputData.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.postprocess.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class PostProcessInputData extends AbstractInputData {
- public Resource getLeft() throws IOException {
- return loadFromClassLoader("left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getRight() throws IOException {
- return loadFromClassLoader("right.nodes"); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.postprocess.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class PostProcessInputData extends AbstractInputData {
+ public Resource getLeft() throws IOException {
+ return loadFromClassLoader("left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getRight() throws IOException {
+ return loadFromClassLoader("right.nodes"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/ReqComputingTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/ReqComputingTest.java
index 2115d0f57..9461dcdc0 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/ReqComputingTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/ReqComputingTest.java
@@ -1,1667 +1,1667 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.req;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.getOnlyElement;
-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.movedInReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-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.EList;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.req.data.ReqInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ReqComputingTest {
-
- enum TestKind {
- ADD, DELETE;
- }
-
- private ReqInputData input = new ReqInputData();
-
- @Test
- public void testA1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB2(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB3(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA4UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB4(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA5UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB5(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA6UseCase() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB6(TestKind.DELETE, comparison);
-
- }
-
- @Test
- public void testA7UseCase() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB7(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA8UseCase() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB8(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA9UseCase() throws IOException {
- final Resource left = input.getA9Left();
- final Resource right = input.getA9Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB9(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA10Left();
- final Resource right = input.getA10Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB10(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA11Left();
- final Resource right = input.getA11Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB11(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB2(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB3(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB4UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB4(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB5UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB5(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB6UseCase() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB6(TestKind.ADD, comparison);
- }
-
- @Test
- public void testB7UseCase() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB7(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testB8UseCase() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB8(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testB9UseCase() throws IOException {
- final Resource left = input.getA9Left();
- final Resource right = input.getA9Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB9(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testB10UseCase() throws IOException {
- final Resource left = input.getA10Left();
- final Resource right = input.getA10Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB10(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testB11UseCase() throws IOException {
- final Resource left = input.getA11Left();
- final Resource right = input.getA11Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB11(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testC1UseCase() throws IOException {
- final Resource left = input.getC1Left();
- final Resource right = input.getC1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testC2UseCase() throws IOException {
- final Resource left = input.getC2Left();
- final Resource right = input.getC2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD2(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testC3UseCase() throws IOException {
- final Resource left = input.getC3Left();
- final Resource right = input.getC3Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD3(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testC4UseCase() throws IOException {
- final Resource left = input.getC4Left();
- final Resource right = input.getC4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD4(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testC5UseCase() throws IOException {
- final Resource left = input.getC5Left();
- final Resource right = input.getC5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD5(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testD1UseCase() throws IOException {
- final Resource left = input.getC1Left();
- final Resource right = input.getC1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testD2UseCase() throws IOException {
- final Resource left = input.getC2Left();
- final Resource right = input.getC2Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD2(TestKind.ADD, comparison);
- }
-
- @Test
- public void testD3UseCase() throws IOException {
- final Resource left = input.getC3Left();
- final Resource right = input.getC3Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD3(TestKind.ADD, comparison);
- }
-
- @Test
- public void testD4UseCase() throws IOException {
- final Resource left = input.getC4Left();
- final Resource right = input.getC4Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD4(TestKind.ADD, comparison);
- }
-
- @Test
- public void testD5UseCase() throws IOException {
- final Resource left = input.getC5Left();
- final Resource right = input.getC5Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD5(TestKind.ADD, comparison);
- }
-
- @Test
- public void testE1UseCase1() throws IOException {
- final Resource left = input.getE1Left();
- final Resource right = input.getE1Right();
- final Resource ancestor = input.getE1Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE2UseCase() throws IOException {
- final Resource left = input.getE2Left();
- final Resource right = input.getE2Right();
- final Resource ancestor = input.getE2Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB2(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE3UseCase() throws IOException {
- final Resource left = input.getE3Left();
- final Resource right = input.getE3Right();
- final Resource ancestor = input.getE3Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB3(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE4UseCase() throws IOException {
- final Resource left = input.getE4Left();
- final Resource right = input.getE4Right();
- final Resource ancestor = input.getE4Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB4(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE5UseCase() throws IOException {
- final Resource left = input.getE5Left();
- final Resource right = input.getE5Right();
- final Resource ancestor = input.getE5Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB5(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE6UseCase() throws IOException {
- final Resource left = input.getE6Left();
- final Resource right = input.getE6Right();
- final Resource ancestor = input.getE6Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB6(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE7UseCase() throws IOException {
- final Resource left = input.getE7Left();
- final Resource right = input.getE7Right();
- final Resource ancestor = input.getE7Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE8UseCase() throws IOException {
- final Resource left = input.getE8Left();
- final Resource right = input.getE8Right();
- final Resource ancestor = input.getE8Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD2(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE9UseCase() throws IOException {
- final Resource left = input.getE9Left();
- final Resource right = input.getE9Right();
- final Resource ancestor = input.getE9Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD3(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE10UseCase() throws IOException {
- final Resource left = input.getE10Left();
- final Resource right = input.getE10Right();
- final Resource ancestor = input.getE10Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD4(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testE11UseCase() throws IOException {
- final Resource left = input.getE11Left();
- final Resource right = input.getE11Right();
- final Resource ancestor = input.getE11Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD5(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testF1UseCase1() throws IOException {
- final Resource left = input.getF1Left();
- final Resource right = input.getF1Right();
- final Resource ancestor = input.getF1Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF2UseCase() throws IOException {
- final Resource left = input.getF2Left();
- final Resource right = input.getF2Right();
- final Resource ancestor = input.getF2Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB2(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF3UseCase() throws IOException {
- final Resource left = input.getF3Left();
- final Resource right = input.getF3Right();
- final Resource ancestor = input.getF3Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB3(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF4UseCase() throws IOException {
- final Resource left = input.getF4Left();
- final Resource right = input.getF4Right();
- final Resource ancestor = input.getF4Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB4(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF5UseCase() throws IOException {
- final Resource left = input.getF5Left();
- final Resource right = input.getF5Right();
- final Resource ancestor = input.getF5Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB5(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF6UseCase() throws IOException {
- final Resource left = input.getF6Left();
- final Resource right = input.getF6Right();
- final Resource ancestor = input.getF6Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testAB6(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF7UseCase() throws IOException {
- final Resource left = input.getF7Left();
- final Resource right = input.getF7Right();
- final Resource ancestor = input.getF7Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF8UseCase() throws IOException {
- final Resource left = input.getF8Left();
- final Resource right = input.getF8Right();
- final Resource ancestor = input.getF8Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD2(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF9UseCase() throws IOException {
- final Resource left = input.getF9Left();
- final Resource right = input.getF9Right();
- final Resource ancestor = input.getF9Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD3(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF10UseCase() throws IOException {
- final Resource left = input.getF10Left();
- final Resource right = input.getF10Right();
- final Resource ancestor = input.getF10Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD4(TestKind.ADD, comparison);
- }
-
- @Test
- public void testF11UseCase() throws IOException {
- final Resource left = input.getF11Left();
- final Resource right = input.getF11Right();
- final Resource ancestor = input.getF11Ancestor();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- testCD5(TestKind.ADD, comparison);
- }
-
- @Test
- public void testG1UseCase() throws IOException {
- final Resource left = input.getG1Left();
- final Resource right = input.getG1Right();
-
- final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
- final Comparison comparison = EMFCompare.builder().build().compare(scope);
- String root = "root";
- String node1 = root + ".node1";
- String node2 = node1 + ".node2";
-
- EList<Diff> differences = comparison.getDifferences();
-
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
- Diff added1 = getOnlyElement(filter(differences, added(node1)), null);
- assertNotNull(added1);
- Diff added2 = getOnlyElement(filter(differences, added(node2)), null);
- assertNotNull(added2);
-
- ReferenceChange singleChange = null;
- for (ReferenceChange change : filter(differences, ReferenceChange.class)) {
- if ("singleValuedReference".equals(change.getReference().getName())) {
- singleChange = change;
- break;
- }
- }
- assertNotNull(singleChange);
- // Happy compiler
- assert singleChange != null;
- assertTrue(singleChange.getValue().eIsProxy());
- assertSame(Integer.valueOf(0), Integer.valueOf(added1.getRequires().size()));
- assertSame(Integer.valueOf(1), Integer.valueOf(added2.getRequires().size()));
- assertTrue(added2.getRequires().contains(added1));
- assertSame(Integer.valueOf(1), Integer.valueOf(singleChange.getRequires().size()));
- assertTrue(singleChange.getRequires().contains(added2));
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteSourceDiffDescription = null;
- Predicate<? super Diff> deleteDestinationDiffDescription = null;
- Predicate<? super Diff> changedSingleValuedRefDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteSourceDiffDescription = removed("Requirements.containerSource.source"); //$NON-NLS-1$
-
- deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination"); //$NON-NLS-1$
-
- changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
- "singleValuedReference", "Requirements.containerDestination.destination", null); //$NON-NLS-1$//$NON-NLS-2$
- } else {
- deleteSourceDiffDescription = added("Requirements.containerSource.source"); //$NON-NLS-1$
-
- deleteDestinationDiffDescription = added("Requirements.containerDestination.destination"); //$NON-NLS-1$
-
- changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
- "singleValuedReference", null, "Requirements.containerDestination.destination"); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- final Diff deleteSourceDiff = Iterators.find(differences.iterator(), deleteSourceDiffDescription);
-
- final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
- deleteDestinationDiffDescription);
-
- final Diff changedSingleValuedRefDiff = Iterators.find(differences.iterator(),
- changedSingleValuedRefDiffDescription);
-
- assertNotNull(deleteSourceDiff);
- assertNotNull(deleteDestinationDiff);
- assertNotNull(changedSingleValuedRefDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteSourceDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
- assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteDestinationDiff));
- assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteSourceDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteSourceDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
- }
- }
-
- private void testAB2(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteSourceDiffDescription = null;
- Predicate<? super Diff> deleteDestinationDiffDescription = null;
- Predicate<? super Diff> deleteMultiValuedRefDiffDescription = null;
- if (kind.equals(TestKind.DELETE)) {
- deleteSourceDiffDescription = removed("Requirements.containerSource.source"); //$NON-NLS-1$
- deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination"); //$NON-NLS-1$
- deleteMultiValuedRefDiffDescription = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination"); //$NON-NLS-1$//$NON-NLS-2$
- } else {
- deleteSourceDiffDescription = added("Requirements.containerSource.source"); //$NON-NLS-1$
- deleteDestinationDiffDescription = added("Requirements.containerDestination.destination"); //$NON-NLS-1$
- deleteMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final Diff deleteSourceDiff = Iterators.find(differences.iterator(), deleteSourceDiffDescription);
-
- final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
- deleteDestinationDiffDescription);
-
- final Diff deleteMultiValuedRefDiff = Iterators.find(differences.iterator(),
- deleteMultiValuedRefDiffDescription);
-
- assertNotNull(deleteSourceDiff);
- assertNotNull(deleteDestinationDiff);
- assertNotNull(deleteMultiValuedRefDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteSourceDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteMultiValuedRefDiff.getRequires().size()));
- assertTrue(deleteMultiValuedRefDiff.getRequires().contains(deleteDestinationDiff));
- assertTrue(deleteMultiValuedRefDiff.getRequires().contains(deleteSourceDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteSourceDiff.getRequires().size()));
- assertTrue(deleteSourceDiff.getRequires().contains(deleteMultiValuedRefDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
- assertTrue(deleteDestinationDiff.getRequires().contains(deleteMultiValuedRefDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteMultiValuedRefDiff.getRequires().size()));
- }
- }
-
- private void testAB3(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 2 differences
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteDestinationDiffDescription = null;
- Predicate<? super Diff> changedSingleValuedRefDiffDescription = null;
- if (kind.equals(TestKind.DELETE)) {
- deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
- "singleValuedReference", "Requirements.containerDestination.destination2", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.destination1"); //$NON-NLS-1$
- } else {
- deleteDestinationDiffDescription = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
- "singleValuedReference", "Requirements.destination1", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.containerDestination.destination2"); //$NON-NLS-1$
- }
-
- final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
- deleteDestinationDiffDescription);
-
- final Diff changedSingleValuedRefDiff = Iterators.find(differences.iterator(),
- changedSingleValuedRefDiffDescription);
-
- assertNotNull(deleteDestinationDiff);
- assertNotNull(changedSingleValuedRefDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
- assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteDestinationDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
- assertTrue(deleteDestinationDiff.getRequires().contains(changedSingleValuedRefDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
- }
- }
-
- private void testAB4(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteDestinationDiffDescription = null;
- Predicate<? super Diff> deletedMultiValuedRefDiffDescription = null;
- Predicate<? super Diff> addedMultiValuedRefDiffDescription = null;
- if (kind.equals(TestKind.DELETE)) {
- deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- deletedMultiValuedRefDiffDescription = removedFromReference(
- "Requirements.containerSource.source", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.containerDestination.destination2"); //$NON-NLS-1$
- addedMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$//$NON-NLS-2$
- } else {
- deleteDestinationDiffDescription = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- deletedMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$ //$NON-NLS-2$
- addedMultiValuedRefDiffDescription = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
- deleteDestinationDiffDescription);
-
- final Diff deletedMultiValuedRefDiff = Iterators.find(differences.iterator(),
- deletedMultiValuedRefDiffDescription);
-
- final Diff addedMultiValuedRefDiff = Iterators.find(differences.iterator(),
- addedMultiValuedRefDiffDescription);
-
- assertNotNull(deleteDestinationDiff);
- assertNotNull(deletedMultiValuedRefDiff);
- assertNotNull(addedMultiValuedRefDiffDescription);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deletedMultiValuedRefDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addedMultiValuedRefDiff.getRequires().size()));
- assertTrue(deletedMultiValuedRefDiff.getRequires().contains(deleteDestinationDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
- assertTrue(deleteDestinationDiff.getRequires().contains(deletedMultiValuedRefDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deletedMultiValuedRefDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addedMultiValuedRefDiff.getRequires().size()));
- }
-
- }
-
- private void testAB5(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 8 differences
- assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addDest4Description = null;
- Predicate<? super Diff> delDest2Description = null;
- Predicate<? super Diff> delDest3Description = null;
- Predicate<? super Diff> addRefDest1Description = null;
- Predicate<? super Diff> addRefDest4Description = null;
- Predicate<? super Diff> delRefDest2Description = null;
- Predicate<? super Diff> delRefDest3Description = null;
- Predicate<? super Diff> delRefDest5Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addDest4Description = added("Requirements.destination4"); //$NON-NLS-1$
- delDest2Description = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- delDest3Description = removed("Requirements.containerDestination.destination3"); //$NON-NLS-1$
-
- addRefDest1Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$ //$NON-NLS-2$
- addRefDest4Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination4"); //$NON-NLS-1$//$NON-NLS-2$
- delRefDest2Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$ //$NON-NLS-2$
- delRefDest3Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination3"); //$NON-NLS-1$ //$NON-NLS-2$
- delRefDest5Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination5"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- addDest4Description = removed("Requirements.destination4"); //$NON-NLS-1$
- delDest2Description = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
- delDest3Description = added("Requirements.containerDestination.destination3"); //$NON-NLS-1$
-
- addRefDest1Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$//$NON-NLS-2$
- addRefDest4Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination4"); //$NON-NLS-1$//$NON-NLS-2$
- delRefDest2Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$//$NON-NLS-2$
- delRefDest3Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.containerDestination.destination3"); //$NON-NLS-1$ //$NON-NLS-2$
- delRefDest5Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination5"); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- final Diff addDest4 = Iterators.find(differences.iterator(), addDest4Description);
- final Diff delDest2 = Iterators.find(differences.iterator(), delDest2Description);
- final Diff delDest3 = Iterators.find(differences.iterator(), delDest3Description);
-
- final Diff addRefDest1 = Iterators.find(differences.iterator(), addRefDest1Description);
- final Diff addRefDest4 = Iterators.find(differences.iterator(), addRefDest4Description);
- final Diff delRefDest2 = Iterators.find(differences.iterator(), delRefDest2Description);
- final Diff delRefDest3 = Iterators.find(differences.iterator(), delRefDest3Description);
- final Diff delRefDest5 = Iterators.find(differences.iterator(), delRefDest5Description);
-
- assertNotNull(addDest4);
- assertNotNull(delDest2);
- assertNotNull(delDest3);
- assertNotNull(addRefDest1);
- assertNotNull(addRefDest4);
- assertNotNull(delRefDest2);
- assertNotNull(delRefDest3);
- assertNotNull(delRefDest5);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addDest4.getRequires().size()));
- assertTrue(addDest4.getRequires().contains(addRefDest4));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delDest2.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delDest3.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest1.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest4.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delRefDest2.getRequires().size()));
- assertTrue(delRefDest2.getRequires().contains(delDest2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delRefDest3.getRequires().size()));
- assertTrue(delRefDest3.getRequires().contains(delDest3));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest5.getRequires().size()));
-
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addDest4.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delDest2.getRequires().size()));
- assertTrue(delDest2.getRequires().contains(delRefDest2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delDest3.getRequires().size()));
- assertTrue(delDest3.getRequires().contains(delRefDest3));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest1.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefDest4.getRequires().size()));
- assertTrue(addRefDest4.getRequires().contains(addDest4));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest2.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest3.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest5.getRequires().size()));
- }
-
- }
-
- private void testAB6(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 7 differences
- assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> delDestDescription = null;
- Predicate<? super Diff> delContainerDescription = null;
- Predicate<? super Diff> delSubContainerDescription = null;
- Predicate<? super Diff> delSource1Description = null;
- Predicate<? super Diff> delSource2Description = null;
- Predicate<? super Diff> delRefSource1Description = null;
- Predicate<? super Diff> delRefSource2Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- delDestDescription = removed("Requirements.destination"); //$NON-NLS-1$
- delContainerDescription = removed("Requirements.container"); //$NON-NLS-1$
- delSubContainerDescription = removed("Requirements.container.subContainer"); //$NON-NLS-1$
- delSource1Description = removed("Requirements.container.subContainer.source1"); //$NON-NLS-1$
- delSource2Description = removed("Requirements.container.subContainer.source2"); //$NON-NLS-1$
-
- delRefSource1Description = changedReference("Requirements.container.subContainer.source1", //$NON-NLS-1$
- "singleValuedReference", "Requirements.destination", null); //$NON-NLS-1$//$NON-NLS-2$
- delRefSource2Description = removedFromReference("Requirements.container.subContainer.source2", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- delDestDescription = added("Requirements.destination"); //$NON-NLS-1$
- delContainerDescription = added("Requirements.container"); //$NON-NLS-1$
- delSubContainerDescription = added("Requirements.container.subContainer"); //$NON-NLS-1$
- delSource1Description = added("Requirements.container.subContainer.source1"); //$NON-NLS-1$
- delSource2Description = added("Requirements.container.subContainer.source2"); //$NON-NLS-1$
-
- delRefSource1Description = changedReference("Requirements.container.subContainer.source1", //$NON-NLS-1$
- "singleValuedReference", null, "Requirements.destination"); //$NON-NLS-1$ //$NON-NLS-2$
- delRefSource2Description = addedToReference("Requirements.container.subContainer.source2", //$NON-NLS-1$
- "multiValuedReference", "Requirements.destination"); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- final Diff delDest = Iterators.find(differences.iterator(), delDestDescription);
- final Diff delContainer = Iterators.find(differences.iterator(), delContainerDescription);
- final Diff delSubContainer = Iterators.find(differences.iterator(), delSubContainerDescription);
- final Diff delSource1 = Iterators.find(differences.iterator(), delSource1Description);
- final Diff delSource2 = Iterators.find(differences.iterator(), delSource2Description);
- final Diff delRefSource1 = Iterators.find(differences.iterator(), delRefSource1Description);
- final Diff delRefSource2 = Iterators.find(differences.iterator(), delRefSource2Description);
-
- assertNotNull(delDest);
- assertNotNull(delContainer);
- assertNotNull(delSubContainer);
- assertNotNull(delSource1);
- assertNotNull(delSource2);
- assertNotNull(delRefSource1);
- assertNotNull(delRefSource2);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(delDest.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delContainer.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delSubContainer.getRequires().size()));
- assertTrue(delSubContainer.getRequires().contains(delContainer));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delSource1.getRequires().size()));
- assertTrue(delSource1.getRequires().contains(delSubContainer));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delSource2.getRequires().size()));
- assertTrue(delSource2.getRequires().contains(delSubContainer));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(delRefSource1.getRequires().size()));
- assertTrue(delRefSource1.getRequires().contains(delSource1));
- assertTrue(delRefSource2.getRequires().contains(delSource2));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(delRefSource2.getRequires().size()));
- assertTrue(delRefSource1.getRequires().contains(delDest));
- assertTrue(delRefSource2.getRequires().contains(delDest));
- } else {
- assertSame(Integer.valueOf(2), Integer.valueOf(delDest.getRequires().size()));
- assertTrue(delDest.getRequires().contains(delRefSource1));
- assertTrue(delDest.getRequires().contains(delRefSource2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delContainer.getRequires().size()));
- assertTrue(delContainer.getRequires().contains(delSubContainer));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(delSubContainer.getRequires().size()));
- assertTrue(delSubContainer.getRequires().contains(delSource1));
- assertTrue(delSubContainer.getRequires().contains(delSource2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delSource1.getRequires().size()));
- assertTrue(delSource1.getRequires().contains(delRefSource1));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delSource2.getRequires().size()));
- assertTrue(delSource2.getRequires().contains(delRefSource2));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefSource1.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefSource2.getRequires().size()));
- }
-
- }
-
- private void testAB7(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 4 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addBDescription = null;
- Predicate<? super Diff> delCDescription = null;
- Predicate<? super Diff> addEDescription = null;
- Predicate<? super Diff> delFDescription = null;
-
- if (kind.equals(TestKind.ADD)) {
- addBDescription = added("Requirements.A.B"); //$NON-NLS-1$
- delCDescription = removed("Requirements.A.C"); //$NON-NLS-1$
- addEDescription = added("Requirements.D.E"); //$NON-NLS-1$
- delFDescription = removed("Requirements.D.F"); //$NON-NLS-1$
- } else {
- addBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
- delCDescription = added("Requirements.A.C"); //$NON-NLS-1$
- addEDescription = removed("Requirements.D.E"); //$NON-NLS-1$
- delFDescription = added("Requirements.D.F"); //$NON-NLS-1$
- }
-
- final Diff addB = Iterators.find(differences.iterator(), addBDescription);
- final Diff delC = Iterators.find(differences.iterator(), delCDescription);
- final Diff addE = Iterators.find(differences.iterator(), addEDescription);
- final Diff delF = Iterators.find(differences.iterator(), delFDescription);
-
- assertNotNull(addB);
- assertNotNull(delC);
- assertNotNull(addE);
- assertNotNull(delF);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
- assertTrue(addB.getRequires().contains(delC));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delC.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delC.getRequires().size()));
- assertTrue(delC.getRequires().contains(addB));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
- }
-
- }
-
- private void testAB8(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 7 differences
- assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addBDescription = null;
- Predicate<? super Diff> delCDescription = null;
- Predicate<? super Diff> changeRefBDescription = null;
- Predicate<? super Diff> addEDescription = null;
- Predicate<? super Diff> delFDescription = null;
- Predicate<? super Diff> addRefEDescription = null;
- Predicate<? super Diff> delRefFDescription = null;
-
- if (kind.equals(TestKind.ADD)) {
- addBDescription = added("Requirements.B"); //$NON-NLS-1$
- delCDescription = removed("Requirements.C"); //$NON-NLS-1$
- changeRefBDescription = changedReference(
- "Requirements.A", "singleValuedReference", "Requirements.C", "Requirements.B"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addEDescription = added("Requirements.E"); //$NON-NLS-1$
- delFDescription = removed("Requirements.F"); //$NON-NLS-1$
- addRefEDescription = addedToReference("Requirements.D", "multiValuedReference", "Requirements.E"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- delRefFDescription = removedFromReference(
- "Requirements.D", "multiValuedReference", "Requirements.F"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- } else {
- addBDescription = removed("Requirements.B"); //$NON-NLS-1$
- delCDescription = added("Requirements.C"); //$NON-NLS-1$
- changeRefBDescription = changedReference(
- "Requirements.A", "singleValuedReference", "Requirements.B", "Requirements.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- addEDescription = removed("Requirements.E"); //$NON-NLS-1$
- delFDescription = added("Requirements.F"); //$NON-NLS-1$
- addRefEDescription = removedFromReference(
- "Requirements.D", "multiValuedReference", "Requirements.E"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- delRefFDescription = addedToReference("Requirements.D", "multiValuedReference", "Requirements.F"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
-
- final Diff addB = Iterators.find(differences.iterator(), addBDescription);
- final Diff delC = Iterators.find(differences.iterator(), delCDescription);
- final Diff changeRefB = Iterators.find(differences.iterator(), changeRefBDescription);
- final Diff addE = Iterators.find(differences.iterator(), addEDescription);
- final Diff delF = Iterators.find(differences.iterator(), delFDescription);
- final Diff addRefE = Iterators.find(differences.iterator(), addRefEDescription);
- final Diff delRefF = Iterators.find(differences.iterator(), delRefFDescription);
-
- assertNotNull(addB);
- assertNotNull(delC);
- assertNotNull(changeRefB);
- assertNotNull(addE);
- assertNotNull(delF);
- assertNotNull(addRefE);
- assertNotNull(delRefF);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delC.getRequires().size()));
- assertTrue(delC.getRequires().contains(changeRefB));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
- assertTrue(changeRefB.getRequires().contains(addB));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delF.getRequires().size()));
- assertTrue(delF.getRequires().contains(delRefF));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefE.getRequires().size()));
- assertTrue(addRefE.getRequires().contains(addE));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delRefF.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
- assertTrue(addB.getRequires().contains(changeRefB));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delC.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
- assertTrue(changeRefB.getRequires().contains(delC));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addE.getRequires().size()));
- assertTrue(addE.getRequires().contains(addRefE));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefE.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(delRefF.getRequires().size()));
- assertTrue(delRefF.getRequires().contains(delF));
- }
-
- }
-
- private void testAB9(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 2 differences
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addBDescription = null;
- Predicate<? super Diff> addCDescription = null;
-
- if (kind.equals(TestKind.ADD)) {
- addBDescription = added("Requirements.A.B"); //$NON-NLS-1$
- addCDescription = added("Requirements.A.B.C"); //$NON-NLS-1$
- } else {
- addBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
- addCDescription = removed("Requirements.A.B.C"); //$NON-NLS-1$
- }
-
- final Diff addB = Iterators.find(differences.iterator(), addBDescription);
- final Diff addC = Iterators.find(differences.iterator(), addCDescription);
-
- assertNotNull(addB);
- assertNotNull(addC);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addC.getRequires().size()));
- assertTrue(addC.getRequires().contains(addB));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
- assertTrue(addB.getRequires().contains(addC));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addC.getRequires().size()));
- }
-
- }
-
- private void testAB10(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 4 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addADescription = null;
- Predicate<? super Diff> addCDescription = null;
- Predicate<? super Diff> changeRefBDescription = null;
- Predicate<? super Diff> addRefBDescription = null;
-
- if (kind.equals(TestKind.ADD)) {
- addADescription = added("Requirements.A"); //$NON-NLS-1$
- addCDescription = added("Requirements.C"); //$NON-NLS-1$
- changeRefBDescription = changedReference("Requirements.A", "singleValuedReference", null,
- "Requirements.B");
- addRefBDescription = addedToReference("Requirements.C", "multiValuedReference", "Requirements.B");
- } else {
- addADescription = removed("Requirements.A"); //$NON-NLS-1$
- addCDescription = removed("Requirements.C"); //$NON-NLS-1$
- changeRefBDescription = changedReference("Requirements.A", "singleValuedReference",
- "Requirements.B", null);
- addRefBDescription = removedFromReference("Requirements.C", "multiValuedReference",
- "Requirements.B");
- }
-
- final Diff addA = Iterators.find(differences.iterator(), addADescription);
- final Diff addC = Iterators.find(differences.iterator(), addCDescription);
- final Diff changeRefB = Iterators.find(differences.iterator(), changeRefBDescription);
- final Diff addRefB = Iterators.find(differences.iterator(), addRefBDescription);
-
- assertNotNull(addA);
- assertNotNull(addC);
- assertNotNull(changeRefB);
- assertNotNull(addRefB);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(addA.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addC.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
- assertTrue(changeRefB.getRequires().contains(addA));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefB.getRequires().size()));
- assertTrue(addRefB.getRequires().contains(addC));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(addA.getRequires().size()));
- assertTrue(addA.getRequires().contains(changeRefB));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addC.getRequires().size()));
- assertTrue(addC.getRequires().contains(addRefB));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(changeRefB.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefB.getRequires().size()));
- }
-
- }
-
- private void testAB11(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 4 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> delBDescription = null;
- Predicate<? super Diff> moveCDescription = null;
- Predicate<? super Diff> moveDDescription = null;
- Predicate<? super Diff> moveEDescription = null;
-
- if (kind.equals(TestKind.ADD)) {
- delBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
- moveCDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- moveDDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.D"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- moveEDescription = movedInReference("Requirements.A.D", "containmentRef1", "Requirements.A.D.E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- delBDescription = added("Requirements.A.B"); //$NON-NLS-1$
- moveCDescription = movedInReference("Requirements.A.B", "containmentRef1", "Requirements.A.B.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- moveDDescription = movedInReference("Requirements.A.E", "containmentRef1", "Requirements.A.E.D"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- moveEDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- final Diff delB = Iterators.find(differences.iterator(), delBDescription);
- final Diff moveC = Iterators.find(differences.iterator(), moveCDescription);
- final Diff moveD = Iterators.find(differences.iterator(), moveDDescription);
- final Diff moveE = Iterators.find(differences.iterator(), moveEDescription);
-
- assertNotNull(delB);
- assertNotNull(moveC);
- assertNotNull(moveD);
- assertNotNull(moveE);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(delB.getRequires().size()));
- assertTrue(delB.getRequires().contains(moveC));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(moveC.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(moveD.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(moveE.getRequires().size()));
- assertTrue(moveE.getRequires().contains(moveD));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(delB.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(moveC.getRequires().size()));
- assertTrue(moveC.getRequires().contains(delB));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(moveD.getRequires().size()));
- assertTrue(moveD.getRequires().contains(moveE));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(moveE.getRequires().size()));
- }
-
- }
-
- private void testCD1(TestKind kind, final Comparison comparison) {
- 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()));
-
- Predicate<? super Diff> deleteADiffDescription = null;
- Predicate<? super Diff> deleteBDiffDescription = null;
- Predicate<? super Diff> deleteCDiffDescription = null;
- Predicate<? super Diff> deleteRefBDiffDescription = null;
- Predicate<? super Diff> deleteRefCDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteADiffDescription = removed("Requirements.A"); //$NON-NLS-1$
- deleteBDiffDescription = removed("Requirements.B"); //$NON-NLS-1$
- deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- } else {
- deleteADiffDescription = added("Requirements.A"); //$NON-NLS-1$
- deleteBDiffDescription = added("Requirements.B"); //$NON-NLS-1$
- deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- }
-
- final Diff deleteADiff = Iterators.find(differences.iterator(), deleteADiffDescription);
- final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
- final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
- final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
- final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
-
- assertNotNull(deleteADiff);
- assertNotNull(deleteBDiff);
- assertNotNull(deleteCDiff);
- assertNotNull(deleteRefBDiff);
- assertNotNull(deleteRefCDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteADiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefBDiff.getRequires().size()));
- assertTrue(deleteRefBDiff.getRequires().contains(deleteBDiff));
- assertTrue(deleteRefBDiff.getRequires().contains(deleteADiff));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteADiff));
- } else {
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteADiff.getRequires().size()));
- assertTrue(deleteADiff.getRequires().contains(deleteRefBDiff));
- assertTrue(deleteADiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteBDiff.getRequires().size()));
- assertTrue(deleteBDiff.getRequires().contains(deleteRefBDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
- assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- }
-
- }
-
- private void testCD2(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 5 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteADiffDescription = null;
- Predicate<? super Diff> deleteCDiffDescription = null;
- Predicate<? super Diff> deleteRefBDiffDescription = null;
- Predicate<? super Diff> deleteRefCDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteADiffDescription = removed("Requirements.A"); //$NON-NLS-1$
- deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- } else {
- deleteADiffDescription = added("Requirements.A"); //$NON-NLS-1$
- deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- }
-
- final Diff deleteADiff = Iterators.find(differences.iterator(), deleteADiffDescription);
- final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
- final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
- final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
-
- assertNotNull(deleteADiff);
- assertNotNull(deleteCDiff);
- assertNotNull(deleteRefBDiff);
- assertNotNull(deleteRefCDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteADiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefBDiff.getRequires().size()));
- assertTrue(deleteRefBDiff.getRequires().contains(deleteADiff));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteADiff));
- } else {
- assertSame(Integer.valueOf(2), Integer.valueOf(deleteADiff.getRequires().size()));
- assertTrue(deleteADiff.getRequires().contains(deleteRefBDiff));
- assertTrue(deleteADiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
- assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- }
-
- }
-
- private void testCD3(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 5 differences
- assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteBDiffDescription = null;
- Predicate<? super Diff> deleteCDiffDescription = null;
- Predicate<? super Diff> deleteRefBDiffDescription = null;
- Predicate<? super Diff> deleteRefCDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteBDiffDescription = removed("Requirements.B"); //$NON-NLS-1$
- deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- } else {
- deleteBDiffDescription = added("Requirements.B"); //$NON-NLS-1$
- deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- }
-
- final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
- final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
- final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
- final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
-
- assertNotNull(deleteBDiff);
- assertNotNull(deleteCDiff);
- assertNotNull(deleteRefBDiff);
- assertNotNull(deleteRefCDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefBDiff.getRequires().size()));
- assertTrue(deleteRefBDiff.getRequires().contains(deleteBDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteBDiff.getRequires().size()));
- assertTrue(deleteBDiff.getRequires().contains(deleteRefBDiff));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
- assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- }
-
- }
-
- private void testCD4(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 5 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteCDiffDescription = null;
- Predicate<? super Diff> deleteRefBDiffDescription = null;
- Predicate<? super Diff> deleteRefCDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- } else {
- deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
- deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.B"); //$NON-NLS-1$
- deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- }
-
- final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
- final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
- final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
-
- assertNotNull(deleteCDiff);
- assertNotNull(deleteRefBDiff);
- assertNotNull(deleteRefCDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
- assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- }
-
- }
-
- private void testCD5(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 2 differences
- assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> deleteCDiffDescription = null;
- Predicate<? super Diff> deleteRefCDiffDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
- deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- } else {
- deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
- deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
- "Requirements.C"); //$NON-NLS-1$
- }
-
- final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
- final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
-
- assertNotNull(deleteCDiff);
- assertNotNull(deleteRefCDiff);
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
- } else {
- assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
- assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.req;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.getOnlyElement;
+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.movedInReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+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.EList;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.req.data.ReqInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ReqComputingTest {
+
+ enum TestKind {
+ ADD, DELETE;
+ }
+
+ private ReqInputData input = new ReqInputData();
+
+ @Test
+ public void testA1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB2(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB3(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA4UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB4(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA5UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB5(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA6UseCase() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB6(TestKind.DELETE, comparison);
+
+ }
+
+ @Test
+ public void testA7UseCase() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB7(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA8UseCase() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB8(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA9UseCase() throws IOException {
+ final Resource left = input.getA9Left();
+ final Resource right = input.getA9Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB9(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA10Left();
+ final Resource right = input.getA10Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB10(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA11Left();
+ final Resource right = input.getA11Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB11(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB2UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB2(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB3(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB4UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB4(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB5UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB5(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB6UseCase() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB6(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testB7UseCase() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB7(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testB8UseCase() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB8(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testB9UseCase() throws IOException {
+ final Resource left = input.getA9Left();
+ final Resource right = input.getA9Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB9(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testB10UseCase() throws IOException {
+ final Resource left = input.getA10Left();
+ final Resource right = input.getA10Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB10(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testB11UseCase() throws IOException {
+ final Resource left = input.getA11Left();
+ final Resource right = input.getA11Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB11(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testC1UseCase() throws IOException {
+ final Resource left = input.getC1Left();
+ final Resource right = input.getC1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testC2UseCase() throws IOException {
+ final Resource left = input.getC2Left();
+ final Resource right = input.getC2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD2(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testC3UseCase() throws IOException {
+ final Resource left = input.getC3Left();
+ final Resource right = input.getC3Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD3(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testC4UseCase() throws IOException {
+ final Resource left = input.getC4Left();
+ final Resource right = input.getC4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD4(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testC5UseCase() throws IOException {
+ final Resource left = input.getC5Left();
+ final Resource right = input.getC5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD5(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testD1UseCase() throws IOException {
+ final Resource left = input.getC1Left();
+ final Resource right = input.getC1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testD2UseCase() throws IOException {
+ final Resource left = input.getC2Left();
+ final Resource right = input.getC2Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD2(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testD3UseCase() throws IOException {
+ final Resource left = input.getC3Left();
+ final Resource right = input.getC3Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD3(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testD4UseCase() throws IOException {
+ final Resource left = input.getC4Left();
+ final Resource right = input.getC4Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD4(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testD5UseCase() throws IOException {
+ final Resource left = input.getC5Left();
+ final Resource right = input.getC5Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(right, left, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD5(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testE1UseCase1() throws IOException {
+ final Resource left = input.getE1Left();
+ final Resource right = input.getE1Right();
+ final Resource ancestor = input.getE1Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE2UseCase() throws IOException {
+ final Resource left = input.getE2Left();
+ final Resource right = input.getE2Right();
+ final Resource ancestor = input.getE2Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB2(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE3UseCase() throws IOException {
+ final Resource left = input.getE3Left();
+ final Resource right = input.getE3Right();
+ final Resource ancestor = input.getE3Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB3(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE4UseCase() throws IOException {
+ final Resource left = input.getE4Left();
+ final Resource right = input.getE4Right();
+ final Resource ancestor = input.getE4Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB4(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE5UseCase() throws IOException {
+ final Resource left = input.getE5Left();
+ final Resource right = input.getE5Right();
+ final Resource ancestor = input.getE5Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB5(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE6UseCase() throws IOException {
+ final Resource left = input.getE6Left();
+ final Resource right = input.getE6Right();
+ final Resource ancestor = input.getE6Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB6(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE7UseCase() throws IOException {
+ final Resource left = input.getE7Left();
+ final Resource right = input.getE7Right();
+ final Resource ancestor = input.getE7Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE8UseCase() throws IOException {
+ final Resource left = input.getE8Left();
+ final Resource right = input.getE8Right();
+ final Resource ancestor = input.getE8Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD2(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE9UseCase() throws IOException {
+ final Resource left = input.getE9Left();
+ final Resource right = input.getE9Right();
+ final Resource ancestor = input.getE9Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD3(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE10UseCase() throws IOException {
+ final Resource left = input.getE10Left();
+ final Resource right = input.getE10Right();
+ final Resource ancestor = input.getE10Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD4(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testE11UseCase() throws IOException {
+ final Resource left = input.getE11Left();
+ final Resource right = input.getE11Right();
+ final Resource ancestor = input.getE11Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD5(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testF1UseCase1() throws IOException {
+ final Resource left = input.getF1Left();
+ final Resource right = input.getF1Right();
+ final Resource ancestor = input.getF1Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF2UseCase() throws IOException {
+ final Resource left = input.getF2Left();
+ final Resource right = input.getF2Right();
+ final Resource ancestor = input.getF2Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB2(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF3UseCase() throws IOException {
+ final Resource left = input.getF3Left();
+ final Resource right = input.getF3Right();
+ final Resource ancestor = input.getF3Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB3(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF4UseCase() throws IOException {
+ final Resource left = input.getF4Left();
+ final Resource right = input.getF4Right();
+ final Resource ancestor = input.getF4Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB4(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF5UseCase() throws IOException {
+ final Resource left = input.getF5Left();
+ final Resource right = input.getF5Right();
+ final Resource ancestor = input.getF5Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB5(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF6UseCase() throws IOException {
+ final Resource left = input.getF6Left();
+ final Resource right = input.getF6Right();
+ final Resource ancestor = input.getF6Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testAB6(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF7UseCase() throws IOException {
+ final Resource left = input.getF7Left();
+ final Resource right = input.getF7Right();
+ final Resource ancestor = input.getF7Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF8UseCase() throws IOException {
+ final Resource left = input.getF8Left();
+ final Resource right = input.getF8Right();
+ final Resource ancestor = input.getF8Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD2(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF9UseCase() throws IOException {
+ final Resource left = input.getF9Left();
+ final Resource right = input.getF9Right();
+ final Resource ancestor = input.getF9Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD3(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF10UseCase() throws IOException {
+ final Resource left = input.getF10Left();
+ final Resource right = input.getF10Right();
+ final Resource ancestor = input.getF10Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD4(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testF11UseCase() throws IOException {
+ final Resource left = input.getF11Left();
+ final Resource right = input.getF11Right();
+ final Resource ancestor = input.getF11Ancestor();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, ancestor);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ testCD5(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testG1UseCase() throws IOException {
+ final Resource left = input.getG1Left();
+ final Resource right = input.getG1Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+ String root = "root";
+ String node1 = root + ".node1";
+ String node2 = node1 + ".node2";
+
+ EList<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+ Diff added1 = getOnlyElement(filter(differences, added(node1)), null);
+ assertNotNull(added1);
+ Diff added2 = getOnlyElement(filter(differences, added(node2)), null);
+ assertNotNull(added2);
+
+ ReferenceChange singleChange = null;
+ for (ReferenceChange change : filter(differences, ReferenceChange.class)) {
+ if ("singleValuedReference".equals(change.getReference().getName())) {
+ singleChange = change;
+ break;
+ }
+ }
+ assertNotNull(singleChange);
+ // Happy compiler
+ assert singleChange != null;
+ assertTrue(singleChange.getValue().eIsProxy());
+ assertSame(Integer.valueOf(0), Integer.valueOf(added1.getRequires().size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(added2.getRequires().size()));
+ assertTrue(added2.getRequires().contains(added1));
+ assertSame(Integer.valueOf(1), Integer.valueOf(singleChange.getRequires().size()));
+ assertTrue(singleChange.getRequires().contains(added2));
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 3 differences
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteSourceDiffDescription = null;
+ Predicate<? super Diff> deleteDestinationDiffDescription = null;
+ Predicate<? super Diff> changedSingleValuedRefDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteSourceDiffDescription = removed("Requirements.containerSource.source"); //$NON-NLS-1$
+
+ deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination"); //$NON-NLS-1$
+
+ changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "singleValuedReference", "Requirements.containerDestination.destination", null); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ deleteSourceDiffDescription = added("Requirements.containerSource.source"); //$NON-NLS-1$
+
+ deleteDestinationDiffDescription = added("Requirements.containerDestination.destination"); //$NON-NLS-1$
+
+ changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "singleValuedReference", null, "Requirements.containerDestination.destination"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ final Diff deleteSourceDiff = Iterators.find(differences.iterator(), deleteSourceDiffDescription);
+
+ final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
+ deleteDestinationDiffDescription);
+
+ final Diff changedSingleValuedRefDiff = Iterators.find(differences.iterator(),
+ changedSingleValuedRefDiffDescription);
+
+ assertNotNull(deleteSourceDiff);
+ assertNotNull(deleteDestinationDiff);
+ assertNotNull(changedSingleValuedRefDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteSourceDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
+ assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteDestinationDiff));
+ assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteSourceDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteSourceDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
+ }
+ }
+
+ private void testAB2(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 3 differences
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteSourceDiffDescription = null;
+ Predicate<? super Diff> deleteDestinationDiffDescription = null;
+ Predicate<? super Diff> deleteMultiValuedRefDiffDescription = null;
+ if (kind.equals(TestKind.DELETE)) {
+ deleteSourceDiffDescription = removed("Requirements.containerSource.source"); //$NON-NLS-1$
+ deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination"); //$NON-NLS-1$
+ deleteMultiValuedRefDiffDescription = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination"); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ deleteSourceDiffDescription = added("Requirements.containerSource.source"); //$NON-NLS-1$
+ deleteDestinationDiffDescription = added("Requirements.containerDestination.destination"); //$NON-NLS-1$
+ deleteMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ final Diff deleteSourceDiff = Iterators.find(differences.iterator(), deleteSourceDiffDescription);
+
+ final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
+ deleteDestinationDiffDescription);
+
+ final Diff deleteMultiValuedRefDiff = Iterators.find(differences.iterator(),
+ deleteMultiValuedRefDiffDescription);
+
+ assertNotNull(deleteSourceDiff);
+ assertNotNull(deleteDestinationDiff);
+ assertNotNull(deleteMultiValuedRefDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteSourceDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteMultiValuedRefDiff.getRequires().size()));
+ assertTrue(deleteMultiValuedRefDiff.getRequires().contains(deleteDestinationDiff));
+ assertTrue(deleteMultiValuedRefDiff.getRequires().contains(deleteSourceDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteSourceDiff.getRequires().size()));
+ assertTrue(deleteSourceDiff.getRequires().contains(deleteMultiValuedRefDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+ assertTrue(deleteDestinationDiff.getRequires().contains(deleteMultiValuedRefDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteMultiValuedRefDiff.getRequires().size()));
+ }
+ }
+
+ private void testAB3(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 2 differences
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteDestinationDiffDescription = null;
+ Predicate<? super Diff> changedSingleValuedRefDiffDescription = null;
+ if (kind.equals(TestKind.DELETE)) {
+ deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "singleValuedReference", "Requirements.containerDestination.destination2", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.destination1"); //$NON-NLS-1$
+ } else {
+ deleteDestinationDiffDescription = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ changedSingleValuedRefDiffDescription = changedReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "singleValuedReference", "Requirements.destination1", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ }
+
+ final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
+ deleteDestinationDiffDescription);
+
+ final Diff changedSingleValuedRefDiff = Iterators.find(differences.iterator(),
+ changedSingleValuedRefDiffDescription);
+
+ assertNotNull(deleteDestinationDiff);
+ assertNotNull(changedSingleValuedRefDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
+ assertTrue(changedSingleValuedRefDiff.getRequires().contains(deleteDestinationDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+ assertTrue(deleteDestinationDiff.getRequires().contains(changedSingleValuedRefDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(changedSingleValuedRefDiff.getRequires().size()));
+ }
+ }
+
+ private void testAB4(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 3 differences
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteDestinationDiffDescription = null;
+ Predicate<? super Diff> deletedMultiValuedRefDiffDescription = null;
+ Predicate<? super Diff> addedMultiValuedRefDiffDescription = null;
+ if (kind.equals(TestKind.DELETE)) {
+ deleteDestinationDiffDescription = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ deletedMultiValuedRefDiffDescription = removedFromReference(
+ "Requirements.containerSource.source", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ addedMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ deleteDestinationDiffDescription = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ deletedMultiValuedRefDiffDescription = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$ //$NON-NLS-2$
+ addedMultiValuedRefDiffDescription = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ final Diff deleteDestinationDiff = Iterators.find(differences.iterator(),
+ deleteDestinationDiffDescription);
+
+ final Diff deletedMultiValuedRefDiff = Iterators.find(differences.iterator(),
+ deletedMultiValuedRefDiffDescription);
+
+ final Diff addedMultiValuedRefDiff = Iterators.find(differences.iterator(),
+ addedMultiValuedRefDiffDescription);
+
+ assertNotNull(deleteDestinationDiff);
+ assertNotNull(deletedMultiValuedRefDiff);
+ assertNotNull(addedMultiValuedRefDiffDescription);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deletedMultiValuedRefDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addedMultiValuedRefDiff.getRequires().size()));
+ assertTrue(deletedMultiValuedRefDiff.getRequires().contains(deleteDestinationDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteDestinationDiff.getRequires().size()));
+ assertTrue(deleteDestinationDiff.getRequires().contains(deletedMultiValuedRefDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deletedMultiValuedRefDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addedMultiValuedRefDiff.getRequires().size()));
+ }
+
+ }
+
+ private void testAB5(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 8 differences
+ assertSame(Integer.valueOf(8), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addDest4Description = null;
+ Predicate<? super Diff> delDest2Description = null;
+ Predicate<? super Diff> delDest3Description = null;
+ Predicate<? super Diff> addRefDest1Description = null;
+ Predicate<? super Diff> addRefDest4Description = null;
+ Predicate<? super Diff> delRefDest2Description = null;
+ Predicate<? super Diff> delRefDest3Description = null;
+ Predicate<? super Diff> delRefDest5Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addDest4Description = added("Requirements.destination4"); //$NON-NLS-1$
+ delDest2Description = removed("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ delDest3Description = removed("Requirements.containerDestination.destination3"); //$NON-NLS-1$
+
+ addRefDest1Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$ //$NON-NLS-2$
+ addRefDest4Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination4"); //$NON-NLS-1$//$NON-NLS-2$
+ delRefDest2Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$ //$NON-NLS-2$
+ delRefDest3Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination3"); //$NON-NLS-1$ //$NON-NLS-2$
+ delRefDest5Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination5"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ addDest4Description = removed("Requirements.destination4"); //$NON-NLS-1$
+ delDest2Description = added("Requirements.containerDestination.destination2"); //$NON-NLS-1$
+ delDest3Description = added("Requirements.containerDestination.destination3"); //$NON-NLS-1$
+
+ addRefDest1Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination1"); //$NON-NLS-1$//$NON-NLS-2$
+ addRefDest4Description = removedFromReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination4"); //$NON-NLS-1$//$NON-NLS-2$
+ delRefDest2Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination2"); //$NON-NLS-1$//$NON-NLS-2$
+ delRefDest3Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.containerDestination.destination3"); //$NON-NLS-1$ //$NON-NLS-2$
+ delRefDest5Description = addedToReference("Requirements.containerSource.source", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination5"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ final Diff addDest4 = Iterators.find(differences.iterator(), addDest4Description);
+ final Diff delDest2 = Iterators.find(differences.iterator(), delDest2Description);
+ final Diff delDest3 = Iterators.find(differences.iterator(), delDest3Description);
+
+ final Diff addRefDest1 = Iterators.find(differences.iterator(), addRefDest1Description);
+ final Diff addRefDest4 = Iterators.find(differences.iterator(), addRefDest4Description);
+ final Diff delRefDest2 = Iterators.find(differences.iterator(), delRefDest2Description);
+ final Diff delRefDest3 = Iterators.find(differences.iterator(), delRefDest3Description);
+ final Diff delRefDest5 = Iterators.find(differences.iterator(), delRefDest5Description);
+
+ assertNotNull(addDest4);
+ assertNotNull(delDest2);
+ assertNotNull(delDest3);
+ assertNotNull(addRefDest1);
+ assertNotNull(addRefDest4);
+ assertNotNull(delRefDest2);
+ assertNotNull(delRefDest3);
+ assertNotNull(delRefDest5);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addDest4.getRequires().size()));
+ assertTrue(addDest4.getRequires().contains(addRefDest4));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delDest2.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delDest3.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest1.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest4.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delRefDest2.getRequires().size()));
+ assertTrue(delRefDest2.getRequires().contains(delDest2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delRefDest3.getRequires().size()));
+ assertTrue(delRefDest3.getRequires().contains(delDest3));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest5.getRequires().size()));
+
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addDest4.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delDest2.getRequires().size()));
+ assertTrue(delDest2.getRequires().contains(delRefDest2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delDest3.getRequires().size()));
+ assertTrue(delDest3.getRequires().contains(delRefDest3));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDest1.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefDest4.getRequires().size()));
+ assertTrue(addRefDest4.getRequires().contains(addDest4));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest2.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest3.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefDest5.getRequires().size()));
+ }
+
+ }
+
+ private void testAB6(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 7 differences
+ assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> delDestDescription = null;
+ Predicate<? super Diff> delContainerDescription = null;
+ Predicate<? super Diff> delSubContainerDescription = null;
+ Predicate<? super Diff> delSource1Description = null;
+ Predicate<? super Diff> delSource2Description = null;
+ Predicate<? super Diff> delRefSource1Description = null;
+ Predicate<? super Diff> delRefSource2Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ delDestDescription = removed("Requirements.destination"); //$NON-NLS-1$
+ delContainerDescription = removed("Requirements.container"); //$NON-NLS-1$
+ delSubContainerDescription = removed("Requirements.container.subContainer"); //$NON-NLS-1$
+ delSource1Description = removed("Requirements.container.subContainer.source1"); //$NON-NLS-1$
+ delSource2Description = removed("Requirements.container.subContainer.source2"); //$NON-NLS-1$
+
+ delRefSource1Description = changedReference("Requirements.container.subContainer.source1", //$NON-NLS-1$
+ "singleValuedReference", "Requirements.destination", null); //$NON-NLS-1$//$NON-NLS-2$
+ delRefSource2Description = removedFromReference("Requirements.container.subContainer.source2", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ delDestDescription = added("Requirements.destination"); //$NON-NLS-1$
+ delContainerDescription = added("Requirements.container"); //$NON-NLS-1$
+ delSubContainerDescription = added("Requirements.container.subContainer"); //$NON-NLS-1$
+ delSource1Description = added("Requirements.container.subContainer.source1"); //$NON-NLS-1$
+ delSource2Description = added("Requirements.container.subContainer.source2"); //$NON-NLS-1$
+
+ delRefSource1Description = changedReference("Requirements.container.subContainer.source1", //$NON-NLS-1$
+ "singleValuedReference", null, "Requirements.destination"); //$NON-NLS-1$ //$NON-NLS-2$
+ delRefSource2Description = addedToReference("Requirements.container.subContainer.source2", //$NON-NLS-1$
+ "multiValuedReference", "Requirements.destination"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ final Diff delDest = Iterators.find(differences.iterator(), delDestDescription);
+ final Diff delContainer = Iterators.find(differences.iterator(), delContainerDescription);
+ final Diff delSubContainer = Iterators.find(differences.iterator(), delSubContainerDescription);
+ final Diff delSource1 = Iterators.find(differences.iterator(), delSource1Description);
+ final Diff delSource2 = Iterators.find(differences.iterator(), delSource2Description);
+ final Diff delRefSource1 = Iterators.find(differences.iterator(), delRefSource1Description);
+ final Diff delRefSource2 = Iterators.find(differences.iterator(), delRefSource2Description);
+
+ assertNotNull(delDest);
+ assertNotNull(delContainer);
+ assertNotNull(delSubContainer);
+ assertNotNull(delSource1);
+ assertNotNull(delSource2);
+ assertNotNull(delRefSource1);
+ assertNotNull(delRefSource2);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(delDest.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delContainer.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delSubContainer.getRequires().size()));
+ assertTrue(delSubContainer.getRequires().contains(delContainer));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delSource1.getRequires().size()));
+ assertTrue(delSource1.getRequires().contains(delSubContainer));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delSource2.getRequires().size()));
+ assertTrue(delSource2.getRequires().contains(delSubContainer));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(delRefSource1.getRequires().size()));
+ assertTrue(delRefSource1.getRequires().contains(delSource1));
+ assertTrue(delRefSource2.getRequires().contains(delSource2));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(delRefSource2.getRequires().size()));
+ assertTrue(delRefSource1.getRequires().contains(delDest));
+ assertTrue(delRefSource2.getRequires().contains(delDest));
+ } else {
+ assertSame(Integer.valueOf(2), Integer.valueOf(delDest.getRequires().size()));
+ assertTrue(delDest.getRequires().contains(delRefSource1));
+ assertTrue(delDest.getRequires().contains(delRefSource2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delContainer.getRequires().size()));
+ assertTrue(delContainer.getRequires().contains(delSubContainer));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(delSubContainer.getRequires().size()));
+ assertTrue(delSubContainer.getRequires().contains(delSource1));
+ assertTrue(delSubContainer.getRequires().contains(delSource2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delSource1.getRequires().size()));
+ assertTrue(delSource1.getRequires().contains(delRefSource1));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delSource2.getRequires().size()));
+ assertTrue(delSource2.getRequires().contains(delRefSource2));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefSource1.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefSource2.getRequires().size()));
+ }
+
+ }
+
+ private void testAB7(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addBDescription = null;
+ Predicate<? super Diff> delCDescription = null;
+ Predicate<? super Diff> addEDescription = null;
+ Predicate<? super Diff> delFDescription = null;
+
+ if (kind.equals(TestKind.ADD)) {
+ addBDescription = added("Requirements.A.B"); //$NON-NLS-1$
+ delCDescription = removed("Requirements.A.C"); //$NON-NLS-1$
+ addEDescription = added("Requirements.D.E"); //$NON-NLS-1$
+ delFDescription = removed("Requirements.D.F"); //$NON-NLS-1$
+ } else {
+ addBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
+ delCDescription = added("Requirements.A.C"); //$NON-NLS-1$
+ addEDescription = removed("Requirements.D.E"); //$NON-NLS-1$
+ delFDescription = added("Requirements.D.F"); //$NON-NLS-1$
+ }
+
+ final Diff addB = Iterators.find(differences.iterator(), addBDescription);
+ final Diff delC = Iterators.find(differences.iterator(), delCDescription);
+ final Diff addE = Iterators.find(differences.iterator(), addEDescription);
+ final Diff delF = Iterators.find(differences.iterator(), delFDescription);
+
+ assertNotNull(addB);
+ assertNotNull(delC);
+ assertNotNull(addE);
+ assertNotNull(delF);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
+ assertTrue(addB.getRequires().contains(delC));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delC.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delC.getRequires().size()));
+ assertTrue(delC.getRequires().contains(addB));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
+ }
+
+ }
+
+ private void testAB8(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 7 differences
+ assertSame(Integer.valueOf(7), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addBDescription = null;
+ Predicate<? super Diff> delCDescription = null;
+ Predicate<? super Diff> changeRefBDescription = null;
+ Predicate<? super Diff> addEDescription = null;
+ Predicate<? super Diff> delFDescription = null;
+ Predicate<? super Diff> addRefEDescription = null;
+ Predicate<? super Diff> delRefFDescription = null;
+
+ if (kind.equals(TestKind.ADD)) {
+ addBDescription = added("Requirements.B"); //$NON-NLS-1$
+ delCDescription = removed("Requirements.C"); //$NON-NLS-1$
+ changeRefBDescription = changedReference(
+ "Requirements.A", "singleValuedReference", "Requirements.C", "Requirements.B"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addEDescription = added("Requirements.E"); //$NON-NLS-1$
+ delFDescription = removed("Requirements.F"); //$NON-NLS-1$
+ addRefEDescription = addedToReference("Requirements.D", "multiValuedReference", "Requirements.E"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ delRefFDescription = removedFromReference(
+ "Requirements.D", "multiValuedReference", "Requirements.F"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ addBDescription = removed("Requirements.B"); //$NON-NLS-1$
+ delCDescription = added("Requirements.C"); //$NON-NLS-1$
+ changeRefBDescription = changedReference(
+ "Requirements.A", "singleValuedReference", "Requirements.B", "Requirements.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ addEDescription = removed("Requirements.E"); //$NON-NLS-1$
+ delFDescription = added("Requirements.F"); //$NON-NLS-1$
+ addRefEDescription = removedFromReference(
+ "Requirements.D", "multiValuedReference", "Requirements.E"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ delRefFDescription = addedToReference("Requirements.D", "multiValuedReference", "Requirements.F"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ final Diff addB = Iterators.find(differences.iterator(), addBDescription);
+ final Diff delC = Iterators.find(differences.iterator(), delCDescription);
+ final Diff changeRefB = Iterators.find(differences.iterator(), changeRefBDescription);
+ final Diff addE = Iterators.find(differences.iterator(), addEDescription);
+ final Diff delF = Iterators.find(differences.iterator(), delFDescription);
+ final Diff addRefE = Iterators.find(differences.iterator(), addRefEDescription);
+ final Diff delRefF = Iterators.find(differences.iterator(), delRefFDescription);
+
+ assertNotNull(addB);
+ assertNotNull(delC);
+ assertNotNull(changeRefB);
+ assertNotNull(addE);
+ assertNotNull(delF);
+ assertNotNull(addRefE);
+ assertNotNull(delRefF);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delC.getRequires().size()));
+ assertTrue(delC.getRequires().contains(changeRefB));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
+ assertTrue(changeRefB.getRequires().contains(addB));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addE.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delF.getRequires().size()));
+ assertTrue(delF.getRequires().contains(delRefF));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefE.getRequires().size()));
+ assertTrue(addRefE.getRequires().contains(addE));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delRefF.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
+ assertTrue(addB.getRequires().contains(changeRefB));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delC.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
+ assertTrue(changeRefB.getRequires().contains(delC));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addE.getRequires().size()));
+ assertTrue(addE.getRequires().contains(addRefE));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(delF.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefE.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(delRefF.getRequires().size()));
+ assertTrue(delRefF.getRequires().contains(delF));
+ }
+
+ }
+
+ private void testAB9(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 2 differences
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addBDescription = null;
+ Predicate<? super Diff> addCDescription = null;
+
+ if (kind.equals(TestKind.ADD)) {
+ addBDescription = added("Requirements.A.B"); //$NON-NLS-1$
+ addCDescription = added("Requirements.A.B.C"); //$NON-NLS-1$
+ } else {
+ addBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
+ addCDescription = removed("Requirements.A.B.C"); //$NON-NLS-1$
+ }
+
+ final Diff addB = Iterators.find(differences.iterator(), addBDescription);
+ final Diff addC = Iterators.find(differences.iterator(), addCDescription);
+
+ assertNotNull(addB);
+ assertNotNull(addC);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addB.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addC.getRequires().size()));
+ assertTrue(addC.getRequires().contains(addB));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addB.getRequires().size()));
+ assertTrue(addB.getRequires().contains(addC));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addC.getRequires().size()));
+ }
+
+ }
+
+ private void testAB10(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addADescription = null;
+ Predicate<? super Diff> addCDescription = null;
+ Predicate<? super Diff> changeRefBDescription = null;
+ Predicate<? super Diff> addRefBDescription = null;
+
+ if (kind.equals(TestKind.ADD)) {
+ addADescription = added("Requirements.A"); //$NON-NLS-1$
+ addCDescription = added("Requirements.C"); //$NON-NLS-1$
+ changeRefBDescription = changedReference("Requirements.A", "singleValuedReference", null,
+ "Requirements.B");
+ addRefBDescription = addedToReference("Requirements.C", "multiValuedReference", "Requirements.B");
+ } else {
+ addADescription = removed("Requirements.A"); //$NON-NLS-1$
+ addCDescription = removed("Requirements.C"); //$NON-NLS-1$
+ changeRefBDescription = changedReference("Requirements.A", "singleValuedReference",
+ "Requirements.B", null);
+ addRefBDescription = removedFromReference("Requirements.C", "multiValuedReference",
+ "Requirements.B");
+ }
+
+ final Diff addA = Iterators.find(differences.iterator(), addADescription);
+ final Diff addC = Iterators.find(differences.iterator(), addCDescription);
+ final Diff changeRefB = Iterators.find(differences.iterator(), changeRefBDescription);
+ final Diff addRefB = Iterators.find(differences.iterator(), addRefBDescription);
+
+ assertNotNull(addA);
+ assertNotNull(addC);
+ assertNotNull(changeRefB);
+ assertNotNull(addRefB);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addA.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addC.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeRefB.getRequires().size()));
+ assertTrue(changeRefB.getRequires().contains(addA));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefB.getRequires().size()));
+ assertTrue(addRefB.getRequires().contains(addC));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addA.getRequires().size()));
+ assertTrue(addA.getRequires().contains(changeRefB));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addC.getRequires().size()));
+ assertTrue(addC.getRequires().contains(addRefB));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(changeRefB.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefB.getRequires().size()));
+ }
+
+ }
+
+ private void testAB11(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> delBDescription = null;
+ Predicate<? super Diff> moveCDescription = null;
+ Predicate<? super Diff> moveDDescription = null;
+ Predicate<? super Diff> moveEDescription = null;
+
+ if (kind.equals(TestKind.ADD)) {
+ delBDescription = removed("Requirements.A.B"); //$NON-NLS-1$
+ moveCDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ moveDDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.D"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ moveEDescription = movedInReference("Requirements.A.D", "containmentRef1", "Requirements.A.D.E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ delBDescription = added("Requirements.A.B"); //$NON-NLS-1$
+ moveCDescription = movedInReference("Requirements.A.B", "containmentRef1", "Requirements.A.B.C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ moveDDescription = movedInReference("Requirements.A.E", "containmentRef1", "Requirements.A.E.D"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ moveEDescription = movedInReference("Requirements.A", "containmentRef1", "Requirements.A.E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ final Diff delB = Iterators.find(differences.iterator(), delBDescription);
+ final Diff moveC = Iterators.find(differences.iterator(), moveCDescription);
+ final Diff moveD = Iterators.find(differences.iterator(), moveDDescription);
+ final Diff moveE = Iterators.find(differences.iterator(), moveEDescription);
+
+ assertNotNull(delB);
+ assertNotNull(moveC);
+ assertNotNull(moveD);
+ assertNotNull(moveE);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(delB.getRequires().size()));
+ assertTrue(delB.getRequires().contains(moveC));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(moveC.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(moveD.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(moveE.getRequires().size()));
+ assertTrue(moveE.getRequires().contains(moveD));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(delB.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(moveC.getRequires().size()));
+ assertTrue(moveC.getRequires().contains(delB));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(moveD.getRequires().size()));
+ assertTrue(moveD.getRequires().contains(moveE));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(moveE.getRequires().size()));
+ }
+
+ }
+
+ private void testCD1(TestKind kind, final Comparison comparison) {
+ 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()));
+
+ Predicate<? super Diff> deleteADiffDescription = null;
+ Predicate<? super Diff> deleteBDiffDescription = null;
+ Predicate<? super Diff> deleteCDiffDescription = null;
+ Predicate<? super Diff> deleteRefBDiffDescription = null;
+ Predicate<? super Diff> deleteRefCDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteADiffDescription = removed("Requirements.A"); //$NON-NLS-1$
+ deleteBDiffDescription = removed("Requirements.B"); //$NON-NLS-1$
+ deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ } else {
+ deleteADiffDescription = added("Requirements.A"); //$NON-NLS-1$
+ deleteBDiffDescription = added("Requirements.B"); //$NON-NLS-1$
+ deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ }
+
+ final Diff deleteADiff = Iterators.find(differences.iterator(), deleteADiffDescription);
+ final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
+ final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
+ final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
+ final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
+
+ assertNotNull(deleteADiff);
+ assertNotNull(deleteBDiff);
+ assertNotNull(deleteCDiff);
+ assertNotNull(deleteRefBDiff);
+ assertNotNull(deleteRefCDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteADiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+ assertTrue(deleteRefBDiff.getRequires().contains(deleteBDiff));
+ assertTrue(deleteRefBDiff.getRequires().contains(deleteADiff));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteADiff));
+ } else {
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteADiff.getRequires().size()));
+ assertTrue(deleteADiff.getRequires().contains(deleteRefBDiff));
+ assertTrue(deleteADiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteBDiff.getRequires().size()));
+ assertTrue(deleteBDiff.getRequires().contains(deleteRefBDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
+ assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ }
+
+ }
+
+ private void testCD2(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 5 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteADiffDescription = null;
+ Predicate<? super Diff> deleteCDiffDescription = null;
+ Predicate<? super Diff> deleteRefBDiffDescription = null;
+ Predicate<? super Diff> deleteRefCDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteADiffDescription = removed("Requirements.A"); //$NON-NLS-1$
+ deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ } else {
+ deleteADiffDescription = added("Requirements.A"); //$NON-NLS-1$
+ deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ }
+
+ final Diff deleteADiff = Iterators.find(differences.iterator(), deleteADiffDescription);
+ final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
+ final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
+ final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
+
+ assertNotNull(deleteADiff);
+ assertNotNull(deleteCDiff);
+ assertNotNull(deleteRefBDiff);
+ assertNotNull(deleteRefCDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteADiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+ assertTrue(deleteRefBDiff.getRequires().contains(deleteADiff));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteADiff));
+ } else {
+ assertSame(Integer.valueOf(2), Integer.valueOf(deleteADiff.getRequires().size()));
+ assertTrue(deleteADiff.getRequires().contains(deleteRefBDiff));
+ assertTrue(deleteADiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
+ assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ }
+
+ }
+
+ private void testCD3(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 5 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteBDiffDescription = null;
+ Predicate<? super Diff> deleteCDiffDescription = null;
+ Predicate<? super Diff> deleteRefBDiffDescription = null;
+ Predicate<? super Diff> deleteRefCDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteBDiffDescription = removed("Requirements.B"); //$NON-NLS-1$
+ deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ } else {
+ deleteBDiffDescription = added("Requirements.B"); //$NON-NLS-1$
+ deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ }
+
+ final Diff deleteBDiff = Iterators.find(differences.iterator(), deleteBDiffDescription);
+ final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
+ final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
+ final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
+
+ assertNotNull(deleteBDiff);
+ assertNotNull(deleteCDiff);
+ assertNotNull(deleteRefBDiff);
+ assertNotNull(deleteRefCDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+ assertTrue(deleteRefBDiff.getRequires().contains(deleteBDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteBDiff.getRequires().size()));
+ assertTrue(deleteBDiff.getRequires().contains(deleteRefBDiff));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
+ assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ }
+
+ }
+
+ private void testCD4(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 5 differences
+ assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteCDiffDescription = null;
+ Predicate<? super Diff> deleteRefBDiffDescription = null;
+ Predicate<? super Diff> deleteRefCDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$ //$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ } else {
+ deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
+ deleteRefBDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.B"); //$NON-NLS-1$
+ deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ }
+
+ final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
+ final Diff deleteRefBDiff = Iterators.find(differences.iterator(), deleteRefBDiffDescription);
+ final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
+
+ assertNotNull(deleteCDiff);
+ assertNotNull(deleteRefBDiff);
+ assertNotNull(deleteRefCDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
+ assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefBDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ }
+
+ }
+
+ private void testCD5(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 2 differences
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> deleteCDiffDescription = null;
+ Predicate<? super Diff> deleteRefCDiffDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ deleteCDiffDescription = removed("Requirements.C"); //$NON-NLS-1$
+ deleteRefCDiffDescription = removedFromReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ } else {
+ deleteCDiffDescription = added("Requirements.C"); //$NON-NLS-1$
+ deleteRefCDiffDescription = addedToReference("Requirements.A", "multiValuedReference", //$NON-NLS-1$//$NON-NLS-2$
+ "Requirements.C"); //$NON-NLS-1$
+ }
+
+ final Diff deleteCDiff = Iterators.find(differences.iterator(), deleteCDiffDescription);
+ final Diff deleteRefCDiff = Iterators.find(differences.iterator(), deleteRefCDiffDescription);
+
+ assertNotNull(deleteCDiff);
+ assertNotNull(deleteRefCDiff);
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteCDiff.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ assertTrue(deleteRefCDiff.getRequires().contains(deleteCDiff));
+ } else {
+ assertSame(Integer.valueOf(1), Integer.valueOf(deleteCDiff.getRequires().size()));
+ assertTrue(deleteCDiff.getRequires().contains(deleteRefCDiff));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(deleteRefCDiff.getRequires().size()));
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/data/ReqInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/data/ReqInputData.java
index 63a399703..eff074820 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/data/ReqInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/req/data/ReqInputData.java
@@ -1,418 +1,418 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.req.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class ReqInputData extends AbstractInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA2Left() throws IOException {
- return loadFromClassLoader("a2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA2Right() throws IOException {
- return loadFromClassLoader("a2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA3Left() throws IOException {
- return loadFromClassLoader("a3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA3Right() throws IOException {
- return loadFromClassLoader("a3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA4Left() throws IOException {
- return loadFromClassLoader("a4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA4Right() throws IOException {
- return loadFromClassLoader("a4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA5Left() throws IOException {
- return loadFromClassLoader("a5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA5Right() throws IOException {
- return loadFromClassLoader("a5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA6Left() throws IOException {
- return loadFromClassLoader("a6/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA6Right() throws IOException {
- return loadFromClassLoader("a6/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA7Left() throws IOException {
- return loadFromClassLoader("a7/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA7Right() throws IOException {
- return loadFromClassLoader("a7/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA8Left() throws IOException {
- return loadFromClassLoader("a8/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA8Right() throws IOException {
- return loadFromClassLoader("a8/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA9Left() throws IOException {
- return loadFromClassLoader("a9/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA9Right() throws IOException {
- return loadFromClassLoader("a9/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA10Left() throws IOException {
- return loadFromClassLoader("a10/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA10Right() throws IOException {
- return loadFromClassLoader("a10/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA11Left() throws IOException {
- return loadFromClassLoader("a11/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getA11Right() throws IOException {
- return loadFromClassLoader("a11/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC1Left() throws IOException {
- return loadFromClassLoader("c1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC1Right() throws IOException {
- return loadFromClassLoader("c1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC2Left() throws IOException {
- return loadFromClassLoader("c2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC2Right() throws IOException {
- return loadFromClassLoader("c2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC3Left() throws IOException {
- return loadFromClassLoader("c3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC3Right() throws IOException {
- return loadFromClassLoader("c3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC4Left() throws IOException {
- return loadFromClassLoader("c4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC4Right() throws IOException {
- return loadFromClassLoader("c4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC5Left() throws IOException {
- return loadFromClassLoader("c5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getC5Right() throws IOException {
- return loadFromClassLoader("c5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Left() throws IOException {
- return loadFromClassLoader("e1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Right() throws IOException {
- return loadFromClassLoader("e1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE1Ancestor() throws IOException {
- return loadFromClassLoader("e1/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Left() throws IOException {
- return loadFromClassLoader("e2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Right() throws IOException {
- return loadFromClassLoader("e2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE2Ancestor() throws IOException {
- return loadFromClassLoader("e2/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Left() throws IOException {
- return loadFromClassLoader("e3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Right() throws IOException {
- return loadFromClassLoader("e3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE3Ancestor() throws IOException {
- return loadFromClassLoader("e3/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Left() throws IOException {
- return loadFromClassLoader("e4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Right() throws IOException {
- return loadFromClassLoader("e4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE4Ancestor() throws IOException {
- return loadFromClassLoader("e4/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Left() throws IOException {
- return loadFromClassLoader("e5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Right() throws IOException {
- return loadFromClassLoader("e5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE5Ancestor() throws IOException {
- return loadFromClassLoader("e5/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Left() throws IOException {
- return loadFromClassLoader("e6/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Right() throws IOException {
- return loadFromClassLoader("e6/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE6Ancestor() throws IOException {
- return loadFromClassLoader("e6/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Left() throws IOException {
- return loadFromClassLoader("e7/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Right() throws IOException {
- return loadFromClassLoader("e7/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE7Ancestor() throws IOException {
- return loadFromClassLoader("e7/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Left() throws IOException {
- return loadFromClassLoader("e8/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Right() throws IOException {
- return loadFromClassLoader("e8/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE8Ancestor() throws IOException {
- return loadFromClassLoader("e8/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Left() throws IOException {
- return loadFromClassLoader("e9/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Right() throws IOException {
- return loadFromClassLoader("e9/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE9Ancestor() throws IOException {
- return loadFromClassLoader("e9/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Left() throws IOException {
- return loadFromClassLoader("e10/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Right() throws IOException {
- return loadFromClassLoader("e10/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE10Ancestor() throws IOException {
- return loadFromClassLoader("e10/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE11Left() throws IOException {
- return loadFromClassLoader("e11/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE11Right() throws IOException {
- return loadFromClassLoader("e11/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getE11Ancestor() throws IOException {
- return loadFromClassLoader("e11/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Left() throws IOException {
- return loadFromClassLoader("f1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Right() throws IOException {
- return loadFromClassLoader("f1/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF1Ancestor() throws IOException {
- return loadFromClassLoader("f1/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Left() throws IOException {
- return loadFromClassLoader("f2/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Right() throws IOException {
- return loadFromClassLoader("f2/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF2Ancestor() throws IOException {
- return loadFromClassLoader("f2/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Left() throws IOException {
- return loadFromClassLoader("f3/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Right() throws IOException {
- return loadFromClassLoader("f3/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF3Ancestor() throws IOException {
- return loadFromClassLoader("f3/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Left() throws IOException {
- return loadFromClassLoader("f4/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Right() throws IOException {
- return loadFromClassLoader("f4/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF4Ancestor() throws IOException {
- return loadFromClassLoader("f4/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Left() throws IOException {
- return loadFromClassLoader("f5/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Right() throws IOException {
- return loadFromClassLoader("f5/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF5Ancestor() throws IOException {
- return loadFromClassLoader("f5/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Left() throws IOException {
- return loadFromClassLoader("f6/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Right() throws IOException {
- return loadFromClassLoader("f6/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF6Ancestor() throws IOException {
- return loadFromClassLoader("f6/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Left() throws IOException {
- return loadFromClassLoader("f7/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Right() throws IOException {
- return loadFromClassLoader("f7/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF7Ancestor() throws IOException {
- return loadFromClassLoader("f7/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Left() throws IOException {
- return loadFromClassLoader("f8/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Right() throws IOException {
- return loadFromClassLoader("f8/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF8Ancestor() throws IOException {
- return loadFromClassLoader("f8/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Left() throws IOException {
- return loadFromClassLoader("f9/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Right() throws IOException {
- return loadFromClassLoader("f9/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF9Ancestor() throws IOException {
- return loadFromClassLoader("f9/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Left() throws IOException {
- return loadFromClassLoader("f10/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Right() throws IOException {
- return loadFromClassLoader("f10/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF10Ancestor() throws IOException {
- return loadFromClassLoader("f10/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF11Left() throws IOException {
- return loadFromClassLoader("f11/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF11Right() throws IOException {
- return loadFromClassLoader("f11/right.nodes"); //$NON-NLS-1$
- }
-
- public Resource getF11Ancestor() throws IOException {
- return loadFromClassLoader("f11/ancestor.nodes"); //$NON-NLS-1$
- }
-
- public Resource getG1Left() throws IOException {
- return loadFromClassLoader("g1/left.nodes"); //$NON-NLS-1$
- }
-
- public Resource getG1Right() throws IOException {
- return loadFromClassLoader("g1/right.nodes"); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.req.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class ReqInputData extends AbstractInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Left() throws IOException {
+ return loadFromClassLoader("a3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Right() throws IOException {
+ return loadFromClassLoader("a3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Left() throws IOException {
+ return loadFromClassLoader("a4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Right() throws IOException {
+ return loadFromClassLoader("a4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Left() throws IOException {
+ return loadFromClassLoader("a5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Right() throws IOException {
+ return loadFromClassLoader("a5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA6Left() throws IOException {
+ return loadFromClassLoader("a6/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA6Right() throws IOException {
+ return loadFromClassLoader("a6/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA7Left() throws IOException {
+ return loadFromClassLoader("a7/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA7Right() throws IOException {
+ return loadFromClassLoader("a7/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA8Left() throws IOException {
+ return loadFromClassLoader("a8/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA8Right() throws IOException {
+ return loadFromClassLoader("a8/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA9Left() throws IOException {
+ return loadFromClassLoader("a9/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA9Right() throws IOException {
+ return loadFromClassLoader("a9/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA10Left() throws IOException {
+ return loadFromClassLoader("a10/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA10Right() throws IOException {
+ return loadFromClassLoader("a10/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA11Left() throws IOException {
+ return loadFromClassLoader("a11/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getA11Right() throws IOException {
+ return loadFromClassLoader("a11/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC1Left() throws IOException {
+ return loadFromClassLoader("c1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC1Right() throws IOException {
+ return loadFromClassLoader("c1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC2Left() throws IOException {
+ return loadFromClassLoader("c2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC2Right() throws IOException {
+ return loadFromClassLoader("c2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC3Left() throws IOException {
+ return loadFromClassLoader("c3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC3Right() throws IOException {
+ return loadFromClassLoader("c3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC4Left() throws IOException {
+ return loadFromClassLoader("c4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC4Right() throws IOException {
+ return loadFromClassLoader("c4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC5Left() throws IOException {
+ return loadFromClassLoader("c5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getC5Right() throws IOException {
+ return loadFromClassLoader("c5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Left() throws IOException {
+ return loadFromClassLoader("e1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Right() throws IOException {
+ return loadFromClassLoader("e1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE1Ancestor() throws IOException {
+ return loadFromClassLoader("e1/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Left() throws IOException {
+ return loadFromClassLoader("e2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Right() throws IOException {
+ return loadFromClassLoader("e2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE2Ancestor() throws IOException {
+ return loadFromClassLoader("e2/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Left() throws IOException {
+ return loadFromClassLoader("e3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Right() throws IOException {
+ return loadFromClassLoader("e3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE3Ancestor() throws IOException {
+ return loadFromClassLoader("e3/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Left() throws IOException {
+ return loadFromClassLoader("e4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Right() throws IOException {
+ return loadFromClassLoader("e4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE4Ancestor() throws IOException {
+ return loadFromClassLoader("e4/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Left() throws IOException {
+ return loadFromClassLoader("e5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Right() throws IOException {
+ return loadFromClassLoader("e5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE5Ancestor() throws IOException {
+ return loadFromClassLoader("e5/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Left() throws IOException {
+ return loadFromClassLoader("e6/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Right() throws IOException {
+ return loadFromClassLoader("e6/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE6Ancestor() throws IOException {
+ return loadFromClassLoader("e6/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Left() throws IOException {
+ return loadFromClassLoader("e7/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Right() throws IOException {
+ return loadFromClassLoader("e7/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE7Ancestor() throws IOException {
+ return loadFromClassLoader("e7/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Left() throws IOException {
+ return loadFromClassLoader("e8/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Right() throws IOException {
+ return loadFromClassLoader("e8/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE8Ancestor() throws IOException {
+ return loadFromClassLoader("e8/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Left() throws IOException {
+ return loadFromClassLoader("e9/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Right() throws IOException {
+ return loadFromClassLoader("e9/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE9Ancestor() throws IOException {
+ return loadFromClassLoader("e9/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Left() throws IOException {
+ return loadFromClassLoader("e10/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Right() throws IOException {
+ return loadFromClassLoader("e10/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE10Ancestor() throws IOException {
+ return loadFromClassLoader("e10/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE11Left() throws IOException {
+ return loadFromClassLoader("e11/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE11Right() throws IOException {
+ return loadFromClassLoader("e11/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getE11Ancestor() throws IOException {
+ return loadFromClassLoader("e11/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Left() throws IOException {
+ return loadFromClassLoader("f1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Right() throws IOException {
+ return loadFromClassLoader("f1/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF1Ancestor() throws IOException {
+ return loadFromClassLoader("f1/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Left() throws IOException {
+ return loadFromClassLoader("f2/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Right() throws IOException {
+ return loadFromClassLoader("f2/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF2Ancestor() throws IOException {
+ return loadFromClassLoader("f2/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Left() throws IOException {
+ return loadFromClassLoader("f3/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Right() throws IOException {
+ return loadFromClassLoader("f3/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF3Ancestor() throws IOException {
+ return loadFromClassLoader("f3/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Left() throws IOException {
+ return loadFromClassLoader("f4/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Right() throws IOException {
+ return loadFromClassLoader("f4/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF4Ancestor() throws IOException {
+ return loadFromClassLoader("f4/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Left() throws IOException {
+ return loadFromClassLoader("f5/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Right() throws IOException {
+ return loadFromClassLoader("f5/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF5Ancestor() throws IOException {
+ return loadFromClassLoader("f5/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Left() throws IOException {
+ return loadFromClassLoader("f6/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Right() throws IOException {
+ return loadFromClassLoader("f6/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF6Ancestor() throws IOException {
+ return loadFromClassLoader("f6/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Left() throws IOException {
+ return loadFromClassLoader("f7/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Right() throws IOException {
+ return loadFromClassLoader("f7/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF7Ancestor() throws IOException {
+ return loadFromClassLoader("f7/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Left() throws IOException {
+ return loadFromClassLoader("f8/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Right() throws IOException {
+ return loadFromClassLoader("f8/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF8Ancestor() throws IOException {
+ return loadFromClassLoader("f8/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Left() throws IOException {
+ return loadFromClassLoader("f9/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Right() throws IOException {
+ return loadFromClassLoader("f9/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF9Ancestor() throws IOException {
+ return loadFromClassLoader("f9/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Left() throws IOException {
+ return loadFromClassLoader("f10/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Right() throws IOException {
+ return loadFromClassLoader("f10/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF10Ancestor() throws IOException {
+ return loadFromClassLoader("f10/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF11Left() throws IOException {
+ return loadFromClassLoader("f11/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF11Right() throws IOException {
+ return loadFromClassLoader("f11/right.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getF11Ancestor() throws IOException {
+ return loadFromClassLoader("f11/ancestor.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getG1Left() throws IOException {
+ return loadFromClassLoader("g1/left.nodes"); //$NON-NLS-1$
+ }
+
+ public Resource getG1Right() throws IOException {
+ return loadFromClassLoader("g1/right.nodes"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/scope/DefaultComparisonScopeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/scope/DefaultComparisonScopeTest.java
index 2cf2cc0cf..f121c7be8 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/scope/DefaultComparisonScopeTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/scope/DefaultComparisonScopeTest.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.scope;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.compare.scope.DefaultComparisonScope;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
-import org.eclipse.emf.ecore.EGenericType;
-import org.eclipse.emf.ecore.EObject;
-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.emf.ecore.util.EcoreUtil;
-import org.junit.Test;
-
-/**
- * This class will allow us to test the behavior of the {@link DefaultComparisonScope}.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class DefaultComparisonScopeTest {
- @Test
- public void testGetRoots() throws IOException {
- final IComparisonScope nullScope = createNullScope();
- assertNull(nullScope.getLeft());
- assertNull(nullScope.getRight());
- assertNull(nullScope.getOrigin());
-
- // These are only getters, they should return us the unchanged object
- final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
- final Resource leftResource = mockModel.getExtlibraryLeft();
- final Resource rightResource = mockModel.getExtlibraryRight();
- final Resource originResource = mockModel.getExtlibraryOrigin();
-
- assertNotNull(leftResource);
- assertNotNull(rightResource);
- assertNotNull(originResource);
-
- final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false);
- final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(leftResource, false);
- final Iterator<EObject> originContent = EcoreUtil.getAllProperContents(leftResource, false);
-
- while (leftContent.hasNext() && rightContent.hasNext() && originContent.hasNext()) {
- final EObject left = leftContent.next();
- final EObject right = rightContent.next();
- final EObject origin = originContent.next();
- final IComparisonScope eObjectScope = new DefaultComparisonScope(left, right, origin);
-
- assertSame(left, eObjectScope.getLeft());
- assertSame(right, eObjectScope.getRight());
- assertSame(origin, eObjectScope.getOrigin());
- }
-
- final IComparisonScope resourceScope = new DefaultComparisonScope(leftResource, rightResource,
- originResource);
- assertSame(leftResource, resourceScope.getLeft());
- assertSame(rightResource, resourceScope.getRight());
- assertSame(originResource, resourceScope.getOrigin());
-
- final ResourceSet leftRS = newResourceSet(leftResource);
- final ResourceSet rightRS = newResourceSet(rightResource);
- final ResourceSet originRS = newResourceSet(originResource);
-
- final IComparisonScope resourceSetScope = new DefaultComparisonScope(leftRS, rightRS, originRS);
- assertSame(leftRS, resourceSetScope.getLeft());
- assertSame(rightRS, resourceSetScope.getRight());
- assertSame(originRS, resourceSetScope.getOrigin());
- }
-
- @Test
- public void testGetChildrenForNull() {
- final IComparisonScope nullScope = createNullScope();
-
- assertFalse(nullScope.getChildren((EObject)null).hasNext());
- assertFalse(nullScope.getCoveredEObjects((Resource)null).hasNext());
- assertFalse(nullScope.getCoveredResources((ResourceSet)null).hasNext());
- }
-
- @Test
- public void testGetEObjectCHildren() throws IOException {
- final IComparisonScope resourceScope = createResourceScope();
-
- assertTrue(resourceScope.getLeft() instanceof Resource);
- assertTrue(resourceScope.getRight() instanceof Resource);
- assertTrue(resourceScope.getOrigin() instanceof Resource);
-
- final Resource leftResource = (Resource)resourceScope.getLeft();
- final Resource rightResource = (Resource)resourceScope.getRight();
- final Resource originResource = (Resource)resourceScope.getOrigin();
-
- final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false);
- final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(rightResource, false);
- final Iterator<EObject> originContent = EcoreUtil.getAllProperContents(originResource, false);
- final Iterator<EObject> allEObjects = Iterators.concat(leftContent, rightContent, originContent);
-
- boolean empty = true;
- while (allEObjects.hasNext()) {
- empty = false;
- final EObject root = allEObjects.next();
-
- final Iterator<? extends EObject> scopeChildren = resourceScope.getChildren(root);
- final List<EObject> children = Lists.newArrayList(Iterators.filter(EcoreUtil
- .getAllProperContents(root, false), EObject.class));
-
- while (scopeChildren.hasNext()) {
- assertTrue(children.remove(scopeChildren.next()));
- }
- // We want the default scope to avoid all EGenericTypes
- for (EObject outOfScope : children) {
- assertTrue(outOfScope instanceof EGenericType);
- }
- }
- assertFalse(empty);
- }
-
- @Test
- public void testGetResourceChildren() throws IOException {
- final IComparisonScope resourceScope = createResourceScope();
-
- assertTrue(resourceScope.getLeft() instanceof Resource);
- assertTrue(resourceScope.getRight() instanceof Resource);
- assertTrue(resourceScope.getOrigin() instanceof Resource);
-
- final Resource leftResource = (Resource)resourceScope.getLeft();
- final Resource rightResource = (Resource)resourceScope.getRight();
- final Resource originResource = (Resource)resourceScope.getOrigin();
-
- final Iterator<? extends EObject> scopeLeftChildren = resourceScope.getCoveredEObjects(leftResource);
- final List<EObject> leftChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
- .getAllProperContents(leftResource, false), EObject.class));
- while (scopeLeftChildren.hasNext()) {
- assertTrue(leftChildren.remove(scopeLeftChildren.next()));
- }
- // We want the default scope to avoid all EGenericTypes
- for (EObject outOfScope : leftChildren) {
- assertTrue(outOfScope instanceof EGenericType);
- }
-
- final Iterator<? extends EObject> scopeRightChildren = resourceScope
- .getCoveredEObjects(rightResource);
- final List<EObject> rightChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
- .getAllProperContents(rightResource, false), EObject.class));
- while (scopeRightChildren.hasNext()) {
- assertTrue(rightChildren.remove(scopeRightChildren.next()));
- }
- // We want the default scope to avoid all EGenericTypes
- for (EObject outOfScope : rightChildren) {
- assertTrue(outOfScope instanceof EGenericType);
- }
-
- final Iterator<? extends EObject> scopeOriginChildren = resourceScope
- .getCoveredEObjects(originResource);
- final List<EObject> originChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
- .getAllProperContents(originResource, false), EObject.class));
- while (scopeOriginChildren.hasNext()) {
- assertTrue(originChildren.remove(scopeOriginChildren.next()));
- }
- // We want the default scope to avoid all EGenericTypes
- for (EObject outOfScope : originChildren) {
- assertTrue(outOfScope instanceof EGenericType);
- }
- }
-
- @Test
- public void testGetResourceSetChildren() throws IOException {
- final IComparisonScope resourceScope = createResourceSetScope();
-
- assertTrue(resourceScope.getLeft() instanceof ResourceSet);
- assertTrue(resourceScope.getRight() instanceof ResourceSet);
- assertTrue(resourceScope.getOrigin() instanceof ResourceSet);
-
- final ResourceSet leftResourceSet = (ResourceSet)resourceScope.getLeft();
- final ResourceSet rightResourceSet = (ResourceSet)resourceScope.getRight();
- final ResourceSet originResourceSet = (ResourceSet)resourceScope.getOrigin();
-
- final Iterator<? extends Resource> scopeLeftChildren = resourceScope
- .getCoveredResources(leftResourceSet);
- final List<Resource> leftChildren = Lists.newArrayList(leftResourceSet.getResources());
- while (scopeLeftChildren.hasNext()) {
- Resource child = scopeLeftChildren.next();
-
- assertTrue(leftChildren.remove(child));
- }
- assertTrue(leftChildren.isEmpty());
-
- final Iterator<? extends Resource> scopeRightChildren = resourceScope
- .getCoveredResources(rightResourceSet);
- final List<Resource> rightChildren = Lists.newArrayList(rightResourceSet.getResources());
- while (scopeRightChildren.hasNext()) {
- Resource child = scopeRightChildren.next();
-
- assertTrue(rightChildren.remove(child));
- }
- assertTrue(rightChildren.isEmpty());
-
- final Iterator<? extends Resource> scopeOriginChildren = resourceScope
- .getCoveredResources(originResourceSet);
- final List<Resource> originChildren = Lists.newArrayList(originResourceSet.getResources());
- while (scopeOriginChildren.hasNext()) {
- Resource child = scopeOriginChildren.next();
-
- assertTrue(originChildren.remove(child));
- }
- assertTrue(originChildren.isEmpty());
- }
-
- private static IComparisonScope createNullScope() {
- return new DefaultComparisonScope(null, null, null);
- }
-
- private static IComparisonScope createResourceScope() throws IOException {
- final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
- final Resource leftResource = mockModel.getExtlibraryLeft();
- final Resource rightResource = mockModel.getExtlibraryRight();
- final Resource originResource = mockModel.getExtlibraryOrigin();
-
- assertNotNull(leftResource);
- assertNotNull(rightResource);
- assertNotNull(originResource);
-
- return new DefaultComparisonScope(leftResource, rightResource, originResource);
- }
-
- private static IComparisonScope createResourceSetScope() throws IOException {
- final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
- final Resource leftResource = mockModel.getExtlibraryLeft();
- final Resource rightResource = mockModel.getExtlibraryRight();
- final Resource originResource = mockModel.getExtlibraryOrigin();
-
- assertNotNull(leftResource);
- assertNotNull(rightResource);
- assertNotNull(originResource);
-
- final ResourceSet leftRS = newResourceSet(leftResource);
- final ResourceSet rightRS = newResourceSet(rightResource);
- final ResourceSet originRS = newResourceSet(originResource);
-
- return new DefaultComparisonScope(leftRS, rightRS, originRS);
- }
-
- private static ResourceSet newResourceSet(Resource... resources) {
- final ResourceSet resourceSet = new ResourceSetImpl();
- for (int i = 0; i < resources.length; i++) {
- resourceSet.getResources().add(resources[i]);
- }
- return resourceSet;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.scope;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.fullcomparison.data.identifier.IdentifierMatchInputData;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+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.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+/**
+ * This class will allow us to test the behavior of the {@link DefaultComparisonScope}.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class DefaultComparisonScopeTest {
+ @Test
+ public void testGetRoots() throws IOException {
+ final IComparisonScope nullScope = createNullScope();
+ assertNull(nullScope.getLeft());
+ assertNull(nullScope.getRight());
+ assertNull(nullScope.getOrigin());
+
+ // These are only getters, they should return us the unchanged object
+ final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
+ final Resource leftResource = mockModel.getExtlibraryLeft();
+ final Resource rightResource = mockModel.getExtlibraryRight();
+ final Resource originResource = mockModel.getExtlibraryOrigin();
+
+ assertNotNull(leftResource);
+ assertNotNull(rightResource);
+ assertNotNull(originResource);
+
+ final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false);
+ final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(leftResource, false);
+ final Iterator<EObject> originContent = EcoreUtil.getAllProperContents(leftResource, false);
+
+ while (leftContent.hasNext() && rightContent.hasNext() && originContent.hasNext()) {
+ final EObject left = leftContent.next();
+ final EObject right = rightContent.next();
+ final EObject origin = originContent.next();
+ final IComparisonScope eObjectScope = new DefaultComparisonScope(left, right, origin);
+
+ assertSame(left, eObjectScope.getLeft());
+ assertSame(right, eObjectScope.getRight());
+ assertSame(origin, eObjectScope.getOrigin());
+ }
+
+ final IComparisonScope resourceScope = new DefaultComparisonScope(leftResource, rightResource,
+ originResource);
+ assertSame(leftResource, resourceScope.getLeft());
+ assertSame(rightResource, resourceScope.getRight());
+ assertSame(originResource, resourceScope.getOrigin());
+
+ final ResourceSet leftRS = newResourceSet(leftResource);
+ final ResourceSet rightRS = newResourceSet(rightResource);
+ final ResourceSet originRS = newResourceSet(originResource);
+
+ final IComparisonScope resourceSetScope = new DefaultComparisonScope(leftRS, rightRS, originRS);
+ assertSame(leftRS, resourceSetScope.getLeft());
+ assertSame(rightRS, resourceSetScope.getRight());
+ assertSame(originRS, resourceSetScope.getOrigin());
+ }
+
+ @Test
+ public void testGetChildrenForNull() {
+ final IComparisonScope nullScope = createNullScope();
+
+ assertFalse(nullScope.getChildren((EObject)null).hasNext());
+ assertFalse(nullScope.getCoveredEObjects((Resource)null).hasNext());
+ assertFalse(nullScope.getCoveredResources((ResourceSet)null).hasNext());
+ }
+
+ @Test
+ public void testGetEObjectCHildren() throws IOException {
+ final IComparisonScope resourceScope = createResourceScope();
+
+ assertTrue(resourceScope.getLeft() instanceof Resource);
+ assertTrue(resourceScope.getRight() instanceof Resource);
+ assertTrue(resourceScope.getOrigin() instanceof Resource);
+
+ final Resource leftResource = (Resource)resourceScope.getLeft();
+ final Resource rightResource = (Resource)resourceScope.getRight();
+ final Resource originResource = (Resource)resourceScope.getOrigin();
+
+ final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false);
+ final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(rightResource, false);
+ final Iterator<EObject> originContent = EcoreUtil.getAllProperContents(originResource, false);
+ final Iterator<EObject> allEObjects = Iterators.concat(leftContent, rightContent, originContent);
+
+ boolean empty = true;
+ while (allEObjects.hasNext()) {
+ empty = false;
+ final EObject root = allEObjects.next();
+
+ final Iterator<? extends EObject> scopeChildren = resourceScope.getChildren(root);
+ final List<EObject> children = Lists.newArrayList(Iterators.filter(EcoreUtil
+ .getAllProperContents(root, false), EObject.class));
+
+ while (scopeChildren.hasNext()) {
+ assertTrue(children.remove(scopeChildren.next()));
+ }
+ // We want the default scope to avoid all EGenericTypes
+ for (EObject outOfScope : children) {
+ assertTrue(outOfScope instanceof EGenericType);
+ }
+ }
+ assertFalse(empty);
+ }
+
+ @Test
+ public void testGetResourceChildren() throws IOException {
+ final IComparisonScope resourceScope = createResourceScope();
+
+ assertTrue(resourceScope.getLeft() instanceof Resource);
+ assertTrue(resourceScope.getRight() instanceof Resource);
+ assertTrue(resourceScope.getOrigin() instanceof Resource);
+
+ final Resource leftResource = (Resource)resourceScope.getLeft();
+ final Resource rightResource = (Resource)resourceScope.getRight();
+ final Resource originResource = (Resource)resourceScope.getOrigin();
+
+ final Iterator<? extends EObject> scopeLeftChildren = resourceScope.getCoveredEObjects(leftResource);
+ final List<EObject> leftChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
+ .getAllProperContents(leftResource, false), EObject.class));
+ while (scopeLeftChildren.hasNext()) {
+ assertTrue(leftChildren.remove(scopeLeftChildren.next()));
+ }
+ // We want the default scope to avoid all EGenericTypes
+ for (EObject outOfScope : leftChildren) {
+ assertTrue(outOfScope instanceof EGenericType);
+ }
+
+ final Iterator<? extends EObject> scopeRightChildren = resourceScope
+ .getCoveredEObjects(rightResource);
+ final List<EObject> rightChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
+ .getAllProperContents(rightResource, false), EObject.class));
+ while (scopeRightChildren.hasNext()) {
+ assertTrue(rightChildren.remove(scopeRightChildren.next()));
+ }
+ // We want the default scope to avoid all EGenericTypes
+ for (EObject outOfScope : rightChildren) {
+ assertTrue(outOfScope instanceof EGenericType);
+ }
+
+ final Iterator<? extends EObject> scopeOriginChildren = resourceScope
+ .getCoveredEObjects(originResource);
+ final List<EObject> originChildren = Lists.newArrayList(Iterators.filter(EcoreUtil
+ .getAllProperContents(originResource, false), EObject.class));
+ while (scopeOriginChildren.hasNext()) {
+ assertTrue(originChildren.remove(scopeOriginChildren.next()));
+ }
+ // We want the default scope to avoid all EGenericTypes
+ for (EObject outOfScope : originChildren) {
+ assertTrue(outOfScope instanceof EGenericType);
+ }
+ }
+
+ @Test
+ public void testGetResourceSetChildren() throws IOException {
+ final IComparisonScope resourceScope = createResourceSetScope();
+
+ assertTrue(resourceScope.getLeft() instanceof ResourceSet);
+ assertTrue(resourceScope.getRight() instanceof ResourceSet);
+ assertTrue(resourceScope.getOrigin() instanceof ResourceSet);
+
+ final ResourceSet leftResourceSet = (ResourceSet)resourceScope.getLeft();
+ final ResourceSet rightResourceSet = (ResourceSet)resourceScope.getRight();
+ final ResourceSet originResourceSet = (ResourceSet)resourceScope.getOrigin();
+
+ final Iterator<? extends Resource> scopeLeftChildren = resourceScope
+ .getCoveredResources(leftResourceSet);
+ final List<Resource> leftChildren = Lists.newArrayList(leftResourceSet.getResources());
+ while (scopeLeftChildren.hasNext()) {
+ Resource child = scopeLeftChildren.next();
+
+ assertTrue(leftChildren.remove(child));
+ }
+ assertTrue(leftChildren.isEmpty());
+
+ final Iterator<? extends Resource> scopeRightChildren = resourceScope
+ .getCoveredResources(rightResourceSet);
+ final List<Resource> rightChildren = Lists.newArrayList(rightResourceSet.getResources());
+ while (scopeRightChildren.hasNext()) {
+ Resource child = scopeRightChildren.next();
+
+ assertTrue(rightChildren.remove(child));
+ }
+ assertTrue(rightChildren.isEmpty());
+
+ final Iterator<? extends Resource> scopeOriginChildren = resourceScope
+ .getCoveredResources(originResourceSet);
+ final List<Resource> originChildren = Lists.newArrayList(originResourceSet.getResources());
+ while (scopeOriginChildren.hasNext()) {
+ Resource child = scopeOriginChildren.next();
+
+ assertTrue(originChildren.remove(child));
+ }
+ assertTrue(originChildren.isEmpty());
+ }
+
+ private static IComparisonScope createNullScope() {
+ return new DefaultComparisonScope(null, null, null);
+ }
+
+ private static IComparisonScope createResourceScope() throws IOException {
+ final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
+ final Resource leftResource = mockModel.getExtlibraryLeft();
+ final Resource rightResource = mockModel.getExtlibraryRight();
+ final Resource originResource = mockModel.getExtlibraryOrigin();
+
+ assertNotNull(leftResource);
+ assertNotNull(rightResource);
+ assertNotNull(originResource);
+
+ return new DefaultComparisonScope(leftResource, rightResource, originResource);
+ }
+
+ private static IComparisonScope createResourceSetScope() throws IOException {
+ final IdentifierMatchInputData mockModel = new IdentifierMatchInputData();
+ final Resource leftResource = mockModel.getExtlibraryLeft();
+ final Resource rightResource = mockModel.getExtlibraryRight();
+ final Resource originResource = mockModel.getExtlibraryOrigin();
+
+ assertNotNull(leftResource);
+ assertNotNull(rightResource);
+ assertNotNull(originResource);
+
+ final ResourceSet leftRS = newResourceSet(leftResource);
+ final ResourceSet rightRS = newResourceSet(rightResource);
+ final ResourceSet originRS = newResourceSet(originResource);
+
+ return new DefaultComparisonScope(leftRS, rightRS, originRS);
+ }
+
+ private static ResourceSet newResourceSet(Resource... resources) {
+ final ResourceSet resourceSet = new ResourceSetImpl();
+ for (int i = 0; i < resources.length; i++) {
+ resourceSet.getResources().add(resources[i]);
+ }
+ return resourceSet;
+ }
+}

Back to the top