Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2014-03-13 05:33:46 -0400
committerLaurent Goubet2014-03-13 05:52:48 -0400
commite63deb9b180c40d8eea784f6846aafdcfad068af (patch)
tree2dc8e77f5a88813949240d8dae56c33b374ffc64 /plugins/org.eclipse.emf.compare.uml2.tests
parent1012458bbd91bd446aae26d14b1b7ac7bdca4585 (diff)
downloadorg.eclipse.emf.compare-e63deb9b180c40d8eea784f6846aafdcfad068af.tar.gz
org.eclipse.emf.compare-e63deb9b180c40d8eea784f6846aafdcfad068af.tar.xz
org.eclipse.emf.compare-e63deb9b180c40d8eea784f6846aafdcfad068af.zip
normalize EOLs throughout EMF Compare
Diffstat (limited to 'plugins/org.eclipse.emf.compare.uml2.tests')
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.jdt.ui.prefs120
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel80
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml272
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/pom.xml68
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractDynamicProfileTest.java86
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractStaticProfileTest.java76
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLInputData.java156
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLProfileTest.java84
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/EMFCompareUML2TestsPlugin.java80
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java750
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java748
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java778
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java530
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/AssociationInputData.java80
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/a1/left.uml30
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddAbstractionTest.java378
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddDependencyTest.java376
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java408
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddRealizationTest.java378
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java408
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddUsageTest.java372
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeDependencyTest.java254
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeUsageTest.java254
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/data/DependencyInputData.java144
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddActionExecutionSpecificationTest.java666
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddBehaviorExecutionSpecificationTest.java666
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/data/ExecutionSpecificationInputData.java50
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/AddExtendTest.java354
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/ExtendInputData.java34
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/a1/left.uml28
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/AddGeneralizationSetTest.java520
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/data/GeneralizationSetInputData.java34
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java2072
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java1936
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java1802
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/ImplicationsInputData.java82
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a1/left.uml30
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/left.uml28
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/data/a2/right.uml18
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/include/AddIncludeTest.java302
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/include/data/IncludeInputData.java34
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/include/data/a1/left.uml24
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/merge/ExtensionMergeTest.java178
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/AddMessageTest.java1462
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/data/MessageInputData.java82
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/data/a2/left.uml42
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/data/a2/right.uml36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/data/a3/left.uml42
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/message/data/a3/right.uml36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/DynamicProfileTest.java514
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/StaticProfileTest.java494
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/dynamic/DynamicProfileInputData.java50
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/dynamic/a1/left.uml20
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/dynamic/a1/right.uml8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/dynamic/a2/left.uml20
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/dynamic/a2/right.uml20
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/static_/StaticProfileInputData.java36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/static_/a1/left.uml20
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/profiles/data/static_/a1/right.uml8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DynamicStereotypeTest.java2236
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/StaticStereotypeTest.java2470
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/DynamicStereotypeInputData.java204
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a1/left.uml26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a1/right.uml8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a10/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a10/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/ancestor.uml36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/left.uml36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/right.uml36
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a2/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a2/right.uml44
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a3/left.uml30
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a4/left.uml26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a4/right.uml18
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a6/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a6/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a7/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a7/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a8/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a8/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a9/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a9/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/StaticStereotypeInputData.java180
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b1/left.uml26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b1/right.uml8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b10/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b10/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b2/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b2/right.uml44
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b3/left.uml30
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b4/left.uml26
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b4/right.uml18
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b6/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b6/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b7/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b7/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b8/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b8/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b9/left.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/static_/b9/right.uml46
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java166
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/timeConstraint/AddTimeConstraintTest.java494
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/timeConstraint/data/TimeConstraintInputData.java32
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/timeConstraint/data/a1/left.uml64
106 files changed, 12968 insertions, 12968 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.resources.prefs
index 4824b8026..99f26c020 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.compare.uml2.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.uml2.tests/.settings/org.eclipse.core.runtime.prefs b/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.runtime.prefs
index f8a67de1d..5a0ad22d2 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.core.runtime.prefs
+++ b/plugins/org.eclipse.emf.compare.uml2.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.uml2.tests/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.jdt.ui.prefs
index 4517c0f23..4e1442ee9 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.compare.uml2.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.uml2.tests/model/UML2CompareTestProfile.genmodel b/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel
index 5e303d8e2..52492c05e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel 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" xmlns:genmodel="http://www.eclipse.org/uml2/2.2.0/GenModel" modelDirectory="/org.eclipse.emf.compare.uml2.tests/profile"
- modelPluginID="org.eclipse.emf.compare.uml2.tests" modelName="UML2CompareTestProfile"
- nonNLSMarkers="true" importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="5.0"
- copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml">
- <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer">
- <details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
- <details key="UNION_PROPERTIES" value="REPORT"/>
- <details key="DUPLICATE_FEATURES" value="DISCARD"/>
- <details key="SUBSETTING_PROPERTIES" value="REPORT"/>
- <details key="COMMENTS" value="PROCESS"/>
- <details key="DUPLICATE_FEATURE_INHERITANCE" value="DISCARD"/>
- <details key="DUPLICATE_OPERATIONS" value="DISCARD"/>
- <details key="INVARIANT_CONSTRAINTS" value="PROCESS"/>
- <details key="REDEFINING_PROPERTIES" value="REPORT"/>
- <details key="ANNOTATION_DETAILS" value="PROCESS"/>
- <details key="DUPLICATE_OPERATION_INHERITANCE" value="DISCARD"/>
- <details key="REDEFINING_OPERATIONS" value="REPORT"/>
- <details key="DERIVED_FEATURES" value="PROCESS"/>
- <details key="OPERATION_BODIES" value="IGNORE"/>
- <details key="CAMEL_CASE_NAMES" value="IGNORE"/>
- <details key="SUPER_CLASS_ORDER" value="PROCESS"/>
- </genAnnotations>
- <foreignModel>uml2.compare.testprofile.profile.uml</foreignModel>
- <genPackages xsi:type="genmodel:GenPackage" prefix="UML2CompareTestProfile" basePackage="org.eclipse.emf.compare.uml2.profile.test"
- disposableProviderFactory="true" ecorePackage="uml2comparetestprofile.ecore#/">
- <genClasses xsi:type="genmodel:GenClass" ecoreClass="uml2comparetestprofile.ecore#//ACliche">
- <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute uml2comparetestprofile.ecore#//ACliche/singleValuedAttribute"/>
- <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute uml2comparetestprofile.ecore#//ACliche/manyValuedAttribute"/>
- <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
- propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/singleValuedReference"/>
- <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
- propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/manyValuedReference"/>
- <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
- propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/base_Class"/>
- </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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/uml2/2.2.0/GenModel" modelDirectory="/org.eclipse.emf.compare.uml2.tests/profile"
+ modelPluginID="org.eclipse.emf.compare.uml2.tests" modelName="UML2CompareTestProfile"
+ nonNLSMarkers="true" importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="5.0"
+ copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml">
+ <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer">
+ <details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
+ <details key="UNION_PROPERTIES" value="REPORT"/>
+ <details key="DUPLICATE_FEATURES" value="DISCARD"/>
+ <details key="SUBSETTING_PROPERTIES" value="REPORT"/>
+ <details key="COMMENTS" value="PROCESS"/>
+ <details key="DUPLICATE_FEATURE_INHERITANCE" value="DISCARD"/>
+ <details key="DUPLICATE_OPERATIONS" value="DISCARD"/>
+ <details key="INVARIANT_CONSTRAINTS" value="PROCESS"/>
+ <details key="REDEFINING_PROPERTIES" value="REPORT"/>
+ <details key="ANNOTATION_DETAILS" value="PROCESS"/>
+ <details key="DUPLICATE_OPERATION_INHERITANCE" value="DISCARD"/>
+ <details key="REDEFINING_OPERATIONS" value="REPORT"/>
+ <details key="DERIVED_FEATURES" value="PROCESS"/>
+ <details key="OPERATION_BODIES" value="IGNORE"/>
+ <details key="CAMEL_CASE_NAMES" value="IGNORE"/>
+ <details key="SUPER_CLASS_ORDER" value="PROCESS"/>
+ </genAnnotations>
+ <foreignModel>uml2.compare.testprofile.profile.uml</foreignModel>
+ <genPackages xsi:type="genmodel:GenPackage" prefix="UML2CompareTestProfile" basePackage="org.eclipse.emf.compare.uml2.profile.test"
+ disposableProviderFactory="true" ecorePackage="uml2comparetestprofile.ecore#/">
+ <genClasses xsi:type="genmodel:GenClass" ecoreClass="uml2comparetestprofile.ecore#//ACliche">
+ <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute uml2comparetestprofile.ecore#//ACliche/singleValuedAttribute"/>
+ <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute uml2comparetestprofile.ecore#//ACliche/manyValuedAttribute"/>
+ <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
+ propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/singleValuedReference"/>
+ <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
+ propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/manyValuedReference"/>
+ <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
+ propertySortChoices="true" ecoreFeature="ecore:EReference uml2comparetestprofile.ecore#//ACliche/base_Class"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml b/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml
index f27ff1595..69f851483 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml
@@ -1,136 +1,136 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">
- <uml:Profile xmi:id="_hZFTgIwkEeC_FYHMbTTxXw" name="UML2CompareTestProfile" metaclassReference="_gHJYQIwpEeC_FYHMbTTxXw">
- <eAnnotations xmi:id="_DL47UCjtEeKqNZFxtZ0S6g" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <contents xmi:type="ecore:EPackage" xmi:id="_OuZDgPCCEeKBcNH8cCNzUg" name="uml2comparetestprofile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" nsPrefix="testProfile">
- <eClassifiers xmi:type="ecore:EClass" xmi:id="_OuZDgfCCEeKBcNH8cCNzUg" name="ACliche">
- <eAnnotations xmi:id="_OuZDgvCCEeKBcNH8cCNzUg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_wQjhQIwoEeC_FYHMbTTxXw"/>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDg_CCEeKBcNH8cCNzUg" name="singleValuedAttribute" ordered="false">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDhfCCEeKBcNH8cCNzUg" name="manyValuedAttribute" upperBound="-1">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDh_CCEeKBcNH8cCNzUg" name="singleValuedReference" ordered="false">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDifCCEeKBcNH8cCNzUg" name="manyValuedReference" upperBound="-1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDi_CCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- </eClassifiers>
- <eClassifiers xmi:type="ecore:EClass" xmi:id="_OuZDjfCCEeKBcNH8cCNzUg" name="ACliche2">
- <eAnnotations xmi:id="_OuZDjvCCEeKBcNH8cCNzUg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_x0pRAPCBEeKBcNH8cCNzUg"/>
- <eAnnotations xmi:id="_OuZDj_CCEeKBcNH8cCNzUg" source="duplicates">
- <contents xmi:type="ecore:EReference" xmi:id="_OuZDkPCCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
- <eAnnotations xmi:id="_OuZDkfCCEeKBcNH8cCNzUg" source="redefines" references="_OuZDm_CCEeKBcNH8cCNzUg"/>
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </contents>
- </eAnnotations>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDk_CCEeKBcNH8cCNzUg" name="singleValuedAttribute" ordered="false">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDlfCCEeKBcNH8cCNzUg" name="manyValuedAttribute" upperBound="-1">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDl_CCEeKBcNH8cCNzUg" name="singleValuedReference" ordered="false">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDmfCCEeKBcNH8cCNzUg" name="manyValuedReference" upperBound="-1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDm_CCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- </eClassifiers>
- </contents>
- <contents xmi:type="ecore:EPackage" xmi:id="_DL_B8CjtEeKqNZFxtZ0S6g" name="uml2comparetestprofile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" nsPrefix="testProfile">
- <eClassifiers xmi:type="ecore:EClass" xmi:id="_DL_B8SjtEeKqNZFxtZ0S6g" name="ACliche">
- <eAnnotations xmi:id="_DL_B8ijtEeKqNZFxtZ0S6g" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_wQjhQIwoEeC_FYHMbTTxXw"/>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_DL_B8yjtEeKqNZFxtZ0S6g" name="singleValuedAttribute" ordered="false">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_DL_B9SjtEeKqNZFxtZ0S6g" name="manyValuedAttribute" upperBound="-1">
- <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B9yjtEeKqNZFxtZ0S6g" name="singleValuedReference" ordered="false">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B-SjtEeKqNZFxtZ0S6g" name="manyValuedReference" upperBound="-1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B-yjtEeKqNZFxtZ0S6g" name="base_Class" ordered="false" lowerBound="1">
- <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
- </eStructuralFeatures>
- </eClassifiers>
- </contents>
- </eAnnotations>
- <elementImport xmi:id="_gHJYQIwpEeC_FYHMbTTxXw">
- <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- </elementImport>
- <packagedElement xmi:type="uml:Stereotype" xmi:id="_wQjhQIwoEeC_FYHMbTTxXw" name="ACliche">
- <ownedAttribute xmi:id="_2BXCQIwoEeC_FYHMbTTxXw" name="singleValuedAttribute">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_5andEIwoEeC_FYHMbTTxXw"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_2x68gIwoEeC_FYHMbTTxXw" name="manyValuedAttribute" isOrdered="true">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_HHFNEIwpEeC_FYHMbTTxXw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_HelHEIwpEeC_FYHMbTTxXw" value="*"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_VpE24IwpEeC_FYHMbTTxXw" name="singleValuedReference">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_VpE24YwpEeC_FYHMbTTxXw"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_VpGFAIwpEeC_FYHMbTTxXw" name="manyValuedReference" isOrdered="true">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_VpGFAowpEeC_FYHMbTTxXw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_VpGFAYwpEeC_FYHMbTTxXw" value="*"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_hQCS8owpEeC_FYHMbTTxXw" name="base_Class" association="_hQCS8IwpEeC_FYHMbTTxXw">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:Extension" xmi:id="_hQCS8IwpEeC_FYHMbTTxXw" name="Class_ACliche" memberEnd="_hQCS8YwpEeC_FYHMbTTxXw _hQCS8owpEeC_FYHMbTTxXw">
- <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_hQCS8YwpEeC_FYHMbTTxXw" name="extension_ACliche" type="_wQjhQIwoEeC_FYHMbTTxXw" aggregation="composite" association="_hQCS8IwpEeC_FYHMbTTxXw"/>
- </packagedElement>
- <packagedElement xmi:type="uml:Stereotype" xmi:id="_x0pRAPCBEeKBcNH8cCNzUg" name="ACliche2">
- <ownedAttribute xmi:id="_x0pRAfCBEeKBcNH8cCNzUg" name="singleValuedAttribute">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRAvCBEeKBcNH8cCNzUg"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_x0pRA_CBEeKBcNH8cCNzUg" name="manyValuedAttribute" isOrdered="true">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRBPCBEeKBcNH8cCNzUg"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_x0pRBfCBEeKBcNH8cCNzUg" value="*"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_x0pRBvCBEeKBcNH8cCNzUg" name="singleValuedReference">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRB_CBEeKBcNH8cCNzUg"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_x0pRCPCBEeKBcNH8cCNzUg" name="manyValuedReference" isOrdered="true">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRCfCBEeKBcNH8cCNzUg"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_x0pRCvCBEeKBcNH8cCNzUg" value="*"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_x0pRC_CBEeKBcNH8cCNzUg" name="base_Class">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- </ownedAttribute>
- <ownedAttribute xmi:id="_J3SKoPCCEeKBcNH8cCNzUg" name="base_Class" association="_J3OgQPCCEeKBcNH8cCNzUg">
- <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:Extension" xmi:id="_J3OgQPCCEeKBcNH8cCNzUg" name="Class_ACliche2" memberEnd="_J3RjkPCCEeKBcNH8cCNzUg _J3SKoPCCEeKBcNH8cCNzUg">
- <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_J3RjkPCCEeKBcNH8cCNzUg" name="extension_ACliche2" type="_x0pRAPCBEeKBcNH8cCNzUg" aggregation="composite" association="_J3OgQPCCEeKBcNH8cCNzUg"/>
- </packagedElement>
- <profileApplication xmi:id="_zXVhcIwnEeC_FYHMbTTxXw">
- <eAnnotations xmi:id="_zXXWoIwnEeC_FYHMbTTxXw" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA"/>
- </eAnnotations>
- <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
- </profileApplication>
- </uml:Profile>
- <Ecore:EPackage xmi:id="_1Dh9gIwnEeC_FYHMbTTxXw" base_Package="_hZFTgIwkEeC_FYHMbTTxXw" packageName="uml2comparetestprofile" nsPrefix="testProfile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" basePackage="org.eclipse.emf.compare.uml2.profile.test" prefix="UML2CompareTestProfile"/>
-</xmi:XMI>
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">
+ <uml:Profile xmi:id="_hZFTgIwkEeC_FYHMbTTxXw" name="UML2CompareTestProfile" metaclassReference="_gHJYQIwpEeC_FYHMbTTxXw">
+ <eAnnotations xmi:id="_DL47UCjtEeKqNZFxtZ0S6g" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_OuZDgPCCEeKBcNH8cCNzUg" name="uml2comparetestprofile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" nsPrefix="testProfile">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_OuZDgfCCEeKBcNH8cCNzUg" name="ACliche">
+ <eAnnotations xmi:id="_OuZDgvCCEeKBcNH8cCNzUg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_wQjhQIwoEeC_FYHMbTTxXw"/>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDg_CCEeKBcNH8cCNzUg" name="singleValuedAttribute" ordered="false">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDhfCCEeKBcNH8cCNzUg" name="manyValuedAttribute" upperBound="-1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDh_CCEeKBcNH8cCNzUg" name="singleValuedReference" ordered="false">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDifCCEeKBcNH8cCNzUg" name="manyValuedReference" upperBound="-1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDi_CCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_OuZDjfCCEeKBcNH8cCNzUg" name="ACliche2">
+ <eAnnotations xmi:id="_OuZDjvCCEeKBcNH8cCNzUg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_x0pRAPCBEeKBcNH8cCNzUg"/>
+ <eAnnotations xmi:id="_OuZDj_CCEeKBcNH8cCNzUg" source="duplicates">
+ <contents xmi:type="ecore:EReference" xmi:id="_OuZDkPCCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
+ <eAnnotations xmi:id="_OuZDkfCCEeKBcNH8cCNzUg" source="redefines" references="_OuZDm_CCEeKBcNH8cCNzUg"/>
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </contents>
+ </eAnnotations>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDk_CCEeKBcNH8cCNzUg" name="singleValuedAttribute" ordered="false">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_OuZDlfCCEeKBcNH8cCNzUg" name="manyValuedAttribute" upperBound="-1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDl_CCEeKBcNH8cCNzUg" name="singleValuedReference" ordered="false">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDmfCCEeKBcNH8cCNzUg" name="manyValuedReference" upperBound="-1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_OuZDm_CCEeKBcNH8cCNzUg" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ <contents xmi:type="ecore:EPackage" xmi:id="_DL_B8CjtEeKqNZFxtZ0S6g" name="uml2comparetestprofile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" nsPrefix="testProfile">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_DL_B8SjtEeKqNZFxtZ0S6g" name="ACliche">
+ <eAnnotations xmi:id="_DL_B8ijtEeKqNZFxtZ0S6g" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_wQjhQIwoEeC_FYHMbTTxXw"/>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_DL_B8yjtEeKqNZFxtZ0S6g" name="singleValuedAttribute" ordered="false">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_DL_B9SjtEeKqNZFxtZ0S6g" name="manyValuedAttribute" upperBound="-1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B9yjtEeKqNZFxtZ0S6g" name="singleValuedReference" ordered="false">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B-SjtEeKqNZFxtZ0S6g" name="manyValuedReference" upperBound="-1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_DL_B-yjtEeKqNZFxtZ0S6g" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <elementImport xmi:id="_gHJYQIwpEeC_FYHMbTTxXw">
+ <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </elementImport>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_wQjhQIwoEeC_FYHMbTTxXw" name="ACliche">
+ <ownedAttribute xmi:id="_2BXCQIwoEeC_FYHMbTTxXw" name="singleValuedAttribute">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_5andEIwoEeC_FYHMbTTxXw"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_2x68gIwoEeC_FYHMbTTxXw" name="manyValuedAttribute" isOrdered="true">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_HHFNEIwpEeC_FYHMbTTxXw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_HelHEIwpEeC_FYHMbTTxXw" value="*"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_VpE24IwpEeC_FYHMbTTxXw" name="singleValuedReference">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_VpE24YwpEeC_FYHMbTTxXw"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_VpGFAIwpEeC_FYHMbTTxXw" name="manyValuedReference" isOrdered="true">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_VpGFAowpEeC_FYHMbTTxXw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_VpGFAYwpEeC_FYHMbTTxXw" value="*"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_hQCS8owpEeC_FYHMbTTxXw" name="base_Class" association="_hQCS8IwpEeC_FYHMbTTxXw">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_hQCS8IwpEeC_FYHMbTTxXw" name="Class_ACliche" memberEnd="_hQCS8YwpEeC_FYHMbTTxXw _hQCS8owpEeC_FYHMbTTxXw">
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_hQCS8YwpEeC_FYHMbTTxXw" name="extension_ACliche" type="_wQjhQIwoEeC_FYHMbTTxXw" aggregation="composite" association="_hQCS8IwpEeC_FYHMbTTxXw"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_x0pRAPCBEeKBcNH8cCNzUg" name="ACliche2">
+ <ownedAttribute xmi:id="_x0pRAfCBEeKBcNH8cCNzUg" name="singleValuedAttribute">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRAvCBEeKBcNH8cCNzUg"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_x0pRA_CBEeKBcNH8cCNzUg" name="manyValuedAttribute" isOrdered="true">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRBPCBEeKBcNH8cCNzUg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_x0pRBfCBEeKBcNH8cCNzUg" value="*"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_x0pRBvCBEeKBcNH8cCNzUg" name="singleValuedReference">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRB_CBEeKBcNH8cCNzUg"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_x0pRCPCBEeKBcNH8cCNzUg" name="manyValuedReference" isOrdered="true">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_x0pRCfCBEeKBcNH8cCNzUg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_x0pRCvCBEeKBcNH8cCNzUg" value="*"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_x0pRC_CBEeKBcNH8cCNzUg" name="base_Class">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_J3SKoPCCEeKBcNH8cCNzUg" name="base_Class" association="_J3OgQPCCEeKBcNH8cCNzUg">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_J3OgQPCCEeKBcNH8cCNzUg" name="Class_ACliche2" memberEnd="_J3RjkPCCEeKBcNH8cCNzUg _J3SKoPCCEeKBcNH8cCNzUg">
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_J3RjkPCCEeKBcNH8cCNzUg" name="extension_ACliche2" type="_x0pRAPCBEeKBcNH8cCNzUg" aggregation="composite" association="_J3OgQPCCEeKBcNH8cCNzUg"/>
+ </packagedElement>
+ <profileApplication xmi:id="_zXVhcIwnEeC_FYHMbTTxXw">
+ <eAnnotations xmi:id="_zXXWoIwnEeC_FYHMbTTxXw" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
+ </profileApplication>
+ </uml:Profile>
+ <Ecore:EPackage xmi:id="_1Dh9gIwnEeC_FYHMbTTxXw" base_Package="_hZFTgIwkEeC_FYHMbTTxXw" packageName="uml2comparetestprofile" nsPrefix="testProfile" nsURI="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" basePackage="org.eclipse.emf.compare.uml2.profile.test" prefix="UML2CompareTestProfile"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml b/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml
index 2180ee18d..4a843b0a2 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/pom.xml
@@ -1,34 +1,34 @@
-<?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.uml2.tests</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>org/eclipse/emf/compare/uml2/tests/suite/AllTests.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.uml2.tests</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>org/eclipse/emf/compare/uml2/tests/suite/AllTests.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.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractDynamicProfileTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractDynamicProfileTest.java
index bcda76055..a3e3769e2 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractDynamicProfileTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractDynamicProfileTest.java
@@ -1,43 +1,43 @@
-package org.eclipse.emf.compare.uml2.tests;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.uml2.uml.UMLPlugin;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public abstract class AbstractDynamicProfileTest extends AbstractUMLProfileTest {
-
- static URI registeredURI;
-
- static Object registeredPackage;
-
- @BeforeClass
- public static void initEPackageNsURIToProfileLocationMap() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- // It is required to link the EPackage to the UML package of the UML Profile
- UMLPlugin
- .getEPackageNsURIToProfileLocationMap()
- .put("http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile",
- URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/uml2.compare.testprofile.profile.uml#_hZFTgIwkEeC_FYHMbTTxXw")); //$NON-NLS-1$
- } else {
- registeredURI = UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
- UML2CompareTestProfilePackage.eNS_URI);
- registeredPackage = EPackage.Registry.INSTANCE.remove(UML2CompareTestProfilePackage.eNS_URI);
- }
- }
-
- @AfterClass
- public static void resetEPackageNsURIToProfileLocationMap() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
- "http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile");
- } else {
- UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UML2CompareTestProfilePackage.eNS_URI,
- registeredURI);
- EPackage.Registry.INSTANCE.put(UML2CompareTestProfilePackage.eNS_URI, registeredPackage);
- }
- }
-}
+package org.eclipse.emf.compare.uml2.tests;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.uml2.uml.UMLPlugin;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public abstract class AbstractDynamicProfileTest extends AbstractUMLProfileTest {
+
+ static URI registeredURI;
+
+ static Object registeredPackage;
+
+ @BeforeClass
+ public static void initEPackageNsURIToProfileLocationMap() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ // It is required to link the EPackage to the UML package of the UML Profile
+ UMLPlugin
+ .getEPackageNsURIToProfileLocationMap()
+ .put("http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile",
+ URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/uml2.compare.testprofile.profile.uml#_hZFTgIwkEeC_FYHMbTTxXw")); //$NON-NLS-1$
+ } else {
+ registeredURI = UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
+ UML2CompareTestProfilePackage.eNS_URI);
+ registeredPackage = EPackage.Registry.INSTANCE.remove(UML2CompareTestProfilePackage.eNS_URI);
+ }
+ }
+
+ @AfterClass
+ public static void resetEPackageNsURIToProfileLocationMap() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
+ "http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile");
+ } else {
+ UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UML2CompareTestProfilePackage.eNS_URI,
+ registeredURI);
+ EPackage.Registry.INSTANCE.put(UML2CompareTestProfilePackage.eNS_URI, registeredPackage);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractStaticProfileTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractStaticProfileTest.java
index d3fc02acd..aac297d00 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractStaticProfileTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractStaticProfileTest.java
@@ -1,38 +1,38 @@
-package org.eclipse.emf.compare.uml2.tests;
-
-import java.util.Map;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.uml2.uml.UMLPlugin;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public abstract class AbstractStaticProfileTest extends AbstractUMLProfileTest {
-
- @BeforeClass
- public static void fillRegistriesForStatic() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- EPackage.Registry.INSTANCE.put(UML2CompareTestProfilePackage.eNS_URI,
- UML2CompareTestProfilePackage.eINSTANCE); // registers
- // against
- // EPackage.Registry
- // It is required to link the EPackage to the UML package of the UML Profile
- Map<String, URI> ePackageNsURIToProfileLocationMap = UMLPlugin
- .getEPackageNsURIToProfileLocationMap();
- ePackageNsURIToProfileLocationMap
- .put(UML2CompareTestProfilePackage.eNS_URI,
- URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/uml2.compare.testprofile.profile.uml#_hZFTgIwkEeC_FYHMbTTxXw")); //$NON-NLS-1$
- }
- }
-
- @AfterClass
- public static void resetRegistriesForStatic() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(UML2CompareTestProfilePackage.eNS_URI);
- EPackage.Registry.INSTANCE.remove(UML2CompareTestProfilePackage.eNS_URI);
- }
- }
-}
+package org.eclipse.emf.compare.uml2.tests;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.uml2.uml.UMLPlugin;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public abstract class AbstractStaticProfileTest extends AbstractUMLProfileTest {
+
+ @BeforeClass
+ public static void fillRegistriesForStatic() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ EPackage.Registry.INSTANCE.put(UML2CompareTestProfilePackage.eNS_URI,
+ UML2CompareTestProfilePackage.eINSTANCE); // registers
+ // against
+ // EPackage.Registry
+ // It is required to link the EPackage to the UML package of the UML Profile
+ Map<String, URI> ePackageNsURIToProfileLocationMap = UMLPlugin
+ .getEPackageNsURIToProfileLocationMap();
+ ePackageNsURIToProfileLocationMap
+ .put(UML2CompareTestProfilePackage.eNS_URI,
+ URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/uml2.compare.testprofile.profile.uml#_hZFTgIwkEeC_FYHMbTTxXw")); //$NON-NLS-1$
+ }
+ }
+
+ @AfterClass
+ public static void resetRegistriesForStatic() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(UML2CompareTestProfilePackage.eNS_URI);
+ EPackage.Registry.INSTANCE.remove(UML2CompareTestProfilePackage.eNS_URI);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLInputData.java
index 11e8abcc2..0db0781c6 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLInputData.java
@@ -1,78 +1,78 @@
-/**
- * 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.uml2.tests;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.uml2.uml.resource.UMLResource;
-import org.eclipse.uml2.uml.resources.ResourcesPlugin;
-import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;
-
-/**
- * Implementations of this class can be used to load models from the class' class loader.
- *
- * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
- */
-public abstract class AbstractUMLInputData extends AbstractInputData {
- /** Store the set of the resource sets of the input data. */
- private Set<ResourceSet> sets = new LinkedHashSet<ResourceSet>();
-
- public Set<ResourceSet> getSets() {
- return sets;
- }
-
- @Override
- 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());
-
- ResourceSet resourceSet = new ResourceSetImpl();
- getSets().add(resourceSet);
-
- // Standalone
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- UMLResourcesUtil.init(resourceSet);
-
- // override wrong pathmap mapping in UMLResourcesUtil
- final URL UMLJarredFileLocation = ResourcesPlugin.class.getResource("ResourcesPlugin.class");
- String UMLJarPath = UMLJarredFileLocation.toString();
- UMLJarPath = UMLJarPath.substring(0, UMLJarPath.indexOf('!'));
-
- final Map<URI, URI> uriMap = URIConverter.URI_MAP;
- uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI.createURI(UMLJarPath
- + "!/libraries/"));
- uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), URI.createURI(UMLJarPath
- + "!/metamodels/"));
- uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI.createURI(UMLJarPath + "!/profiles/"));
- }
-
- Resource resource = resourceSet.createResource(uri);
- resource.load(str, Collections.emptyMap());
- str.close();
-
- return resource;
- }
-}
+/**
+ * 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.uml2.tests;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.tests.framework.AbstractInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.uml2.uml.resource.UMLResource;
+import org.eclipse.uml2.uml.resources.ResourcesPlugin;
+import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;
+
+/**
+ * Implementations of this class can be used to load models from the class' class loader.
+ *
+ * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
+ */
+public abstract class AbstractUMLInputData extends AbstractInputData {
+ /** Store the set of the resource sets of the input data. */
+ private Set<ResourceSet> sets = new LinkedHashSet<ResourceSet>();
+
+ public Set<ResourceSet> getSets() {
+ return sets;
+ }
+
+ @Override
+ 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());
+
+ ResourceSet resourceSet = new ResourceSetImpl();
+ getSets().add(resourceSet);
+
+ // Standalone
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ UMLResourcesUtil.init(resourceSet);
+
+ // override wrong pathmap mapping in UMLResourcesUtil
+ final URL UMLJarredFileLocation = ResourcesPlugin.class.getResource("ResourcesPlugin.class");
+ String UMLJarPath = UMLJarredFileLocation.toString();
+ UMLJarPath = UMLJarPath.substring(0, UMLJarPath.indexOf('!'));
+
+ final Map<URI, URI> uriMap = URIConverter.URI_MAP;
+ uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI.createURI(UMLJarPath
+ + "!/libraries/"));
+ uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), URI.createURI(UMLJarPath
+ + "!/metamodels/"));
+ uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI.createURI(UMLJarPath + "!/profiles/"));
+ }
+
+ Resource resource = resourceSet.createResource(uri);
+ resource.load(str, Collections.emptyMap());
+ str.close();
+
+ return resource;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLProfileTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLProfileTest.java
index b0d94475f..de782e77c 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLProfileTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLProfileTest.java
@@ -1,42 +1,42 @@
-package org.eclipse.emf.compare.uml2.tests;
-
-import java.net.URL;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.uml2.uml.resources.ResourcesPlugin;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public abstract class AbstractUMLProfileTest extends AbstractUMLTest {
-
- @BeforeClass
- public static void addProfilePathmap() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- final URL UMLJarredFileLocation = ResourcesPlugin.class.getResource("ResourcesPlugin.class");
- String UMLJarPath = UMLJarredFileLocation.toString();
- UMLJarPath = UMLJarPath.substring(0, UMLJarPath.indexOf('!'));
- URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/"), URI
- .createURI(getProfilePath()));
- }
- }
-
- @AfterClass
- public static void resetProfilePathmap() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- URIConverter.URI_MAP.remove(URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/"));
- }
- }
-
- protected static String getProfilePath() {
- final String thisNamespace = "org.eclipse.emf.compare.uml2.tests";
- final URL thisClassLocation = AbstractUMLProfileTest.class.getResource(AbstractUMLProfileTest.class
- .getSimpleName()
- + ".class");
- String profilePath = thisClassLocation.toString();
- profilePath = profilePath.substring(0, profilePath.indexOf(thisNamespace) + thisNamespace.length());
- profilePath += "/model/";
- return profilePath;
- }
-}
+package org.eclipse.emf.compare.uml2.tests;
+
+import java.net.URL;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.uml2.uml.resources.ResourcesPlugin;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public abstract class AbstractUMLProfileTest extends AbstractUMLTest {
+
+ @BeforeClass
+ public static void addProfilePathmap() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ final URL UMLJarredFileLocation = ResourcesPlugin.class.getResource("ResourcesPlugin.class");
+ String UMLJarPath = UMLJarredFileLocation.toString();
+ UMLJarPath = UMLJarPath.substring(0, UMLJarPath.indexOf('!'));
+ URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/"), URI
+ .createURI(getProfilePath()));
+ }
+ }
+
+ @AfterClass
+ public static void resetProfilePathmap() {
+ if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
+ URIConverter.URI_MAP.remove(URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/"));
+ }
+ }
+
+ protected static String getProfilePath() {
+ final String thisNamespace = "org.eclipse.emf.compare.uml2.tests";
+ final URL thisClassLocation = AbstractUMLProfileTest.class.getResource(AbstractUMLProfileTest.class
+ .getSimpleName()
+ + ".class");
+ String profilePath = thisClassLocation.toString();
+ profilePath = profilePath.substring(0, profilePath.indexOf(thisNamespace) + thisNamespace.length());
+ profilePath += "/model/";
+ return profilePath;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/EMFCompareUML2TestsPlugin.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/EMFCompareUML2TestsPlugin.java
index 64134c571..dbb00e425 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/EMFCompareUML2TestsPlugin.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/EMFCompareUML2TestsPlugin.java
@@ -1,40 +1,40 @@
-/**
- * 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.uml2.tests;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class EMFCompareUML2TestsPlugin 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 {
- EMFCompareUML2TestsPlugin.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- EMFCompareUML2TestsPlugin.context = null;
- }
-
-}
+/**
+ * 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.uml2.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class EMFCompareUML2TestsPlugin 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 {
+ EMFCompareUML2TestsPlugin.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ EMFCompareUML2TestsPlugin.context = null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
index a16d10e19..d6e3a5919 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation2Test.java
@@ -1,375 +1,375 @@
-package org.eclipse.emf.compare.uml2.tests.association;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.AssociationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddAssociation2Test extends AbstractUMLTest {
-
- private AssociationInputData input = new AssociationInputData();
-
- @Test
- public void testA30UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA30UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testMergeLtRA30UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeLeftToRight(left, right, null);
- }
-
- @Test
- public void testA31UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA31UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testMergeLtRA31UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeLeftToRight(right, left, null);
- }
-
- @Test
- public void testA30UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA30UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testMergeLtRA30UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
- testMergeLeftToRight(left, right, right);
- }
-
- @Test
- public void testA31UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA31UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeRightToLeft(left, right, left);
- }
-
- @Test
- public void testMergeLtRA31UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- testMergeLeftToRight(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addAssociationDescription = null;
- Predicate<? super Diff> addPropertyClass1Description = null;
- Predicate<? super Diff> addPropertyClass0Description = null;
- Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
- Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass0Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass0Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass0Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addAssociationDescription = removed("model.class1_class0_0"); //$NON-NLS-1$
- addPropertyClass1Description = removedFromReference("model.class1_class0_0", "ownedEnd",
- "model.class1_class0_0.class1");
- addPropertyClass0Description = removedFromReference("model.Class1", "ownedAttribute",
- "model.Class1.class0");
- addPropertyClass0InAssociationDescription = removedFromReference("model.class1_class0_0",
- "memberEnd", "model.Class1.class0");
- addPropertyClass1InAssociationDescription = removedFromReference("model.class1_class0_0",
- "memberEnd", "model.class1_class0_0.class1");
- addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
- "association", "model.class1_class0_0", null);
- addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
- "model.Class1", null);
- addRefAssociationInPropertyClass0Description = changedReference("model.Class1.class0",
- "association", "model.class1_class0_0", null);
- addRefTypeInPropertyClass0Description = changedReference("model.Class1.class0", "type",
- "model.Class0", null);
- addLiteralIntegerInClass1Description = removedLowerValueIn("model.class1_class0_0.class1");
- addUnlimitedNaturalInClass1Description = removedUpperValueIn("model.class1_class0_0.class1");
- addLiteralIntegerInClass0Description = removedLowerValueIn("model.Class1.class0");
- addUnlimitedNaturalInClass0Description = removedUpperValueIn("model.Class1.class0");
- } else {
- addAssociationDescription = added("model.class1_class0_0"); //$NON-NLS-1$
- addPropertyClass1Description = addedToReference("model.class1_class0_0", "ownedEnd",
- "model.class1_class0_0.class1");
- addPropertyClass0Description = addedToReference("model.Class1", "ownedAttribute",
- "model.Class1.class0");
- addPropertyClass0InAssociationDescription = addedToReference("model.class1_class0_0",
- "memberEnd", "model.Class1.class0");
- addPropertyClass1InAssociationDescription = addedToReference("model.class1_class0_0",
- "memberEnd", "model.class1_class0_0.class1");
- addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
- "association", null, "model.class1_class0_0");
- addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
- null, "model.Class1");
- addRefAssociationInPropertyClass0Description = changedReference("model.Class1.class0",
- "association", null, "model.class1_class0_0");
- addRefTypeInPropertyClass0Description = changedReference("model.Class1.class0", "type", null,
- "model.Class0");
- addLiteralIntegerInClass1Description = addedLowerValueIn("model.class1_class0_0.class1");
- addUnlimitedNaturalInClass1Description = addedUpperValueIn("model.class1_class0_0.class1");
- addLiteralIntegerInClass0Description = addedLowerValueIn("model.Class1.class0");
- addUnlimitedNaturalInClass0Description = addedUpperValueIn("model.Class1.class0");
- }
-
- final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
- final Diff addPropertyClass1 = Iterators.find(differences.iterator(), addPropertyClass1Description);
- final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
- final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
- addPropertyClass0InAssociationDescription);
- final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
- addPropertyClass1InAssociationDescription);
- final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass1Description);
- final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass1Description);
- final Diff addRefAssociationInPropertyClass0 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass0Description);
- final Diff addRefTypeInPropertyClass0 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass0Description);
- final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass1Description);
- final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass1Description);
- final Diff addLiteralIntegerInClass0 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass0Description);
- final Diff addUnlimitedNaturalInClass0 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass0Description);
-
- assertNotNull(addAssociation);
- assertNotNull(addPropertyClass1);
- assertNotNull(addPropertyClass0);
- assertNotNull(addPropertyClass0InAssociation);
- assertNotNull(addPropertyClass1InAssociation);
- assertNotNull(addRefAssociationInPropertyClass1);
- assertNotNull(addRefTypeInPropertyClass1);
- assertNotNull(addRefAssociationInPropertyClass0);
- assertNotNull(addRefTypeInPropertyClass0);
- assertNotNull(addLiteralIntegerInClass1);
- assertNotNull(addUnlimitedNaturalInClass1);
- assertNotNull(addLiteralIntegerInClass0);
- assertNotNull(addUnlimitedNaturalInClass0);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
- Diff addUMLAssociation = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
-
- assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addPropertyClass1.getRequires().size()));
- assertTrue(addPropertyClass1.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addPropertyClass0InAssociation.getRequires()
- .size()));
- assertTrue(addPropertyClass0InAssociation.getRequires().contains(addPropertyClass0));
- assertTrue(addPropertyClass0InAssociation.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addPropertyClass1));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addPropertyClass0));
- assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass0.getRequires().contains(addPropertyClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertTrue(addLiteralIntegerInClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
- assertTrue(addLiteralIntegerInClass0.getRequires().contains(addPropertyClass0));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass0.getRequires().contains(addPropertyClass0));
- } else {
- assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass1.getRequires().size()));
- assertTrue(addPropertyClass1.getRequires().contains(addLiteralIntegerInClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addUnlimitedNaturalInClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addRefAssociationInPropertyClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
-
- assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
- assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addUnlimitedNaturalInClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addRefAssociationInPropertyClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addRefTypeInPropertyClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass1));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
- }
-
- assertNotNull(addPropertyClass0InAssociation.getEquivalence());
- assertTrue(addPropertyClass0InAssociation.getEquivalence().getDifferences().contains(
- addRefAssociationInPropertyClass0));
-
- testIntersections(comparison);
-
- }
-
- private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.association;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddAssociation2Test extends AbstractUMLTest {
+
+ private AssociationInputData input = new AssociationInputData();
+
+ @Test
+ public void testA30UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA30UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testMergeLtRA30UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeLeftToRight(left, right, null);
+ }
+
+ @Test
+ public void testA31UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA31UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testMergeLtRA31UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeLeftToRight(right, left, null);
+ }
+
+ @Test
+ public void testA30UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA30UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testMergeLtRA30UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+ testMergeLeftToRight(left, right, right);
+ }
+
+ @Test
+ public void testA31UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA31UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeRightToLeft(left, right, left);
+ }
+
+ @Test
+ public void testMergeLtRA31UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ testMergeLeftToRight(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addAssociationDescription = null;
+ Predicate<? super Diff> addPropertyClass1Description = null;
+ Predicate<? super Diff> addPropertyClass0Description = null;
+ Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
+ Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass0Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass0Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass0Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAssociationDescription = removed("model.class1_class0_0"); //$NON-NLS-1$
+ addPropertyClass1Description = removedFromReference("model.class1_class0_0", "ownedEnd",
+ "model.class1_class0_0.class1");
+ addPropertyClass0Description = removedFromReference("model.Class1", "ownedAttribute",
+ "model.Class1.class0");
+ addPropertyClass0InAssociationDescription = removedFromReference("model.class1_class0_0",
+ "memberEnd", "model.Class1.class0");
+ addPropertyClass1InAssociationDescription = removedFromReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.class1");
+ addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
+ "association", "model.class1_class0_0", null);
+ addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
+ "model.Class1", null);
+ addRefAssociationInPropertyClass0Description = changedReference("model.Class1.class0",
+ "association", "model.class1_class0_0", null);
+ addRefTypeInPropertyClass0Description = changedReference("model.Class1.class0", "type",
+ "model.Class0", null);
+ addLiteralIntegerInClass1Description = removedLowerValueIn("model.class1_class0_0.class1");
+ addUnlimitedNaturalInClass1Description = removedUpperValueIn("model.class1_class0_0.class1");
+ addLiteralIntegerInClass0Description = removedLowerValueIn("model.Class1.class0");
+ addUnlimitedNaturalInClass0Description = removedUpperValueIn("model.Class1.class0");
+ } else {
+ addAssociationDescription = added("model.class1_class0_0"); //$NON-NLS-1$
+ addPropertyClass1Description = addedToReference("model.class1_class0_0", "ownedEnd",
+ "model.class1_class0_0.class1");
+ addPropertyClass0Description = addedToReference("model.Class1", "ownedAttribute",
+ "model.Class1.class0");
+ addPropertyClass0InAssociationDescription = addedToReference("model.class1_class0_0",
+ "memberEnd", "model.Class1.class0");
+ addPropertyClass1InAssociationDescription = addedToReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.class1");
+ addRefAssociationInPropertyClass1Description = changedReference("model.class1_class0_0.class1",
+ "association", null, "model.class1_class0_0");
+ addRefTypeInPropertyClass1Description = changedReference("model.class1_class0_0.class1", "type",
+ null, "model.Class1");
+ addRefAssociationInPropertyClass0Description = changedReference("model.Class1.class0",
+ "association", null, "model.class1_class0_0");
+ addRefTypeInPropertyClass0Description = changedReference("model.Class1.class0", "type", null,
+ "model.Class0");
+ addLiteralIntegerInClass1Description = addedLowerValueIn("model.class1_class0_0.class1");
+ addUnlimitedNaturalInClass1Description = addedUpperValueIn("model.class1_class0_0.class1");
+ addLiteralIntegerInClass0Description = addedLowerValueIn("model.Class1.class0");
+ addUnlimitedNaturalInClass0Description = addedUpperValueIn("model.Class1.class0");
+ }
+
+ final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
+ final Diff addPropertyClass1 = Iterators.find(differences.iterator(), addPropertyClass1Description);
+ final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
+ final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass0InAssociationDescription);
+ final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass1InAssociationDescription);
+ final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass1Description);
+ final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass1Description);
+ final Diff addRefAssociationInPropertyClass0 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass0Description);
+ final Diff addRefTypeInPropertyClass0 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass0Description);
+ final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass1Description);
+ final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass1Description);
+ final Diff addLiteralIntegerInClass0 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass0Description);
+ final Diff addUnlimitedNaturalInClass0 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass0Description);
+
+ assertNotNull(addAssociation);
+ assertNotNull(addPropertyClass1);
+ assertNotNull(addPropertyClass0);
+ assertNotNull(addPropertyClass0InAssociation);
+ assertNotNull(addPropertyClass1InAssociation);
+ assertNotNull(addRefAssociationInPropertyClass1);
+ assertNotNull(addRefTypeInPropertyClass1);
+ assertNotNull(addRefAssociationInPropertyClass0);
+ assertNotNull(addRefTypeInPropertyClass0);
+ assertNotNull(addLiteralIntegerInClass1);
+ assertNotNull(addUnlimitedNaturalInClass1);
+ assertNotNull(addLiteralIntegerInClass0);
+ assertNotNull(addUnlimitedNaturalInClass0);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
+ Diff addUMLAssociation = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLAssociation);
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addPropertyClass1.getRequires().size()));
+ assertTrue(addPropertyClass1.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addPropertyClass0InAssociation.getRequires()
+ .size()));
+ assertTrue(addPropertyClass0InAssociation.getRequires().contains(addPropertyClass0));
+ assertTrue(addPropertyClass0InAssociation.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addPropertyClass1));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addPropertyClass0));
+ assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass0.getRequires().contains(addPropertyClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass0.getRequires().contains(addPropertyClass0));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass0.getRequires().contains(addPropertyClass0));
+ } else {
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass1.getRequires().size()));
+ assertTrue(addPropertyClass1.getRequires().contains(addLiteralIntegerInClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addUnlimitedNaturalInClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
+ assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addUnlimitedNaturalInClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addRefTypeInPropertyClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass1));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
+ }
+
+ assertNotNull(addPropertyClass0InAssociation.getEquivalence());
+ assertTrue(addPropertyClass0InAssociation.getEquivalence().getDifferences().contains(
+ addRefAssociationInPropertyClass0));
+
+ testIntersections(comparison);
+
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
index 353429e45..abf19ece8 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociation3Test.java
@@ -1,374 +1,374 @@
-package org.eclipse.emf.compare.uml2.tests.association;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.AssociationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddAssociation3Test extends AbstractUMLTest {
-
- private AssociationInputData input = new AssociationInputData();
-
- @Test
- public void testA40UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA40UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testMergeLtRA40UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeLeftToRight(left, right, null);
- }
-
- @Test
- public void testA41UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA41UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testMergeLtRA41UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeLeftToRight(right, left, null);
- }
-
- @Test
- public void testA40UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA40UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testMergeLtRA40UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeLeftToRight(left, right, right);
- }
-
- @Test
- public void testA41UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA41UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeRightToLeft(left, right, left);
- }
-
- @Test
- public void testMergeLtRA41UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Left();
-
- testMergeLeftToRight(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addAssociationDescription = null;
- Predicate<? super Diff> addPropertyClass1Description = null;
- Predicate<? super Diff> addPropertyClass0Description = null;
- Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
- Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass0Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass0Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass0Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addAssociationDescription = removed("model.AssociationClass0"); //$NON-NLS-1$
- addPropertyClass1Description = removedFromReference("model.Class0", "ownedAttribute",
- "model.Class0.class1");
- addPropertyClass0Description = removedFromReference("model.AssociationClass0", "ownedEnd",
- "model.AssociationClass0.class0");
- addPropertyClass1InAssociationDescription = removedFromReference("model.AssociationClass0",
- "memberEnd", "model.Class0.class1");
- addPropertyClass0InAssociationDescription = removedFromReference("model.AssociationClass0",
- "memberEnd", "model.AssociationClass0.class0");
- addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
- "association", "model.AssociationClass0", null);
- addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type",
- "model.Class1", null);
- addRefAssociationInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
- "association", "model.AssociationClass0", null);
- addRefTypeInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
- "type", "model.Class0", null);
- addLiteralIntegerInClass1Description = removedLowerValueIn("model.Class0.class1");
- addUnlimitedNaturalInClass1Description = removedUpperValueIn("model.Class0.class1");
- addLiteralIntegerInClass0Description = removedLowerValueIn("model.AssociationClass0.class0");
- addUnlimitedNaturalInClass0Description = removedUpperValueIn("model.AssociationClass0.class0");
- } else {
- addAssociationDescription = added("model.AssociationClass0"); //$NON-NLS-1$
- addPropertyClass1Description = addedToReference("model.Class0", "ownedAttribute",
- "model.Class0.class1");
- addPropertyClass0Description = addedToReference("model.AssociationClass0", "ownedEnd",
- "model.AssociationClass0.class0");
- addPropertyClass1InAssociationDescription = addedToReference("model.AssociationClass0",
- "memberEnd", "model.Class0.class1");
- addPropertyClass0InAssociationDescription = addedToReference("model.AssociationClass0",
- "memberEnd", "model.AssociationClass0.class0");
- addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
- "association", null, "model.AssociationClass0");
- addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type", null,
- "model.Class1");
- addRefAssociationInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
- "association", null, "model.AssociationClass0");
- addRefTypeInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
- "type", null, "model.Class0");
- addLiteralIntegerInClass1Description = addedLowerValueIn("model.Class0.class1");
- addUnlimitedNaturalInClass1Description = addedUpperValueIn("model.Class0.class1");
- addLiteralIntegerInClass0Description = addedLowerValueIn("model.AssociationClass0.class0");
- addUnlimitedNaturalInClass0Description = addedUpperValueIn("model.AssociationClass0.class0");
- }
-
- final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
- final Diff addPropertyClass1 = Iterators.find(differences.iterator(), addPropertyClass1Description);
- final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
- final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
- addPropertyClass1InAssociationDescription);
- final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
- addPropertyClass0InAssociationDescription);
- final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass1Description);
- final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass1Description);
- final Diff addRefAssociationInPropertyClass0 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass0Description);
- final Diff addRefTypeInPropertyClass0 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass0Description);
- final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass1Description);
- final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass1Description);
- final Diff addLiteralIntegerInClass0 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass0Description);
- final Diff addUnlimitedNaturalInClass0 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass0Description);
- // duplicate diff: Association.memberEnd to class0
-
- assertNotNull(addAssociation);
- assertNotNull(addPropertyClass1);
- assertNotNull(addPropertyClass0);
- assertNotNull(addPropertyClass1InAssociation);
- assertNotNull(addRefAssociationInPropertyClass1);
- assertNotNull(addRefTypeInPropertyClass1);
- assertNotNull(addRefAssociationInPropertyClass0);
- assertNotNull(addRefTypeInPropertyClass0);
- assertNotNull(addLiteralIntegerInClass1);
- assertNotNull(addUnlimitedNaturalInClass1);
- assertNotNull(addLiteralIntegerInClass0);
- assertNotNull(addUnlimitedNaturalInClass0);
- assertNotNull(addPropertyClass0InAssociation);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
- Diff addUMLAssociation = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addPropertyClass0.getRequires().size()));
- assertTrue(addPropertyClass0.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass1.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addPropertyClass1InAssociation.getRequires()
- .size()));
- assertTrue(addPropertyClass1InAssociation.getRequires().contains(addPropertyClass1));
- assertTrue(addPropertyClass1InAssociation.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addPropertyClass1));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addPropertyClass0));
- assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass0.getRequires().contains(addPropertyClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertTrue(addLiteralIntegerInClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addPropertyClass1));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
- assertTrue(addLiteralIntegerInClass0.getRequires().contains(addPropertyClass0));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass0.getRequires().contains(addPropertyClass0));
- } else {
- assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass1.getRequires().size()));
- assertTrue(addPropertyClass1.getRequires().contains(addLiteralIntegerInClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addUnlimitedNaturalInClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addRefAssociationInPropertyClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
- assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
-
- assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
- assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addUnlimitedNaturalInClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addRefAssociationInPropertyClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addRefTypeInPropertyClass0));
- assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass0));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
- assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
- }
-
- assertNotNull(addPropertyClass1InAssociation.getEquivalence());
- assertTrue(addPropertyClass1InAssociation.getEquivalence().getDifferences().contains(
- addRefAssociationInPropertyClass1));
-
- testIntersections(comparison);
- }
-
- private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.association;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddAssociation3Test extends AbstractUMLTest {
+
+ private AssociationInputData input = new AssociationInputData();
+
+ @Test
+ public void testA40UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA40UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testMergeLtRA40UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeLeftToRight(left, right, null);
+ }
+
+ @Test
+ public void testA41UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA41UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testMergeLtRA41UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeLeftToRight(right, left, null);
+ }
+
+ @Test
+ public void testA40UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA40UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testMergeLtRA40UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeLeftToRight(left, right, right);
+ }
+
+ @Test
+ public void testA41UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA41UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeRightToLeft(left, right, left);
+ }
+
+ @Test
+ public void testMergeLtRA41UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Left();
+
+ testMergeLeftToRight(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addAssociationDescription = null;
+ Predicate<? super Diff> addPropertyClass1Description = null;
+ Predicate<? super Diff> addPropertyClass0Description = null;
+ Predicate<? super Diff> addPropertyClass1InAssociationDescription = null;
+ Predicate<? super Diff> addPropertyClass0InAssociationDescription = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass0Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass0Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass0Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass0Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAssociationDescription = removed("model.AssociationClass0"); //$NON-NLS-1$
+ addPropertyClass1Description = removedFromReference("model.Class0", "ownedAttribute",
+ "model.Class0.class1");
+ addPropertyClass0Description = removedFromReference("model.AssociationClass0", "ownedEnd",
+ "model.AssociationClass0.class0");
+ addPropertyClass1InAssociationDescription = removedFromReference("model.AssociationClass0",
+ "memberEnd", "model.Class0.class1");
+ addPropertyClass0InAssociationDescription = removedFromReference("model.AssociationClass0",
+ "memberEnd", "model.AssociationClass0.class0");
+ addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
+ "association", "model.AssociationClass0", null);
+ addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type",
+ "model.Class1", null);
+ addRefAssociationInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
+ "association", "model.AssociationClass0", null);
+ addRefTypeInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
+ "type", "model.Class0", null);
+ addLiteralIntegerInClass1Description = removedLowerValueIn("model.Class0.class1");
+ addUnlimitedNaturalInClass1Description = removedUpperValueIn("model.Class0.class1");
+ addLiteralIntegerInClass0Description = removedLowerValueIn("model.AssociationClass0.class0");
+ addUnlimitedNaturalInClass0Description = removedUpperValueIn("model.AssociationClass0.class0");
+ } else {
+ addAssociationDescription = added("model.AssociationClass0"); //$NON-NLS-1$
+ addPropertyClass1Description = addedToReference("model.Class0", "ownedAttribute",
+ "model.Class0.class1");
+ addPropertyClass0Description = addedToReference("model.AssociationClass0", "ownedEnd",
+ "model.AssociationClass0.class0");
+ addPropertyClass1InAssociationDescription = addedToReference("model.AssociationClass0",
+ "memberEnd", "model.Class0.class1");
+ addPropertyClass0InAssociationDescription = addedToReference("model.AssociationClass0",
+ "memberEnd", "model.AssociationClass0.class0");
+ addRefAssociationInPropertyClass1Description = changedReference("model.Class0.class1",
+ "association", null, "model.AssociationClass0");
+ addRefTypeInPropertyClass1Description = changedReference("model.Class0.class1", "type", null,
+ "model.Class1");
+ addRefAssociationInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
+ "association", null, "model.AssociationClass0");
+ addRefTypeInPropertyClass0Description = changedReference("model.AssociationClass0.class0",
+ "type", null, "model.Class0");
+ addLiteralIntegerInClass1Description = addedLowerValueIn("model.Class0.class1");
+ addUnlimitedNaturalInClass1Description = addedUpperValueIn("model.Class0.class1");
+ addLiteralIntegerInClass0Description = addedLowerValueIn("model.AssociationClass0.class0");
+ addUnlimitedNaturalInClass0Description = addedUpperValueIn("model.AssociationClass0.class0");
+ }
+
+ final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
+ final Diff addPropertyClass1 = Iterators.find(differences.iterator(), addPropertyClass1Description);
+ final Diff addPropertyClass0 = Iterators.find(differences.iterator(), addPropertyClass0Description);
+ final Diff addPropertyClass1InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass1InAssociationDescription);
+ final Diff addPropertyClass0InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass0InAssociationDescription);
+ final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass1Description);
+ final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass1Description);
+ final Diff addRefAssociationInPropertyClass0 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass0Description);
+ final Diff addRefTypeInPropertyClass0 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass0Description);
+ final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass1Description);
+ final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass1Description);
+ final Diff addLiteralIntegerInClass0 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass0Description);
+ final Diff addUnlimitedNaturalInClass0 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass0Description);
+ // duplicate diff: Association.memberEnd to class0
+
+ assertNotNull(addAssociation);
+ assertNotNull(addPropertyClass1);
+ assertNotNull(addPropertyClass0);
+ assertNotNull(addPropertyClass1InAssociation);
+ assertNotNull(addRefAssociationInPropertyClass1);
+ assertNotNull(addRefTypeInPropertyClass1);
+ assertNotNull(addRefAssociationInPropertyClass0);
+ assertNotNull(addRefTypeInPropertyClass0);
+ assertNotNull(addLiteralIntegerInClass1);
+ assertNotNull(addUnlimitedNaturalInClass1);
+ assertNotNull(addLiteralIntegerInClass0);
+ assertNotNull(addUnlimitedNaturalInClass0);
+ assertNotNull(addPropertyClass0InAssociation);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
+ Diff addUMLAssociation = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLAssociation);
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addPropertyClass0InAssociation));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addPropertyClass0.getRequires().size()));
+ assertTrue(addPropertyClass0.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass1.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addPropertyClass1InAssociation.getRequires()
+ .size()));
+ assertTrue(addPropertyClass1InAssociation.getRequires().contains(addPropertyClass1));
+ assertTrue(addPropertyClass1InAssociation.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addPropertyClass1));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addPropertyClass0));
+ assertTrue(addRefAssociationInPropertyClass0.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass0.getRequires().contains(addPropertyClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addPropertyClass1));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass0.getRequires().contains(addPropertyClass0));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass0.getRequires().contains(addPropertyClass0));
+ } else {
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass1.getRequires().size()));
+ assertTrue(addPropertyClass1.getRequires().contains(addLiteralIntegerInClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addUnlimitedNaturalInClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addRefTypeInPropertyClass1));
+ assertTrue(addPropertyClass1.getRequires().contains(addPropertyClass1InAssociation));
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass0.getRequires().size()));
+ assertTrue(addPropertyClass0.getRequires().contains(addLiteralIntegerInClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addUnlimitedNaturalInClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addRefTypeInPropertyClass0));
+ assertTrue(addPropertyClass0.getRequires().contains(addPropertyClass0InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass0.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(addAssociation.getRequires().size()));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass0));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass0));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addPropertyClass0InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass0.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass0.getRequires().size()));
+ }
+
+ assertNotNull(addPropertyClass1InAssociation.getEquivalence());
+ assertTrue(addPropertyClass1InAssociation.getEquivalence().getDifferences().contains(
+ addRefAssociationInPropertyClass1));
+
+ testIntersections(comparison);
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
index 8145129ae..beb4b04e5 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/AddAssociationTest.java
@@ -1,389 +1,389 @@
-package org.eclipse.emf.compare.uml2.tests.association;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.AssociationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddAssociationTest extends AbstractUMLTest {
-
- private AssociationInputData input = new AssociationInputData();
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testMergeLtRA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeLeftToRight(left, right, null);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA11UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testMergeLtRA11UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- testMergeLeftToRight(left, right, null);
- }
-
- @Test
- public void testA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testMergeLtRA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeLeftToRight(left, right, right);
- }
-
- @Test
- public void testA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeRightToLeft(left, right, left);
- }
-
- @Test
- public void testMergeLtRA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- testMergeLeftToRight(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 16 differences
- assertSame(Integer.valueOf(16), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addAssociationDescription = null;
- Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
- Predicate<? super Diff> addNavigableOwnedEndClass2InAssociationDescription = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
- Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
- Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
- Predicate<? super Diff> addOwnedEndClass1Description = null;
- Predicate<? super Diff> addOwnedEndClass2Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
- addNavigableOwnedEndClass1InAssociationDescription = removedFromReference(
- "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
- addNavigableOwnedEndClass2InAssociationDescription = removedFromReference(
- "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
- addRefAssociationInPropertyClass1Description = changedReference(
- "myModel.class1sToClass2s.class1s", "association", "myModel.class1sToClass2s", null);
- addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
- "type", "myModel.Class1", null);
- addRefAssociationInPropertyClass2Description = changedReference(
- "myModel.class1sToClass2s.class2s", "association", "myModel.class1sToClass2s", null);
- addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
- "type", "myModel.Class2", null);
- addLiteralIntegerInClass1Description = removedLowerValueIn("myModel.class1sToClass2s.class1s");
- addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
- addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
- addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
- addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class1s");
- addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class2s");
- addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class1s");
- addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class2s");
- } else {
- addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
- addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
- addNavigableOwnedEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
- addRefAssociationInPropertyClass1Description = changedReference(
- "myModel.class1sToClass2s.class1s", "association", null, "myModel.class1sToClass2s");
- addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
- "type", null, "myModel.Class1");
- addRefAssociationInPropertyClass2Description = changedReference(
- "myModel.class1sToClass2s.class2s", "association", null, "myModel.class1sToClass2s");
- addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
- "type", null, "myModel.Class2");
- addLiteralIntegerInClass1Description = addedLowerValueIn("myModel.class1sToClass2s.class1s");
- addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
- addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
- addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
- addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class1s");
- addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class2s");
- addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class1s");
- addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class2s");
- }
-
- final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
- final Diff addNavigableOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
- addNavigableOwnedEndClass1InAssociationDescription);
- final Diff addNavigableOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
- addNavigableOwnedEndClass2InAssociationDescription);
- final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass1Description);
- final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass1Description);
- final Diff addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass2Description);
- final Diff addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass2Description);
- final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass1Description);
- final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass1Description);
- final Diff addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass2Description);
- final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass2Description);
- final Diff addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
- addMemberEndClass1InAssociationDescription);
- final Diff addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
- addMemberEndClass2InAssociationDescription);
- final Diff addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
- addOwnedEndClass1Description);
- final Diff addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
- addOwnedEndClass2Description);
-
- assertNotNull(addNavigableOwnedEndClass1InAssociation);
- assertNotNull(addNavigableOwnedEndClass2InAssociation);
- assertNotNull(addAssociation);
- assertNotNull(addRefAssociationInPropertyClass1);
- assertNotNull(addRefTypeInPropertyClass1);
- assertNotNull(addRefAssociationInPropertyClass2);
- assertNotNull(addRefTypeInPropertyClass2);
- assertNotNull(addLiteralIntegerInClass1);
- assertNotNull(addUnlimitedNaturalInClass1);
- assertNotNull(addLiteralIntegerInClass2);
- assertNotNull(addUnlimitedNaturalInClass2);
- assertNotNull(addMemberEndClass1InAssociation);
- assertNotNull(addMemberEndClass2InAssociation);
- assertNotNull(addOwnedEndClass1InAssociation);
- assertNotNull(addOwnedEndClass2InAssociation);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
- Diff addUMLAssociation = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLAssociation);
- assertSame(Integer.valueOf(15), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass1InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass2InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass2));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass1InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass2InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass1InAssociation));
- assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass2InAssociation));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(
- addOwnedEndClass1InAssociation));
- assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addOwnedEndClass1InAssociation));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(
- addOwnedEndClass2InAssociation));
- assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(addAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass2.getRequires().contains(addOwnedEndClass2InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
- .getRequires().size()));
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(addAssociation));
- assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
- addOwnedEndClass1InAssociation));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
- .getRequires().size()));
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(addAssociation));
- assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
- addOwnedEndClass2InAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertTrue(addLiteralIntegerInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
- assertTrue(addLiteralIntegerInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
- .getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
- .getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
-
- assertSame(Integer.valueOf(8), Integer.valueOf(addAssociation.getRequires().size()));
- assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass1InAssociation));
- assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass2InAssociation));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
- assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass2));
- assertTrue(addAssociation.getRequires().contains(addOwnedEndClass1InAssociation));
- assertTrue(addAssociation.getRequires().contains(addOwnedEndClass2InAssociation));
- assertTrue(addAssociation.getRequires().contains(addMemberEndClass1InAssociation));
- assertTrue(addAssociation.getRequires().contains(addMemberEndClass2InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
-
- testIntersections(comparison);
- }
- }
-
- private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.association;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddAssociationTest extends AbstractUMLTest {
+
+ private AssociationInputData input = new AssociationInputData();
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testMergeLtRA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeLeftToRight(left, right, null);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA11UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testMergeLtRA11UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ testMergeLeftToRight(left, right, null);
+ }
+
+ @Test
+ public void testA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testMergeLtRA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeLeftToRight(left, right, right);
+ }
+
+ @Test
+ public void testA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeRightToLeft(left, right, left);
+ }
+
+ @Test
+ public void testMergeLtRA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ testMergeLeftToRight(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 16 differences
+ assertSame(Integer.valueOf(16), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
+ Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addOwnedEndClass1Description = null;
+ Predicate<? super Diff> addOwnedEndClass2Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", "myModel.Class1", null);
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", "myModel.Class2", null);
+ addLiteralIntegerInClass1Description = removedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ } else {
+ addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", null, "myModel.Class1");
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", null, "myModel.Class2");
+ addLiteralIntegerInClass1Description = addedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ }
+
+ final Diff addAssociation = Iterators.find(differences.iterator(), addAssociationDescription);
+ final Diff addNavigableOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass1InAssociationDescription);
+ final Diff addNavigableOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass2InAssociationDescription);
+ final Diff addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass1Description);
+ final Diff addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass1Description);
+ final Diff addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass2Description);
+ final Diff addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass2Description);
+ final Diff addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass1Description);
+ final Diff addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass1Description);
+ final Diff addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass2Description);
+ final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass2Description);
+ final Diff addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass1InAssociationDescription);
+ final Diff addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass2InAssociationDescription);
+ final Diff addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass1Description);
+ final Diff addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass2Description);
+
+ assertNotNull(addNavigableOwnedEndClass1InAssociation);
+ assertNotNull(addNavigableOwnedEndClass2InAssociation);
+ assertNotNull(addAssociation);
+ assertNotNull(addRefAssociationInPropertyClass1);
+ assertNotNull(addRefTypeInPropertyClass1);
+ assertNotNull(addRefAssociationInPropertyClass2);
+ assertNotNull(addRefTypeInPropertyClass2);
+ assertNotNull(addLiteralIntegerInClass1);
+ assertNotNull(addUnlimitedNaturalInClass1);
+ assertNotNull(addLiteralIntegerInClass2);
+ assertNotNull(addUnlimitedNaturalInClass2);
+ assertNotNull(addMemberEndClass1InAssociation);
+ assertNotNull(addMemberEndClass2InAssociation);
+ assertNotNull(addOwnedEndClass1InAssociation);
+ assertNotNull(addOwnedEndClass2InAssociation);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(AssociationChange.class)));
+ Diff addUMLAssociation = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLAssociation);
+ assertSame(Integer.valueOf(15), Integer.valueOf(addUMLAssociation.getRefinedBy().size()));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addNavigableOwnedEndClass2InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass2));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass1));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addMemberEndClass2InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass1InAssociation));
+ assertTrue(addUMLAssociation.getRefinedBy().contains(addOwnedEndClass2InAssociation));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(
+ addOwnedEndClass1InAssociation));
+ assertTrue(addRefAssociationInPropertyClass1.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass1.getRequires().contains(addOwnedEndClass1InAssociation));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(
+ addOwnedEndClass2InAssociation));
+ assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(addAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass2.getRequires().contains(addOwnedEndClass2InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
+ .getRequires().size()));
+ assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(addAssociation));
+ assertTrue(addNavigableOwnedEndClass1InAssociation.getRequires().contains(
+ addOwnedEndClass1InAssociation));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
+ .getRequires().size()));
+ assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(addAssociation));
+ assertTrue(addNavigableOwnedEndClass2InAssociation.getRequires().contains(
+ addOwnedEndClass2InAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass1.getRequires().contains(addOwnedEndClass1InAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addOwnedEndClass2InAssociation));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass1InAssociation
+ .getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addNavigableOwnedEndClass2InAssociation
+ .getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass1.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
+
+ assertSame(Integer.valueOf(8), Integer.valueOf(addAssociation.getRequires().size()));
+ assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addNavigableOwnedEndClass2InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass1));
+ assertTrue(addAssociation.getRequires().contains(addRefAssociationInPropertyClass2));
+ assertTrue(addAssociation.getRequires().contains(addOwnedEndClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addOwnedEndClass2InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addMemberEndClass1InAssociation));
+ assertTrue(addAssociation.getRequires().contains(addMemberEndClass2InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass1.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
+
+ testIntersections(comparison);
+ }
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
index 20f1b8902..fbf2eb751 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/ChangeAssociationTest.java
@@ -1,265 +1,265 @@
-package org.eclipse.emf.compare.uml2.tests.association;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.AssociationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ChangeAssociationTest extends AbstractUMLTest {
-
- private AssociationInputData input = new AssociationInputData();
-
- @Test
- public void testA20UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA20UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testMergeLtRA20UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeLeftToRight(left, right, null);
- }
-
- @Test
- public void testA21UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA21UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testMergeLtRA21UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeLeftToRight(right, left, null);
- }
-
- @Test
- public void testA20UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testMergeRtLA20UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testMergeLtRA20UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeLeftToRight(left, right, right);
- }
-
- @Test
- public void testA21UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testMergeRtLA21UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeRightToLeft(left, right, left);
- }
-
- @Test
- public void testMergeLtRA21UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Left();
-
- testMergeLeftToRight(left, right, left);
- }
-
- private void testAB1(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(6), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addPropertyClass2Description = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
- Predicate<? super Diff> addPropertyClass2InAssociationDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addPropertyClass2Description = removedFromReference("model.class1_class0_0", "ownedEnd",
- "model.class1_class0_0.Class2");
- addRefAssociationInPropertyClass2Description = changedReference("model.class1_class0_0.Class2",
- "association", "model.class1_class0_0", null);
- addRefTypeInPropertyClass2Description = changedReference("model.class1_class0_0.Class2", "type",
- "model.Class2", null);
- addLiteralIntegerInClass2Description = removedLowerValueIn("model.class1_class0_0.Class2");
- addUnlimitedNaturalInClass2Description = removedUpperValueIn("model.class1_class0_0.Class2");
- addPropertyClass2InAssociationDescription = removedFromReference("model.class1_class0_0",
- "memberEnd", "model.class1_class0_0.Class2");
- } else {
- addPropertyClass2Description = addedToReference("model.class1_class0_0", "ownedEnd",
- "model.class1_class0_0.Class2");
- addRefAssociationInPropertyClass2Description = changedReference("model.class1_class0_0.Class2",
- "association", null, "model.class1_class0_0");
- addRefTypeInPropertyClass2Description = changedReference("model.class1_class0_0.Class2", "type",
- null, "model.Class2");
- addLiteralIntegerInClass2Description = addedLowerValueIn("model.class1_class0_0.Class2");
- addUnlimitedNaturalInClass2Description = addedUpperValueIn("model.class1_class0_0.Class2");
- addPropertyClass2InAssociationDescription = addedToReference("model.class1_class0_0",
- "memberEnd", "model.class1_class0_0.Class2");
- }
-
- final Diff addPropertyClass2 = Iterators.find(differences.iterator(), addPropertyClass2Description);
- final Diff addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass2Description);
- final Diff addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass2Description);
- final Diff addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass2Description);
- final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass2Description);
- final Diff addPropertyClass2InAssociation = Iterators.find(differences.iterator(),
- addPropertyClass2InAssociationDescription);
-
- assertNotNull(addPropertyClass2);
- assertNotNull(addRefAssociationInPropertyClass2);
- assertNotNull(addRefTypeInPropertyClass2);
- assertNotNull(addLiteralIntegerInClass2);
- assertNotNull(addUnlimitedNaturalInClass2);
- assertNotNull(addPropertyClass2InAssociation);
-
- // CHECK EXTENSION
- // No extension anymore
- assertSame(Integer.valueOf(0), count(differences, instanceOf(AssociationChange.class)));
- Diff changeUMLAssociation = Iterators.find(differences.iterator(), and(
- instanceOf(AssociationChange.class), ofKind(DifferenceKind.CHANGE)), null);
- assertNull(changeUMLAssociation);
- // assertNotNull(changeUMLAssociation);
- // assertSame(Integer.valueOf(5), Integer.valueOf(changeUMLAssociation.getRefinedBy().size()));
- // assertTrue(changeUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass2));
- // assertTrue(changeUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2));
- // assertTrue(changeUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
- // assertTrue(changeUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2));
- // assertTrue(changeUMLAssociation.getRefinedBy().contains(addPropertyClass2));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass2.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
- .size()));
- assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(addPropertyClass2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
- assertTrue(addRefTypeInPropertyClass2.getRequires().contains(addPropertyClass2));
-
- // assertSame(Integer.valueOf(0), Integer.valueOf(changeUMLAssociation.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
- assertTrue(addLiteralIntegerInClass2.getRequires().contains(addPropertyClass2));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
- assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addPropertyClass2));
- } else {
- assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass2.getRequires().size()));
- assertTrue(addPropertyClass2.getRequires().contains(addLiteralIntegerInClass2));
- assertTrue(addPropertyClass2.getRequires().contains(addUnlimitedNaturalInClass2));
- assertTrue(addPropertyClass2.getRequires().contains(addRefAssociationInPropertyClass2));
- assertTrue(addPropertyClass2.getRequires().contains(addRefTypeInPropertyClass2));
- assertTrue(addPropertyClass2.getRequires().contains(addPropertyClass2InAssociation));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
- // assertSame(Integer.valueOf(0), Integer.valueOf(changeUMLAssociation.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
- }
-
- testIntersections(comparison);
- }
-
- private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.association;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.association.data.AssociationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ChangeAssociationTest extends AbstractUMLTest {
+
+ private AssociationInputData input = new AssociationInputData();
+
+ @Test
+ public void testA20UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA20UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testMergeLtRA20UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeLeftToRight(left, right, null);
+ }
+
+ @Test
+ public void testA21UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA21UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testMergeLtRA21UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeLeftToRight(right, left, null);
+ }
+
+ @Test
+ public void testA20UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA20UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testMergeLtRA20UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeLeftToRight(left, right, right);
+ }
+
+ @Test
+ public void testA21UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testMergeRtLA21UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeRightToLeft(left, right, left);
+ }
+
+ @Test
+ public void testMergeLtRA21UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Left();
+
+ testMergeLeftToRight(left, right, left);
+ }
+
+ private void testAB1(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(6), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addPropertyClass2Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
+ Predicate<? super Diff> addPropertyClass2InAssociationDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addPropertyClass2Description = removedFromReference("model.class1_class0_0", "ownedEnd",
+ "model.class1_class0_0.Class2");
+ addRefAssociationInPropertyClass2Description = changedReference("model.class1_class0_0.Class2",
+ "association", "model.class1_class0_0", null);
+ addRefTypeInPropertyClass2Description = changedReference("model.class1_class0_0.Class2", "type",
+ "model.Class2", null);
+ addLiteralIntegerInClass2Description = removedLowerValueIn("model.class1_class0_0.Class2");
+ addUnlimitedNaturalInClass2Description = removedUpperValueIn("model.class1_class0_0.Class2");
+ addPropertyClass2InAssociationDescription = removedFromReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.Class2");
+ } else {
+ addPropertyClass2Description = addedToReference("model.class1_class0_0", "ownedEnd",
+ "model.class1_class0_0.Class2");
+ addRefAssociationInPropertyClass2Description = changedReference("model.class1_class0_0.Class2",
+ "association", null, "model.class1_class0_0");
+ addRefTypeInPropertyClass2Description = changedReference("model.class1_class0_0.Class2", "type",
+ null, "model.Class2");
+ addLiteralIntegerInClass2Description = addedLowerValueIn("model.class1_class0_0.Class2");
+ addUnlimitedNaturalInClass2Description = addedUpperValueIn("model.class1_class0_0.Class2");
+ addPropertyClass2InAssociationDescription = addedToReference("model.class1_class0_0",
+ "memberEnd", "model.class1_class0_0.Class2");
+ }
+
+ final Diff addPropertyClass2 = Iterators.find(differences.iterator(), addPropertyClass2Description);
+ final Diff addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass2Description);
+ final Diff addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass2Description);
+ final Diff addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass2Description);
+ final Diff addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass2Description);
+ final Diff addPropertyClass2InAssociation = Iterators.find(differences.iterator(),
+ addPropertyClass2InAssociationDescription);
+
+ assertNotNull(addPropertyClass2);
+ assertNotNull(addRefAssociationInPropertyClass2);
+ assertNotNull(addRefTypeInPropertyClass2);
+ assertNotNull(addLiteralIntegerInClass2);
+ assertNotNull(addUnlimitedNaturalInClass2);
+ assertNotNull(addPropertyClass2InAssociation);
+
+ // CHECK EXTENSION
+ // No extension anymore
+ assertSame(Integer.valueOf(0), count(differences, instanceOf(AssociationChange.class)));
+ Diff changeUMLAssociation = Iterators.find(differences.iterator(), and(
+ instanceOf(AssociationChange.class), ofKind(DifferenceKind.CHANGE)), null);
+ assertNull(changeUMLAssociation);
+ // assertNotNull(changeUMLAssociation);
+ // assertSame(Integer.valueOf(5), Integer.valueOf(changeUMLAssociation.getRefinedBy().size()));
+ // assertTrue(changeUMLAssociation.getRefinedBy().contains(addRefTypeInPropertyClass2));
+ // assertTrue(changeUMLAssociation.getRefinedBy().contains(addLiteralIntegerInClass2));
+ // assertTrue(changeUMLAssociation.getRefinedBy().contains(addUnlimitedNaturalInClass2));
+ // assertTrue(changeUMLAssociation.getRefinedBy().contains(addRefAssociationInPropertyClass2));
+ // assertTrue(changeUMLAssociation.getRefinedBy().contains(addPropertyClass2));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addPropertyClass2.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
+ .size()));
+ assertTrue(addRefAssociationInPropertyClass2.getRequires().contains(addPropertyClass2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
+ assertTrue(addRefTypeInPropertyClass2.getRequires().contains(addPropertyClass2));
+
+ // assertSame(Integer.valueOf(0), Integer.valueOf(changeUMLAssociation.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
+ assertTrue(addLiteralIntegerInClass2.getRequires().contains(addPropertyClass2));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
+ assertTrue(addUnlimitedNaturalInClass2.getRequires().contains(addPropertyClass2));
+ } else {
+ assertSame(Integer.valueOf(5), Integer.valueOf(addPropertyClass2.getRequires().size()));
+ assertTrue(addPropertyClass2.getRequires().contains(addLiteralIntegerInClass2));
+ assertTrue(addPropertyClass2.getRequires().contains(addUnlimitedNaturalInClass2));
+ assertTrue(addPropertyClass2.getRequires().contains(addRefAssociationInPropertyClass2));
+ assertTrue(addPropertyClass2.getRequires().contains(addRefTypeInPropertyClass2));
+ assertTrue(addPropertyClass2.getRequires().contains(addPropertyClass2InAssociation));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAssociationInPropertyClass2.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefTypeInPropertyClass2.getRequires().size()));
+ // assertSame(Integer.valueOf(0), Integer.valueOf(changeUMLAssociation.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addLiteralIntegerInClass2.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUnlimitedNaturalInClass2.getRequires().size()));
+ }
+
+ testIntersections(comparison);
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/AssociationInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/AssociationInputData.java
index bc1e1aa5b..94cbfb79c 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/AssociationInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/AssociationInputData.java
@@ -1,40 +1,40 @@
-package org.eclipse.emf.compare.uml2.tests.association.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class AssociationInputData extends AbstractUMLInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Left() throws IOException {
- return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Right() throws IOException {
- return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA3Left() throws IOException {
- return loadFromClassLoader("a3/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA3Right() throws IOException {
- return loadFromClassLoader("a3/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA4Left() throws IOException {
- return loadFromClassLoader("a4/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA4Right() throws IOException {
- return loadFromClassLoader("a4/right.uml"); //$NON-NLS-1$
- }
-}
+package org.eclipse.emf.compare.uml2.tests.association.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class AssociationInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Left() throws IOException {
+ return loadFromClassLoader("a3/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Right() throws IOException {
+ return loadFromClassLoader("a3/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Left() throws IOException {
+ return loadFromClassLoader("a4/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Right() throws IOException {
+ return loadFromClassLoader("a4/right.uml"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/a1/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/a1/left.uml
index f3673bd07..189c8a695 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/a1/left.uml
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/association/data/a1/left.uml
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
- <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
- <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
- <packagedElement xmi:type="uml:Association" xmi:id="_n8aCMF9kEeC2jdN7B1dxQw" name="class1sToClass2s" memberEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw" navigableOwnedEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw">
- <ownedEnd xmi:id="_n8bQUF9kEeC2jdN7B1dxQw" name="class1s" type="_eOr_sF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8dskF9kEeC2jdN7B1dxQw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8eToF9kEeC2jdN7B1dxQw" value="*"/>
- </ownedEnd>
- <ownedEnd xmi:id="_n8e6sF9kEeC2jdN7B1dxQw" name="class2s" type="_epJuIF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8gv4F9kEeC2jdN7B1dxQw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8hW8F9kEeC2jdN7B1dxQw" value="*"/>
- </ownedEnd>
- </packagedElement>
-</uml:Model>
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+ <packagedElement xmi:type="uml:Association" xmi:id="_n8aCMF9kEeC2jdN7B1dxQw" name="class1sToClass2s" memberEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw" navigableOwnedEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw">
+ <ownedEnd xmi:id="_n8bQUF9kEeC2jdN7B1dxQw" name="class1s" type="_eOr_sF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8dskF9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8eToF9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ <ownedEnd xmi:id="_n8e6sF9kEeC2jdN7B1dxQw" name="class2s" type="_epJuIF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8gv4F9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8hW8F9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddAbstractionTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddAbstractionTest.java
index fb4b34686..e0abc1b0e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddAbstractionTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddAbstractionTest.java
@@ -1,189 +1,189 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-// TODO To extend from AddDependencyTest and change only descriptions.
-@SuppressWarnings("nls")
-public class AddAbstractionTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA20UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA21UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA20UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA21UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(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> addAbstractionDescription = null;
- Predicate<? super Diff> addRefAbstractionInClass1Description = null;
- Predicate<? super Diff> addRefClass1InAbstractionDescription = null;
- Predicate<? super Diff> addRefClass0InAbstractionDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addAbstractionDescription = removed("model.Abstraction0"); //$NON-NLS-1$
- addRefAbstractionInClass1Description = removedFromReference("model.Class1", "clientDependency",
- "model.Abstraction0");
- addRefClass1InAbstractionDescription = removedFromReference("model.Abstraction0", "client",
- "model.Class1");
- addRefClass0InAbstractionDescription = removedFromReference("model.Abstraction0", "supplier",
- "model.Class0");
- } else {
- addAbstractionDescription = added("model.Abstraction0"); //$NON-NLS-1$
- addRefAbstractionInClass1Description = addedToReference("model.Class1", "clientDependency",
- "model.Abstraction0");
- addRefClass1InAbstractionDescription = addedToReference("model.Abstraction0", "client",
- "model.Class1");
- addRefClass0InAbstractionDescription = addedToReference("model.Abstraction0", "supplier",
- "model.Class0");
- }
-
- final Diff addAbstraction = Iterators.find(differences.iterator(), addAbstractionDescription);
- final Diff addRefAbstractionInClass1 = Iterators.find(differences.iterator(),
- addRefAbstractionInClass1Description);
- final Diff addRefClass1InAbstraction = Iterators.find(differences.iterator(),
- addRefClass1InAbstractionDescription);
- final Diff addRefClass0InAbstraction = Iterators.find(differences.iterator(),
- addRefClass0InAbstractionDescription);
-
- assertNotNull(addAbstraction);
- assertNotNull(addRefAbstractionInClass1);
- assertNotNull(addRefClass1InAbstraction);
- assertNotNull(addRefClass0InAbstraction);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InAbstraction));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InAbstraction));
- assertTrue(addUMLDependency.getRefinedBy().contains(addAbstraction));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefAbstractionInClass1));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InAbstraction.getRequires().size()));
- assertTrue(addRefClass1InAbstraction.getRequires().contains(addAbstraction));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InAbstraction.getRequires().size()));
- assertTrue(addRefClass0InAbstraction.getRequires().contains(addAbstraction));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefAbstractionInClass1.getRequires().size()));
- assertTrue(addRefAbstractionInClass1.getRequires().contains(addAbstraction));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addAbstraction.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InAbstraction.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InAbstraction.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefAbstractionInClass1.getRequires().size()));
-
- assertSame(Integer.valueOf(3), Integer.valueOf(addAbstraction.getRequires().size()));
- assertTrue(addAbstraction.getRequires().contains(addRefClass1InAbstraction));
- assertTrue(addAbstraction.getRequires().contains(addRefClass0InAbstraction));
- assertTrue(addAbstraction.getRequires().contains(addRefAbstractionInClass1));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addRefClass1InAbstraction.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass1InAbstraction.getEquivalence()
- .getDifferences().size()));
- assertTrue(addRefClass1InAbstraction.getEquivalence().getDifferences().contains(
- addRefAbstractionInClass1));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+// TODO To extend from AddDependencyTest and change only descriptions.
+@SuppressWarnings("nls")
+public class AddAbstractionTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA20UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA21UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA20UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA21UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(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> addAbstractionDescription = null;
+ Predicate<? super Diff> addRefAbstractionInClass1Description = null;
+ Predicate<? super Diff> addRefClass1InAbstractionDescription = null;
+ Predicate<? super Diff> addRefClass0InAbstractionDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAbstractionDescription = removed("model.Abstraction0"); //$NON-NLS-1$
+ addRefAbstractionInClass1Description = removedFromReference("model.Class1", "clientDependency",
+ "model.Abstraction0");
+ addRefClass1InAbstractionDescription = removedFromReference("model.Abstraction0", "client",
+ "model.Class1");
+ addRefClass0InAbstractionDescription = removedFromReference("model.Abstraction0", "supplier",
+ "model.Class0");
+ } else {
+ addAbstractionDescription = added("model.Abstraction0"); //$NON-NLS-1$
+ addRefAbstractionInClass1Description = addedToReference("model.Class1", "clientDependency",
+ "model.Abstraction0");
+ addRefClass1InAbstractionDescription = addedToReference("model.Abstraction0", "client",
+ "model.Class1");
+ addRefClass0InAbstractionDescription = addedToReference("model.Abstraction0", "supplier",
+ "model.Class0");
+ }
+
+ final Diff addAbstraction = Iterators.find(differences.iterator(), addAbstractionDescription);
+ final Diff addRefAbstractionInClass1 = Iterators.find(differences.iterator(),
+ addRefAbstractionInClass1Description);
+ final Diff addRefClass1InAbstraction = Iterators.find(differences.iterator(),
+ addRefClass1InAbstractionDescription);
+ final Diff addRefClass0InAbstraction = Iterators.find(differences.iterator(),
+ addRefClass0InAbstractionDescription);
+
+ assertNotNull(addAbstraction);
+ assertNotNull(addRefAbstractionInClass1);
+ assertNotNull(addRefClass1InAbstraction);
+ assertNotNull(addRefClass0InAbstraction);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InAbstraction));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InAbstraction));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addAbstraction));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefAbstractionInClass1));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InAbstraction.getRequires().size()));
+ assertTrue(addRefClass1InAbstraction.getRequires().contains(addAbstraction));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InAbstraction.getRequires().size()));
+ assertTrue(addRefClass0InAbstraction.getRequires().contains(addAbstraction));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefAbstractionInClass1.getRequires().size()));
+ assertTrue(addRefAbstractionInClass1.getRequires().contains(addAbstraction));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addAbstraction.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InAbstraction.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InAbstraction.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefAbstractionInClass1.getRequires().size()));
+
+ assertSame(Integer.valueOf(3), Integer.valueOf(addAbstraction.getRequires().size()));
+ assertTrue(addAbstraction.getRequires().contains(addRefClass1InAbstraction));
+ assertTrue(addAbstraction.getRequires().contains(addRefClass0InAbstraction));
+ assertTrue(addAbstraction.getRequires().contains(addRefAbstractionInClass1));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addRefClass1InAbstraction.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass1InAbstraction.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addRefClass1InAbstraction.getEquivalence().getDifferences().contains(
+ addRefAbstractionInClass1));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddDependencyTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddDependencyTest.java
index 4a402dec6..da878b530 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddDependencyTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddDependencyTest.java
@@ -1,188 +1,188 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddDependencyTest extends AbstractUMLTest {
-
- protected DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- protected void testAB1(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> addDependencyDescription = null;
- Predicate<? super Diff> addRefDependencyInClass0Description = null;
- Predicate<? super Diff> addRefClass1InDependencyDescription = null;
- Predicate<? super Diff> addRefClass0InDependencyDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addDependencyDescription = removed("model.Dependency0"); //$NON-NLS-1$
- addRefDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Dependency0");
- addRefClass0InDependencyDescription = removedFromReference("model.Dependency0", "client",
- "model.Class0");
- addRefClass1InDependencyDescription = removedFromReference("model.Dependency0", "supplier",
- "model.Class1");
- } else {
- addDependencyDescription = added("model.Dependency0"); //$NON-NLS-1$
- addRefDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Dependency0");
- addRefClass0InDependencyDescription = addedToReference("model.Dependency0", "client",
- "model.Class0");
- addRefClass1InDependencyDescription = addedToReference("model.Dependency0", "supplier",
- "model.Class1");
- }
-
- final Diff addDependency = Iterators.find(differences.iterator(), addDependencyDescription);
- final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
- addRefDependencyInClass0Description);
- final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
- addRefClass0InDependencyDescription);
- final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
- addRefClass1InDependencyDescription);
-
- assertNotNull(addDependency);
- assertNotNull(addRefDependencyInClass0);
- assertNotNull(addRefClass0InDependency);
- assertNotNull(addRefClass1InDependency);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
- assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
- assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
- assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
- assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
- assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
- assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addRefClass0InDependency.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
- .getDifferences().size()));
- assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
- addRefDependencyInClass0));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddDependencyTest extends AbstractUMLTest {
+
+ protected DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ protected void testAB1(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> addDependencyDescription = null;
+ Predicate<? super Diff> addRefDependencyInClass0Description = null;
+ Predicate<? super Diff> addRefClass1InDependencyDescription = null;
+ Predicate<? super Diff> addRefClass0InDependencyDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addDependencyDescription = removed("model.Dependency0"); //$NON-NLS-1$
+ addRefDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Dependency0");
+ addRefClass0InDependencyDescription = removedFromReference("model.Dependency0", "client",
+ "model.Class0");
+ addRefClass1InDependencyDescription = removedFromReference("model.Dependency0", "supplier",
+ "model.Class1");
+ } else {
+ addDependencyDescription = added("model.Dependency0"); //$NON-NLS-1$
+ addRefDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Dependency0");
+ addRefClass0InDependencyDescription = addedToReference("model.Dependency0", "client",
+ "model.Class0");
+ addRefClass1InDependencyDescription = addedToReference("model.Dependency0", "supplier",
+ "model.Class1");
+ }
+
+ final Diff addDependency = Iterators.find(differences.iterator(), addDependencyDescription);
+ final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
+ addRefDependencyInClass0Description);
+ final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
+ addRefClass0InDependencyDescription);
+ final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
+ addRefClass1InDependencyDescription);
+
+ assertNotNull(addDependency);
+ assertNotNull(addRefDependencyInClass0);
+ assertNotNull(addRefClass0InDependency);
+ assertNotNull(addRefClass1InDependency);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+ assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+ assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+ assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
+ assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addRefClass0InDependency.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
+ addRefDependencyInClass0));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
index acaf4f593..35eac4c93 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddInterfaceRealizationTest.java
@@ -1,204 +1,204 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddInterfaceRealizationTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA50UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA51UseCase() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA50UseCase3way() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA51UseCase3way() throws IOException {
- final Resource left = input.getA5Left();
- final Resource right = input.getA5Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final 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> addInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientDependencyInClass0Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- //addInterfaceRealizationDescription = removed("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
- addInterfaceRealizationDescription = removedFromReference("model.Class0", "interfaceRealization",
- "model.Class0.InterfaceRealization0");
- addClientInInterfaceRealizationDescription = removedFromReference(
- "model.Class0.InterfaceRealization0", "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = removedFromReference(
- "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
- addContractInInterfaceRealizationDescription = changedReference(
- "model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
- addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Class0.InterfaceRealization0");
- } else {
- //addInterfaceRealizationDescription = added("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
- addInterfaceRealizationDescription = addedToReference(
- "model.Class0", "interfaceRealization", "model.Class0.InterfaceRealization0"); //$NON-NLS-1$
- addClientInInterfaceRealizationDescription = addedToReference(
- "model.Class0.InterfaceRealization0", "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = addedToReference(
- "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
- addContractInInterfaceRealizationDescription = changedReference(
- "model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
- addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Class0.InterfaceRealization0");
- }
-
- final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
- addInterfaceRealizationDescription);
- final Diff addClientInInterfaceRealization = Iterators.find(differences.iterator(),
- addClientInInterfaceRealizationDescription);
- final Diff addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
- addSupplierInInterfaceRealizationDescription);
- final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
- addContractInInterfaceRealizationDescription);
- final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
- addClientDependencyInClass0Description);
-
- assertNotNull(addInterfaceRealization);
- assertNotNull(addClientInInterfaceRealization);
- assertNotNull(addSupplierInInterfaceRealization);
- assertNotNull(addContractInInterfaceRealization);
- assertNotNull(addClientDependencyInClass0);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addClientInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addClientInInterfaceRealization.getRequires().contains(addInterfaceRealization));
- assertSame(Integer.valueOf(1), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addSupplierInInterfaceRealization.getRequires().contains(addInterfaceRealization));
- assertSame(Integer.valueOf(1), Integer.valueOf(addContractInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addContractInInterfaceRealization.getRequires().contains(addInterfaceRealization));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addInterfaceRealization.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addClientInInterfaceRealization.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
- .size()));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
- assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addClientInInterfaceRealization.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
- .getDifferences().size()));
- assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addClientInInterfaceRealization));
- assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addClientDependencyInClass0));
-
- testIntersections(comparison);
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddInterfaceRealizationTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA50UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA51UseCase() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA50UseCase3way() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA51UseCase3way() throws IOException {
+ final Resource left = input.getA5Left();
+ final Resource right = input.getA5Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final 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> addInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ //addInterfaceRealizationDescription = removed("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
+ addInterfaceRealizationDescription = removedFromReference("model.Class0", "interfaceRealization",
+ "model.Class0.InterfaceRealization0");
+ addClientInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ } else {
+ //addInterfaceRealizationDescription = added("model.Class0.InterfaceRealization0"); //$NON-NLS-1$
+ addInterfaceRealizationDescription = addedToReference(
+ "model.Class0", "interfaceRealization", "model.Class0.InterfaceRealization0"); //$NON-NLS-1$
+ addClientInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ }
+
+ final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
+ addInterfaceRealizationDescription);
+ final Diff addClientInInterfaceRealization = Iterators.find(differences.iterator(),
+ addClientInInterfaceRealizationDescription);
+ final Diff addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
+ addSupplierInInterfaceRealizationDescription);
+ final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
+ addContractInInterfaceRealizationDescription);
+ final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description);
+
+ assertNotNull(addInterfaceRealization);
+ assertNotNull(addClientInInterfaceRealization);
+ assertNotNull(addSupplierInInterfaceRealization);
+ assertNotNull(addContractInInterfaceRealization);
+ assertNotNull(addClientDependencyInClass0);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addClientInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addClientInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+ assertSame(Integer.valueOf(1), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addSupplierInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+ assertSame(Integer.valueOf(1), Integer.valueOf(addContractInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addContractInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addClientInInterfaceRealization.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
+ .size()));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addClientInInterfaceRealization.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientInInterfaceRealization));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientDependencyInClass0));
+
+ testIntersections(comparison);
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddRealizationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddRealizationTest.java
index 47f3f1a12..b0f646656 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddRealizationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddRealizationTest.java
@@ -1,189 +1,189 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-//TODO To extend from AddDependencyTest and change only descriptions.
-@SuppressWarnings("nls")
-public class AddRealizationTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA60UseCase() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA61UseCase() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA60UseCase3way() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA61UseCase3way() throws IOException {
- final Resource left = input.getA6Left();
- final Resource right = input.getA6Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(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> addRealizationDescription = null;
- Predicate<? super Diff> addRefRealizationInClass0Description = null;
- Predicate<? super Diff> addRefClass1InRealizationDescription = null;
- Predicate<? super Diff> addRefClass0InRealizationDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addRealizationDescription = removed("model.Realization0"); //$NON-NLS-1$
- addRefRealizationInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Realization0");
- addRefClass0InRealizationDescription = removedFromReference("model.Realization0", "client",
- "model.Class0");
- addRefClass1InRealizationDescription = removedFromReference("model.Realization0", "supplier",
- "model.Class1");
- } else {
- addRealizationDescription = added("model.Realization0"); //$NON-NLS-1$
- addRefRealizationInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Realization0");
- addRefClass0InRealizationDescription = addedToReference("model.Realization0", "client",
- "model.Class0");
- addRefClass1InRealizationDescription = addedToReference("model.Realization0", "supplier",
- "model.Class1");
- }
-
- final Diff addDependency = Iterators.find(differences.iterator(), addRealizationDescription);
- final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
- addRefRealizationInClass0Description);
- final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
- addRefClass0InRealizationDescription);
- final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
- addRefClass1InRealizationDescription);
-
- assertNotNull(addDependency);
- assertNotNull(addRefDependencyInClass0);
- assertNotNull(addRefClass0InDependency);
- assertNotNull(addRefClass1InDependency);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
- assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
- assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
- assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
- assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
- assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
- assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addRefClass0InDependency.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
- .getDifferences().size()));
- assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
- addRefDependencyInClass0));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+//TODO To extend from AddDependencyTest and change only descriptions.
+@SuppressWarnings("nls")
+public class AddRealizationTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA60UseCase() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA61UseCase() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA60UseCase3way() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA61UseCase3way() throws IOException {
+ final Resource left = input.getA6Left();
+ final Resource right = input.getA6Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(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> addRealizationDescription = null;
+ Predicate<? super Diff> addRefRealizationInClass0Description = null;
+ Predicate<? super Diff> addRefClass1InRealizationDescription = null;
+ Predicate<? super Diff> addRefClass0InRealizationDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addRealizationDescription = removed("model.Realization0"); //$NON-NLS-1$
+ addRefRealizationInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Realization0");
+ addRefClass0InRealizationDescription = removedFromReference("model.Realization0", "client",
+ "model.Class0");
+ addRefClass1InRealizationDescription = removedFromReference("model.Realization0", "supplier",
+ "model.Class1");
+ } else {
+ addRealizationDescription = added("model.Realization0"); //$NON-NLS-1$
+ addRefRealizationInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Realization0");
+ addRefClass0InRealizationDescription = addedToReference("model.Realization0", "client",
+ "model.Class0");
+ addRefClass1InRealizationDescription = addedToReference("model.Realization0", "supplier",
+ "model.Class1");
+ }
+
+ final Diff addDependency = Iterators.find(differences.iterator(), addRealizationDescription);
+ final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
+ addRefRealizationInClass0Description);
+ final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
+ addRefClass0InRealizationDescription);
+ final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
+ addRefClass1InRealizationDescription);
+
+ assertNotNull(addDependency);
+ assertNotNull(addRefDependencyInClass0);
+ assertNotNull(addRefClass0InDependency);
+ assertNotNull(addRefClass1InDependency);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+ assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+ assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+ assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
+ assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addRefClass0InDependency.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
+ addRefDependencyInClass0));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
index f0bd135b5..47ea9ee87 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddSubstitutionTest.java
@@ -1,204 +1,204 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-//TODO To extend from AddInterfaceRealizationTest and change only descriptions.
-
-@SuppressWarnings("nls")
-public class AddSubstitutionTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA70UseCase() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA71UseCase() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA70UseCase3way() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA71UseCase3way() throws IOException {
- final Resource left = input.getA7Left();
- final Resource right = input.getA7Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final 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> addInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientDependencyInClass0Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addInterfaceRealizationDescription = removedFromReference("model.Class0", "substitution",
- "model.Class0.Substitution0");
- addClientInInterfaceRealizationDescription = removedFromReference("model.Class0.Substitution0",
- "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = removedFromReference("model.Class0.Substitution0",
- "supplier", "model.Class1");
- addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
- "contract", "model.Class1", null);
- addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Class0.Substitution0");
- } else {
- addInterfaceRealizationDescription = addedToReference(
- "model.Class0", "substitution", "model.Class0.Substitution0"); //$NON-NLS-1$
- addClientInInterfaceRealizationDescription = addedToReference("model.Class0.Substitution0",
- "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = addedToReference("model.Class0.Substitution0",
- "supplier", "model.Class1");
- addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
- "contract", null, "model.Class1");
- addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Class0.Substitution0");
- }
-
- final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
- addInterfaceRealizationDescription);
- final Diff addClientInInterfaceRealization = Iterators.find(differences.iterator(),
- addClientInInterfaceRealizationDescription);
- final Diff addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
- addSupplierInInterfaceRealizationDescription);
- final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
- addContractInInterfaceRealizationDescription);
- final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
- addClientDependencyInClass0Description);
-
- assertNotNull(addInterfaceRealization);
- assertNotNull(addClientInInterfaceRealization);
- assertNotNull(addSupplierInInterfaceRealization);
- assertNotNull(addContractInInterfaceRealization);
- assertNotNull(addClientDependencyInClass0);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
- assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addClientInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addClientInInterfaceRealization.getRequires().contains(addInterfaceRealization));
- assertSame(Integer.valueOf(1), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addSupplierInInterfaceRealization.getRequires().contains(addInterfaceRealization));
- assertSame(Integer.valueOf(1), Integer.valueOf(addContractInInterfaceRealization.getRequires()
- .size()));
- assertTrue(addContractInInterfaceRealization.getRequires().contains(addInterfaceRealization));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addInterfaceRealization.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addClientInInterfaceRealization.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
- .size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
- .size()));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
- assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
- assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addClientInInterfaceRealization.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
- .getDifferences().size()));
- assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addClientInInterfaceRealization));
- assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
- addClientDependencyInClass0));
-
- testIntersections(comparison);
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+//TODO To extend from AddInterfaceRealizationTest and change only descriptions.
+
+@SuppressWarnings("nls")
+public class AddSubstitutionTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA70UseCase() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA71UseCase() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA70UseCase3way() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA71UseCase3way() throws IOException {
+ final Resource left = input.getA7Left();
+ final Resource right = input.getA7Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final 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> addInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addInterfaceRealizationDescription = removedFromReference("model.Class0", "substitution",
+ "model.Class0.Substitution0");
+ addClientInInterfaceRealizationDescription = removedFromReference("model.Class0.Substitution0",
+ "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = removedFromReference("model.Class0.Substitution0",
+ "supplier", "model.Class1");
+ addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
+ "contract", "model.Class1", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.Substitution0");
+ } else {
+ addInterfaceRealizationDescription = addedToReference(
+ "model.Class0", "substitution", "model.Class0.Substitution0"); //$NON-NLS-1$
+ addClientInInterfaceRealizationDescription = addedToReference("model.Class0.Substitution0",
+ "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = addedToReference("model.Class0.Substitution0",
+ "supplier", "model.Class1");
+ addContractInInterfaceRealizationDescription = changedReference("model.Class0.Substitution0",
+ "contract", null, "model.Class1");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.Substitution0");
+ }
+
+ final Diff addInterfaceRealization = Iterators.find(differences.iterator(),
+ addInterfaceRealizationDescription);
+ final Diff addClientInInterfaceRealization = Iterators.find(differences.iterator(),
+ addClientInInterfaceRealizationDescription);
+ final Diff addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
+ addSupplierInInterfaceRealizationDescription);
+ final Diff addContractInInterfaceRealization = Iterators.find(differences.iterator(),
+ addContractInInterfaceRealizationDescription);
+ final Diff addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description);
+
+ assertNotNull(addInterfaceRealization);
+ assertNotNull(addClientInInterfaceRealization);
+ assertNotNull(addSupplierInInterfaceRealization);
+ assertNotNull(addContractInInterfaceRealization);
+ assertNotNull(addClientDependencyInClass0);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(5), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addSupplierInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addContractInInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addInterfaceRealization));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addClientDependencyInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addClientInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addClientInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+ assertSame(Integer.valueOf(1), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addSupplierInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+ assertSame(Integer.valueOf(1), Integer.valueOf(addContractInInterfaceRealization.getRequires()
+ .size()));
+ assertTrue(addContractInInterfaceRealization.getRequires().contains(addInterfaceRealization));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addClientInInterfaceRealization.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInInterfaceRealization.getRequires()
+ .size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addContractInInterfaceRealization.getRequires()
+ .size()));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addInterfaceRealization.getRequires().size()));
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addSupplierInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addContractInInterfaceRealization));
+ assertTrue(addInterfaceRealization.getRequires().contains(addClientDependencyInClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addClientInInterfaceRealization.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addClientInInterfaceRealization.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientInInterfaceRealization));
+ assertTrue(addClientInInterfaceRealization.getEquivalence().getDifferences().contains(
+ addClientDependencyInClass0));
+
+ testIntersections(comparison);
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddUsageTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddUsageTest.java
index 44b7ec1f1..b9d66b1a4 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddUsageTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/AddUsageTest.java
@@ -1,186 +1,186 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-//TODO To extend from ChangeDependencyTest and change only descriptions.
-@SuppressWarnings("nls")
-public class AddUsageTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA80UseCase() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA81UseCase() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA80UseCase3way() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA81UseCase3way() throws IOException {
- final Resource left = input.getA8Left();
- final Resource right = input.getA8Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- protected void testAB1(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> addDependencyDescription = null;
- Predicate<? super Diff> addRefDependencyInClass0Description = null;
- Predicate<? super Diff> addRefClass1InDependencyDescription = null;
- Predicate<? super Diff> addRefClass0InDependencyDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addDependencyDescription = removed("model.Usage0"); //$NON-NLS-1$
- addRefDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Usage0");
- addRefClass0InDependencyDescription = removedFromReference("model.Usage0", "client",
- "model.Class0");
- addRefClass1InDependencyDescription = removedFromReference("model.Usage0", "supplier",
- "model.Class1");
- } else {
- addDependencyDescription = added("model.Usage0"); //$NON-NLS-1$
- addRefDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Usage0");
- addRefClass0InDependencyDescription = addedToReference("model.Usage0", "client", "model.Class0");
- addRefClass1InDependencyDescription = addedToReference("model.Usage0", "supplier", "model.Class1");
- }
-
- final Diff addDependency = Iterators.find(differences.iterator(), addDependencyDescription);
- final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
- addRefDependencyInClass0Description);
- final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
- addRefClass0InDependencyDescription);
- final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
- addRefClass1InDependencyDescription);
-
- assertNotNull(addDependency);
- assertNotNull(addRefDependencyInClass0);
- assertNotNull(addRefClass0InDependency);
- assertNotNull(addRefClass1InDependency);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff addUMLDependency = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLDependency);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
- assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
- assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
- assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
- assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
-
- assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
- assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
- assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
- assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addRefClass0InDependency.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
- .getDifferences().size()));
- assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
- addRefDependencyInClass0));
-
- testIntersections(comparison);
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+//TODO To extend from ChangeDependencyTest and change only descriptions.
+@SuppressWarnings("nls")
+public class AddUsageTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA80UseCase() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA81UseCase() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA80UseCase3way() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA81UseCase3way() throws IOException {
+ final Resource left = input.getA8Left();
+ final Resource right = input.getA8Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ protected void testAB1(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> addDependencyDescription = null;
+ Predicate<? super Diff> addRefDependencyInClass0Description = null;
+ Predicate<? super Diff> addRefClass1InDependencyDescription = null;
+ Predicate<? super Diff> addRefClass0InDependencyDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addDependencyDescription = removed("model.Usage0"); //$NON-NLS-1$
+ addRefDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Usage0");
+ addRefClass0InDependencyDescription = removedFromReference("model.Usage0", "client",
+ "model.Class0");
+ addRefClass1InDependencyDescription = removedFromReference("model.Usage0", "supplier",
+ "model.Class1");
+ } else {
+ addDependencyDescription = added("model.Usage0"); //$NON-NLS-1$
+ addRefDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Usage0");
+ addRefClass0InDependencyDescription = addedToReference("model.Usage0", "client", "model.Class0");
+ addRefClass1InDependencyDescription = addedToReference("model.Usage0", "supplier", "model.Class1");
+ }
+
+ final Diff addDependency = Iterators.find(differences.iterator(), addDependencyDescription);
+ final Diff addRefDependencyInClass0 = Iterators.find(differences.iterator(),
+ addRefDependencyInClass0Description);
+ final Diff addRefClass0InDependency = Iterators.find(differences.iterator(),
+ addRefClass0InDependencyDescription);
+ final Diff addRefClass1InDependency = Iterators.find(differences.iterator(),
+ addRefClass1InDependencyDescription);
+
+ assertNotNull(addDependency);
+ assertNotNull(addRefDependencyInClass0);
+ assertNotNull(addRefClass0InDependency);
+ assertNotNull(addRefClass1InDependency);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff addUMLDependency = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLDependency);
+ assertSame(Integer.valueOf(4), Integer.valueOf(addUMLDependency.getRefinedBy().size()));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass0InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefClass1InDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addDependency));
+ assertTrue(addUMLDependency.getRefinedBy().contains(addRefDependencyInClass0));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+ assertTrue(addRefClass0InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+ assertTrue(addRefClass1InDependency.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+ assertTrue(addRefDependencyInClass0.getRequires().contains(addDependency));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addDependency.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass0InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefClass1InDependency.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefDependencyInClass0.getRequires().size()));
+
+ assertSame(Integer.valueOf(3), Integer.valueOf(addDependency.getRequires().size()));
+ assertTrue(addDependency.getRequires().contains(addRefClass0InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefClass1InDependency));
+ assertTrue(addDependency.getRequires().contains(addRefDependencyInClass0));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLDependency.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addRefClass0InDependency.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefClass0InDependency.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addRefClass0InDependency.getEquivalence().getDifferences().contains(
+ addRefDependencyInClass0));
+
+ testIntersections(comparison);
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeDependencyTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeDependencyTest.java
index ea496ed0b..ea06f9958 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeDependencyTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeDependencyTest.java
@@ -1,127 +1,127 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ChangeDependencyTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA30UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA31UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA30UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA31UseCase3way() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 1 differences
- assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addSupplierInDependencyDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addSupplierInDependencyDescription = removedFromReference("model.Dependency0", "supplier",
- "model.Class2");
- } else {
- addSupplierInDependencyDescription = addedToReference("model.Dependency0", "supplier",
- "model.Class2");
- }
-
- final Diff addSupplierInDependency = Iterators.find(differences.iterator(),
- addSupplierInDependencyDescription);
-
- assertNotNull(addSupplierInDependency);
-
- // CHECK EXTENSION
- // No extension anymore
- assertSame(Integer.valueOf(0), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff changeUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.CHANGE)), null);
- assertNull(changeUMLDependency);
- // assertNotNull(changeUMLDependency);
- // assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLDependency.getRefinedBy().size()));
- // assertTrue(changeUMLDependency.getRefinedBy().contains(addSupplierInDependency));
-
- // CHECK REQUIREMENT
- assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInDependency.getRequires().size()));
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ChangeDependencyTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA30UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA31UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA30UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA31UseCase3way() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 1 differences
+ assertSame(Integer.valueOf(1), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addSupplierInDependencyDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addSupplierInDependencyDescription = removedFromReference("model.Dependency0", "supplier",
+ "model.Class2");
+ } else {
+ addSupplierInDependencyDescription = addedToReference("model.Dependency0", "supplier",
+ "model.Class2");
+ }
+
+ final Diff addSupplierInDependency = Iterators.find(differences.iterator(),
+ addSupplierInDependencyDescription);
+
+ assertNotNull(addSupplierInDependency);
+
+ // CHECK EXTENSION
+ // No extension anymore
+ assertSame(Integer.valueOf(0), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff changeUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.CHANGE)), null);
+ assertNull(changeUMLDependency);
+ // assertNotNull(changeUMLDependency);
+ // assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLDependency.getRefinedBy().size()));
+ // assertTrue(changeUMLDependency.getRefinedBy().contains(addSupplierInDependency));
+
+ // CHECK REQUIREMENT
+ assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInDependency.getRequires().size()));
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeUsageTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeUsageTest.java
index 2d389eea9..41c3cf23e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeUsageTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/ChangeUsageTest.java
@@ -1,127 +1,127 @@
-package org.eclipse.emf.compare.uml2.tests.dependency;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-//TODO To extend from ChangeDependencyTest and change only descriptions.
-@SuppressWarnings("nls")
-public class ChangeUsageTest extends AbstractUMLTest {
-
- private DependencyInputData input = new DependencyInputData();
-
- @Test
- public void testA40UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA41UseCase() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA40UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA41UseCase3way() throws IOException {
- final Resource left = input.getA4Left();
- final Resource right = input.getA4Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(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(1), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addSupplierInDependencyDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addSupplierInDependencyDescription = removedFromReference("model.Usage0", "supplier",
- "model.Class1");
- } else {
- addSupplierInDependencyDescription = addedToReference("model.Usage0", "supplier", "model.Class1");
- }
-
- final Diff addSupplierInDependency = Iterators.find(differences.iterator(),
- addSupplierInDependencyDescription);
-
- assertNotNull(addSupplierInDependency);
-
- // CHECK EXTENSION
- // no extension any more
- assertSame(Integer.valueOf(0), count(differences, instanceOf(DirectedRelationshipChange.class)));
- Diff changeUMLDependency = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.CHANGE)), null);
- assertNull(changeUMLDependency);
- // assertNotNull(changeUMLDependency);
- // assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLDependency.getRefinedBy().size()));
- // assertTrue(changeUMLDependency.getRefinedBy().contains(addSupplierInDependency));
-
- // CHECK REQUIREMENT
- assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInDependency.getRequires().size()));
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.dependency;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.dependency.data.DependencyInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+//TODO To extend from ChangeDependencyTest and change only descriptions.
+@SuppressWarnings("nls")
+public class ChangeUsageTest extends AbstractUMLTest {
+
+ private DependencyInputData input = new DependencyInputData();
+
+ @Test
+ public void testA40UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA41UseCase() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA40UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA41UseCase3way() throws IOException {
+ final Resource left = input.getA4Left();
+ final Resource right = input.getA4Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(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(1), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addSupplierInDependencyDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addSupplierInDependencyDescription = removedFromReference("model.Usage0", "supplier",
+ "model.Class1");
+ } else {
+ addSupplierInDependencyDescription = addedToReference("model.Usage0", "supplier", "model.Class1");
+ }
+
+ final Diff addSupplierInDependency = Iterators.find(differences.iterator(),
+ addSupplierInDependencyDescription);
+
+ assertNotNull(addSupplierInDependency);
+
+ // CHECK EXTENSION
+ // no extension any more
+ assertSame(Integer.valueOf(0), count(differences, instanceOf(DirectedRelationshipChange.class)));
+ Diff changeUMLDependency = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class), ofKind(DifferenceKind.CHANGE)), null);
+ assertNull(changeUMLDependency);
+ // assertNotNull(changeUMLDependency);
+ // assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLDependency.getRefinedBy().size()));
+ // assertTrue(changeUMLDependency.getRefinedBy().contains(addSupplierInDependency));
+
+ // CHECK REQUIREMENT
+ assertSame(Integer.valueOf(0), Integer.valueOf(addSupplierInDependency.getRequires().size()));
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/data/DependencyInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/data/DependencyInputData.java
index 548a64827..b6c674b25 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/data/DependencyInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/dependency/data/DependencyInputData.java
@@ -1,72 +1,72 @@
-package org.eclipse.emf.compare.uml2.tests.dependency.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class DependencyInputData extends AbstractUMLInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Left() throws IOException {
- return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Right() throws IOException {
- return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA3Left() throws IOException {
- return loadFromClassLoader("a3/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA3Right() throws IOException {
- return loadFromClassLoader("a3/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA4Left() throws IOException {
- return loadFromClassLoader("a4/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA4Right() throws IOException {
- return loadFromClassLoader("a4/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA5Left() throws IOException {
- return loadFromClassLoader("a5/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA5Right() throws IOException {
- return loadFromClassLoader("a5/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA6Left() throws IOException {
- return loadFromClassLoader("a6/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA6Right() throws IOException {
- return loadFromClassLoader("a6/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA7Right() throws IOException {
- return loadFromClassLoader("a7/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA7Left() throws IOException {
- return loadFromClassLoader("a7/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA8Right() throws IOException {
- return loadFromClassLoader("a8/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA8Left() throws IOException {
- return loadFromClassLoader("a8/left.uml"); //$NON-NLS-1$
- }
-}
+package org.eclipse.emf.compare.uml2.tests.dependency.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class DependencyInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Left() throws IOException {
+ return loadFromClassLoader("a3/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA3Right() throws IOException {
+ return loadFromClassLoader("a3/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Left() throws IOException {
+ return loadFromClassLoader("a4/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA4Right() throws IOException {
+ return loadFromClassLoader("a4/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Left() throws IOException {
+ return loadFromClassLoader("a5/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA5Right() throws IOException {
+ return loadFromClassLoader("a5/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA6Left() throws IOException {
+ return loadFromClassLoader("a6/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA6Right() throws IOException {
+ return loadFromClassLoader("a6/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA7Right() throws IOException {
+ return loadFromClassLoader("a7/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA7Left() throws IOException {
+ return loadFromClassLoader("a7/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA8Right() throws IOException {
+ return loadFromClassLoader("a8/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA8Left() throws IOException {
+ return loadFromClassLoader("a8/left.uml"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddActionExecutionSpecificationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddActionExecutionSpecificationTest.java
index e0e689fbc..687e61ebe 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddActionExecutionSpecificationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddActionExecutionSpecificationTest.java
@@ -1,333 +1,333 @@
-package org.eclipse.emf.compare.uml2.tests.executionSpecification;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.executionSpecification.data.ExecutionSpecificationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddActionExecutionSpecificationTest extends AbstractUMLTest {
-
- private ExecutionSpecificationInputData input = new ExecutionSpecificationInputData();
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 14 differences
- assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addActionExecSpecDescription = null;
- Predicate<? super Diff> addCoveredInStartDescription = null;
- Predicate<? super Diff> addExecutionInStartDescription = null;
- Predicate<? super Diff> addCoveredInFinishDescription = null;
- Predicate<? super Diff> addExecutionInFinishDescription = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description1 = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description2 = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description3 = null;
- Predicate<? super Diff> addFinishInActionExecSpecDescription = null;
- Predicate<? super Diff> addStartInActionExecSpecDescription = null;
- Predicate<? super Diff> addStartDescription = null;
- Predicate<? super Diff> addFinishDescription = null;
- Predicate<? super Diff> addCoveredInActionExecSpecDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addActionExecSpecDescription = removed("model.interaction0.ActionExecSpec0"); //$NON-NLS-1$
- addStartDescription = removed("model.interaction0.ActionExecSpec0Start0"); //$NON-NLS-1$
- addFinishDescription = removed("model.interaction0.ActionExecSpec0Finish0"); //$NON-NLS-1$
- addCoveredInStartDescription = removedFromReference("model.interaction0.ActionExecSpec0Start0",
- "covered", "model.interaction0.Lifeline1");
- addExecutionInStartDescription = changedReference("model.interaction0.ActionExecSpec0Start0",
- "execution", "model.interaction0.ActionExecSpec0", null);
- addCoveredInFinishDescription = removedFromReference("model.interaction0.ActionExecSpec0Finish0",
- "covered", "model.interaction0.Lifeline1");
- addExecutionInFinishDescription = changedReference("model.interaction0.ActionExecSpec0Finish0",
- "execution", "model.interaction0.ActionExecSpec0", null);
- addFinishInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
- "finish", "model.interaction0.ActionExecSpec0Finish0", null);
- addStartInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
- "start", "model.interaction0.ActionExecSpec0Start0", null);
- addCoveredByInLifeline1Description1 = removedFromReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0Start0");
- addCoveredByInLifeline1Description2 = removedFromReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0Finish0");
- addCoveredByInLifeline1Description3 = removedFromReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0");
- addCoveredInActionExecSpecDescription = removedFromReference(
- "model.interaction0.ActionExecSpec0", "covered", "model.interaction0.Lifeline1");
- } else {
- addActionExecSpecDescription = added("model.interaction0.ActionExecSpec0"); //$NON-NLS-1$
- addStartDescription = added("model.interaction0.ActionExecSpec0Start0"); //$NON-NLS-1$
- addFinishDescription = added("model.interaction0.ActionExecSpec0Finish0");
- addCoveredInStartDescription = addedToReference("model.interaction0.ActionExecSpec0Start0",
- "covered", "model.interaction0.Lifeline1");
- addExecutionInStartDescription = changedReference("model.interaction0.ActionExecSpec0Start0",
- "execution", null, "model.interaction0.ActionExecSpec0");
- addCoveredInFinishDescription = addedToReference("model.interaction0.ActionExecSpec0Finish0",
- "covered", "model.interaction0.Lifeline1");
- addExecutionInFinishDescription = changedReference("model.interaction0.ActionExecSpec0Finish0",
- "execution", null, "model.interaction0.ActionExecSpec0");
- addFinishInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
- "finish", null, "model.interaction0.ActionExecSpec0Finish0");
- addStartInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
- "start", null, "model.interaction0.ActionExecSpec0Start0");
- addCoveredByInLifeline1Description1 = addedToReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0Start0");
- addCoveredByInLifeline1Description2 = addedToReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0Finish0");
- addCoveredByInLifeline1Description3 = addedToReference("model.interaction0.Lifeline1",
- "coveredBy", "model.interaction0.ActionExecSpec0");
- addCoveredInActionExecSpecDescription = addedToReference("model.interaction0.ActionExecSpec0",
- "covered", "model.interaction0.Lifeline1");
- }
-
- final Diff addActionExecSpec = Iterators.find(differences.iterator(), addActionExecSpecDescription);
- final Diff addCoveredInStart = Iterators.find(differences.iterator(), addCoveredInStartDescription);
- final Diff addExecutionInStart = Iterators.find(differences.iterator(),
- addExecutionInStartDescription);
- final Diff addCoveredInFinish = Iterators.find(differences.iterator(), addCoveredInFinishDescription);
- final Diff addExecutionInFinish = Iterators.find(differences.iterator(),
- addExecutionInFinishDescription);
- final Diff addFinishInActionExecSpec = Iterators.find(differences.iterator(),
- addFinishInActionExecSpecDescription);
- final Diff addStartInActionExecSpec = Iterators.find(differences.iterator(),
- addStartInActionExecSpecDescription);
- final Diff addCoveredByInLifeline1_1 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description1);
- final Diff addCoveredByInLifeline1_2 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description2);
- final Diff addCoveredByInLifeline1_3 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description3);
- final Diff addStart = Iterators.find(differences.iterator(), addStartDescription);
- final Diff addFinish = Iterators.find(differences.iterator(), addFinishDescription);
- final Diff addCoveredInActionExecSpec = Iterators.find(differences.iterator(),
- addCoveredInActionExecSpecDescription);
-
- assertNotNull(addActionExecSpec);
- assertNotNull(addCoveredInStart);
- assertNotNull(addExecutionInStart);
- assertNotNull(addCoveredInFinish);
- assertNotNull(addExecutionInFinish);
- assertNotNull(addFinishInActionExecSpec);
- assertNotNull(addStartInActionExecSpec);
- assertNotNull(addCoveredByInLifeline1_1);
- assertNotNull(addCoveredByInLifeline1_2);
- assertNotNull(addCoveredByInLifeline1_3);
- assertNotNull(addStart);
- assertNotNull(addFinish);
- assertNotNull(addCoveredInActionExecSpec);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(ExecutionSpecificationChange.class)));
- Diff addUMLMessage = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLMessage = Iterators.find(differences.iterator(), and(
- instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLMessage = Iterators.find(differences.iterator(), and(
- instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLMessage);
- assertSame(Integer.valueOf(13), Integer.valueOf(addUMLMessage.getRefinedBy().size()));
- assertTrue(addUMLMessage.getRefinedBy().contains(addFinishInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addStartInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInStart));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_1));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_2));
- assertTrue(addUMLMessage.getRefinedBy().contains(addStart));
- assertTrue(addUMLMessage.getRefinedBy().contains(addFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_3));
- assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInStart));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInStart.getRequires().size()));
- assertTrue(addCoveredInStart.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInStart.getRequires().size()));
- assertTrue(addExecutionInStart.getRequires().contains(addStart));
- assertTrue(addExecutionInStart.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInFinish.getRequires().size()));
- assertTrue(addCoveredInFinish.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInFinish.getRequires().size()));
- assertTrue(addExecutionInFinish.getRequires().contains(addFinish));
- assertTrue(addExecutionInFinish.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
- assertTrue(addFinishInActionExecSpec.getRequires().contains(addActionExecSpec));
- assertTrue(addFinishInActionExecSpec.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
- assertTrue(addStartInActionExecSpec.getRequires().contains(addActionExecSpec));
- assertTrue(addStartInActionExecSpec.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_1.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_2.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_3.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
- assertTrue(addCoveredInActionExecSpec.getRequires().contains(addActionExecSpec));
-
- } else {
- assertSame(Integer.valueOf(6), Integer.valueOf(addActionExecSpec.getRequires().size()));
- assertTrue(addActionExecSpec.getRequires().contains(addFinishInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addStartInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addCoveredInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addExecutionInFinish));
- assertTrue(addActionExecSpec.getRequires().contains(addExecutionInStart));
- assertTrue(addActionExecSpec.getRequires().contains(addCoveredByInLifeline1_3));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addStart.getRequires().size()));
- assertTrue(addStart.getRequires().contains(addStartInActionExecSpec));
- assertTrue(addStart.getRequires().contains(addCoveredByInLifeline1_1));
- assertTrue(addStart.getRequires().contains(addCoveredInStart));
- assertTrue(addStart.getRequires().contains(addExecutionInStart));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addFinish.getRequires().size()));
- assertTrue(addFinish.getRequires().contains(addFinishInActionExecSpec));
- assertTrue(addFinish.getRequires().contains(addCoveredByInLifeline1_2));
- assertTrue(addFinish.getRequires().contains(addCoveredInFinish));
- assertTrue(addFinish.getRequires().contains(addExecutionInFinish));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(3), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addCoveredInStart.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInStart.getEquivalence().getDifferences()
- .size()));
- assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredInStart));
- assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_1));
-
- assertNotNull(addCoveredInFinish.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInFinish.getEquivalence().getDifferences()
- .size()));
- assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredInFinish));
- assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_2));
-
- assertNotNull(addCoveredInActionExecSpec.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInActionExecSpec.getEquivalence()
- .getDifferences().size()));
- assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
- addCoveredInActionExecSpec));
- assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
- addCoveredByInLifeline1_3));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.executionSpecification;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.executionSpecification.data.ExecutionSpecificationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddActionExecutionSpecificationTest extends AbstractUMLTest {
+
+ private ExecutionSpecificationInputData input = new ExecutionSpecificationInputData();
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 14 differences
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addActionExecSpecDescription = null;
+ Predicate<? super Diff> addCoveredInStartDescription = null;
+ Predicate<? super Diff> addExecutionInStartDescription = null;
+ Predicate<? super Diff> addCoveredInFinishDescription = null;
+ Predicate<? super Diff> addExecutionInFinishDescription = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description1 = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description2 = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description3 = null;
+ Predicate<? super Diff> addFinishInActionExecSpecDescription = null;
+ Predicate<? super Diff> addStartInActionExecSpecDescription = null;
+ Predicate<? super Diff> addStartDescription = null;
+ Predicate<? super Diff> addFinishDescription = null;
+ Predicate<? super Diff> addCoveredInActionExecSpecDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addActionExecSpecDescription = removed("model.interaction0.ActionExecSpec0"); //$NON-NLS-1$
+ addStartDescription = removed("model.interaction0.ActionExecSpec0Start0"); //$NON-NLS-1$
+ addFinishDescription = removed("model.interaction0.ActionExecSpec0Finish0"); //$NON-NLS-1$
+ addCoveredInStartDescription = removedFromReference("model.interaction0.ActionExecSpec0Start0",
+ "covered", "model.interaction0.Lifeline1");
+ addExecutionInStartDescription = changedReference("model.interaction0.ActionExecSpec0Start0",
+ "execution", "model.interaction0.ActionExecSpec0", null);
+ addCoveredInFinishDescription = removedFromReference("model.interaction0.ActionExecSpec0Finish0",
+ "covered", "model.interaction0.Lifeline1");
+ addExecutionInFinishDescription = changedReference("model.interaction0.ActionExecSpec0Finish0",
+ "execution", "model.interaction0.ActionExecSpec0", null);
+ addFinishInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
+ "finish", "model.interaction0.ActionExecSpec0Finish0", null);
+ addStartInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
+ "start", "model.interaction0.ActionExecSpec0Start0", null);
+ addCoveredByInLifeline1Description1 = removedFromReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0Start0");
+ addCoveredByInLifeline1Description2 = removedFromReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0Finish0");
+ addCoveredByInLifeline1Description3 = removedFromReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0");
+ addCoveredInActionExecSpecDescription = removedFromReference(
+ "model.interaction0.ActionExecSpec0", "covered", "model.interaction0.Lifeline1");
+ } else {
+ addActionExecSpecDescription = added("model.interaction0.ActionExecSpec0"); //$NON-NLS-1$
+ addStartDescription = added("model.interaction0.ActionExecSpec0Start0"); //$NON-NLS-1$
+ addFinishDescription = added("model.interaction0.ActionExecSpec0Finish0");
+ addCoveredInStartDescription = addedToReference("model.interaction0.ActionExecSpec0Start0",
+ "covered", "model.interaction0.Lifeline1");
+ addExecutionInStartDescription = changedReference("model.interaction0.ActionExecSpec0Start0",
+ "execution", null, "model.interaction0.ActionExecSpec0");
+ addCoveredInFinishDescription = addedToReference("model.interaction0.ActionExecSpec0Finish0",
+ "covered", "model.interaction0.Lifeline1");
+ addExecutionInFinishDescription = changedReference("model.interaction0.ActionExecSpec0Finish0",
+ "execution", null, "model.interaction0.ActionExecSpec0");
+ addFinishInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
+ "finish", null, "model.interaction0.ActionExecSpec0Finish0");
+ addStartInActionExecSpecDescription = changedReference("model.interaction0.ActionExecSpec0",
+ "start", null, "model.interaction0.ActionExecSpec0Start0");
+ addCoveredByInLifeline1Description1 = addedToReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0Start0");
+ addCoveredByInLifeline1Description2 = addedToReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0Finish0");
+ addCoveredByInLifeline1Description3 = addedToReference("model.interaction0.Lifeline1",
+ "coveredBy", "model.interaction0.ActionExecSpec0");
+ addCoveredInActionExecSpecDescription = addedToReference("model.interaction0.ActionExecSpec0",
+ "covered", "model.interaction0.Lifeline1");
+ }
+
+ final Diff addActionExecSpec = Iterators.find(differences.iterator(), addActionExecSpecDescription);
+ final Diff addCoveredInStart = Iterators.find(differences.iterator(), addCoveredInStartDescription);
+ final Diff addExecutionInStart = Iterators.find(differences.iterator(),
+ addExecutionInStartDescription);
+ final Diff addCoveredInFinish = Iterators.find(differences.iterator(), addCoveredInFinishDescription);
+ final Diff addExecutionInFinish = Iterators.find(differences.iterator(),
+ addExecutionInFinishDescription);
+ final Diff addFinishInActionExecSpec = Iterators.find(differences.iterator(),
+ addFinishInActionExecSpecDescription);
+ final Diff addStartInActionExecSpec = Iterators.find(differences.iterator(),
+ addStartInActionExecSpecDescription);
+ final Diff addCoveredByInLifeline1_1 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description1);
+ final Diff addCoveredByInLifeline1_2 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description2);
+ final Diff addCoveredByInLifeline1_3 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description3);
+ final Diff addStart = Iterators.find(differences.iterator(), addStartDescription);
+ final Diff addFinish = Iterators.find(differences.iterator(), addFinishDescription);
+ final Diff addCoveredInActionExecSpec = Iterators.find(differences.iterator(),
+ addCoveredInActionExecSpecDescription);
+
+ assertNotNull(addActionExecSpec);
+ assertNotNull(addCoveredInStart);
+ assertNotNull(addExecutionInStart);
+ assertNotNull(addCoveredInFinish);
+ assertNotNull(addExecutionInFinish);
+ assertNotNull(addFinishInActionExecSpec);
+ assertNotNull(addStartInActionExecSpec);
+ assertNotNull(addCoveredByInLifeline1_1);
+ assertNotNull(addCoveredByInLifeline1_2);
+ assertNotNull(addCoveredByInLifeline1_3);
+ assertNotNull(addStart);
+ assertNotNull(addFinish);
+ assertNotNull(addCoveredInActionExecSpec);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(ExecutionSpecificationChange.class)));
+ Diff addUMLMessage = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLMessage = Iterators.find(differences.iterator(), and(
+ instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLMessage = Iterators.find(differences.iterator(), and(
+ instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLMessage);
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLMessage.getRefinedBy().size()));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addFinishInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addStartInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInStart));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_1));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_2));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addStart));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_3));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInStart));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInStart.getRequires().size()));
+ assertTrue(addCoveredInStart.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInStart.getRequires().size()));
+ assertTrue(addExecutionInStart.getRequires().contains(addStart));
+ assertTrue(addExecutionInStart.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInFinish.getRequires().size()));
+ assertTrue(addCoveredInFinish.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInFinish.getRequires().size()));
+ assertTrue(addExecutionInFinish.getRequires().contains(addFinish));
+ assertTrue(addExecutionInFinish.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
+ assertTrue(addFinishInActionExecSpec.getRequires().contains(addActionExecSpec));
+ assertTrue(addFinishInActionExecSpec.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
+ assertTrue(addStartInActionExecSpec.getRequires().contains(addActionExecSpec));
+ assertTrue(addStartInActionExecSpec.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_1.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_2.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_3.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
+ assertTrue(addCoveredInActionExecSpec.getRequires().contains(addActionExecSpec));
+
+ } else {
+ assertSame(Integer.valueOf(6), Integer.valueOf(addActionExecSpec.getRequires().size()));
+ assertTrue(addActionExecSpec.getRequires().contains(addFinishInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addStartInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addCoveredInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addExecutionInFinish));
+ assertTrue(addActionExecSpec.getRequires().contains(addExecutionInStart));
+ assertTrue(addActionExecSpec.getRequires().contains(addCoveredByInLifeline1_3));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addStart.getRequires().size()));
+ assertTrue(addStart.getRequires().contains(addStartInActionExecSpec));
+ assertTrue(addStart.getRequires().contains(addCoveredByInLifeline1_1));
+ assertTrue(addStart.getRequires().contains(addCoveredInStart));
+ assertTrue(addStart.getRequires().contains(addExecutionInStart));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addFinish.getRequires().size()));
+ assertTrue(addFinish.getRequires().contains(addFinishInActionExecSpec));
+ assertTrue(addFinish.getRequires().contains(addCoveredByInLifeline1_2));
+ assertTrue(addFinish.getRequires().contains(addCoveredInFinish));
+ assertTrue(addFinish.getRequires().contains(addExecutionInFinish));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(3), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addCoveredInStart.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInStart.getEquivalence().getDifferences()
+ .size()));
+ assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredInStart));
+ assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_1));
+
+ assertNotNull(addCoveredInFinish.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInFinish.getEquivalence().getDifferences()
+ .size()));
+ assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredInFinish));
+ assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_2));
+
+ assertNotNull(addCoveredInActionExecSpec.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInActionExecSpec.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
+ addCoveredInActionExecSpec));
+ assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
+ addCoveredByInLifeline1_3));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddBehaviorExecutionSpecificationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddBehaviorExecutionSpecificationTest.java
index 34d66ba3d..09e6a1358 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddBehaviorExecutionSpecificationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/AddBehaviorExecutionSpecificationTest.java
@@ -1,333 +1,333 @@
-package org.eclipse.emf.compare.uml2.tests.executionSpecification;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.executionSpecification.data.ExecutionSpecificationInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddBehaviorExecutionSpecificationTest extends AbstractUMLTest {
-
- private ExecutionSpecificationInputData input = new ExecutionSpecificationInputData();
-
- @Test
- public void testA20UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA21UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA20UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA21UseCase3way() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 14 differences
- assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
-
- Predicate<? super Diff> addActionExecSpecDescription = null;
- Predicate<? super Diff> addCoveredInStartDescription = null;
- Predicate<? super Diff> addExecutionInStartDescription = null;
- Predicate<? super Diff> addCoveredInFinishDescription = null;
- Predicate<? super Diff> addExecutionInFinishDescription = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description1 = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description2 = null;
- Predicate<? super Diff> addCoveredByInLifeline1Description3 = null;
- Predicate<? super Diff> addFinishInActionExecSpecDescription = null;
- Predicate<? super Diff> addStartInActionExecSpecDescription = null;
- Predicate<? super Diff> addStartDescription = null;
- Predicate<? super Diff> addFinishDescription = null;
- Predicate<? super Diff> addCoveredInActionExecSpecDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addActionExecSpecDescription = removed("model.interaction0.BehaviorExecSpec0"); //$NON-NLS-1$
- addStartDescription = removed("model.interaction0.BehaviorExecSpec0Start0"); //$NON-NLS-1$
- addFinishDescription = removed("model.interaction0.BehaviorExecSpec0Finish0"); //$NON-NLS-1$
- addCoveredInStartDescription = removedFromReference("model.interaction0.BehaviorExecSpec0Start0",
- "covered", "model.interaction0.Lifeline2");
- addExecutionInStartDescription = changedReference("model.interaction0.BehaviorExecSpec0Start0",
- "execution", "model.interaction0.BehaviorExecSpec0", null);
- addCoveredInFinishDescription = removedFromReference(
- "model.interaction0.BehaviorExecSpec0Finish0", "covered", "model.interaction0.Lifeline2");
- addExecutionInFinishDescription = changedReference("model.interaction0.BehaviorExecSpec0Finish0",
- "execution", "model.interaction0.BehaviorExecSpec0", null);
- addFinishInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
- "finish", "model.interaction0.BehaviorExecSpec0Finish0", null);
- addStartInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
- "start", "model.interaction0.BehaviorExecSpec0Start0", null);
- addCoveredByInLifeline1Description1 = removedFromReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0Start0");
- addCoveredByInLifeline1Description2 = removedFromReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0Finish0");
- addCoveredByInLifeline1Description3 = removedFromReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0");
- addCoveredInActionExecSpecDescription = removedFromReference(
- "model.interaction0.BehaviorExecSpec0", "covered", "model.interaction0.Lifeline2");
- } else {
- addActionExecSpecDescription = added("model.interaction0.BehaviorExecSpec0"); //$NON-NLS-1$
- addStartDescription = added("model.interaction0.BehaviorExecSpec0Start0"); //$NON-NLS-1$
- addFinishDescription = added("model.interaction0.BehaviorExecSpec0Finish0");
- addCoveredInStartDescription = addedToReference("model.interaction0.BehaviorExecSpec0Start0",
- "covered", "model.interaction0.Lifeline2");
- addExecutionInStartDescription = changedReference("model.interaction0.BehaviorExecSpec0Start0",
- "execution", null, "model.interaction0.BehaviorExecSpec0");
- addCoveredInFinishDescription = addedToReference("model.interaction0.BehaviorExecSpec0Finish0",
- "covered", "model.interaction0.Lifeline2");
- addExecutionInFinishDescription = changedReference("model.interaction0.BehaviorExecSpec0Finish0",
- "execution", null, "model.interaction0.BehaviorExecSpec0");
- addFinishInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
- "finish", null, "model.interaction0.BehaviorExecSpec0Finish0");
- addStartInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
- "start", null, "model.interaction0.BehaviorExecSpec0Start0");
- addCoveredByInLifeline1Description1 = addedToReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0Start0");
- addCoveredByInLifeline1Description2 = addedToReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0Finish0");
- addCoveredByInLifeline1Description3 = addedToReference("model.interaction0.Lifeline2",
- "coveredBy", "model.interaction0.BehaviorExecSpec0");
- addCoveredInActionExecSpecDescription = addedToReference("model.interaction0.BehaviorExecSpec0",
- "covered", "model.interaction0.Lifeline2");
- }
-
- final Diff addActionExecSpec = Iterators.find(differences.iterator(), addActionExecSpecDescription);
- final Diff addCoveredInStart = Iterators.find(differences.iterator(), addCoveredInStartDescription);
- final Diff addExecutionInStart = Iterators.find(differences.iterator(),
- addExecutionInStartDescription);
- final Diff addCoveredInFinish = Iterators.find(differences.iterator(), addCoveredInFinishDescription);
- final Diff addExecutionInFinish = Iterators.find(differences.iterator(),
- addExecutionInFinishDescription);
- final Diff addFinishInActionExecSpec = Iterators.find(differences.iterator(),
- addFinishInActionExecSpecDescription);
- final Diff addStartInActionExecSpec = Iterators.find(differences.iterator(),
- addStartInActionExecSpecDescription);
- final Diff addCoveredByInLifeline1_1 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description1);
- final Diff addCoveredByInLifeline1_2 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description2);
- final Diff addCoveredByInLifeline1_3 = Iterators.find(differences.iterator(),
- addCoveredByInLifeline1Description3);
- final Diff addStart = Iterators.find(differences.iterator(), addStartDescription);
- final Diff addFinish = Iterators.find(differences.iterator(), addFinishDescription);
- final Diff addCoveredInActionExecSpec = Iterators.find(differences.iterator(),
- addCoveredInActionExecSpecDescription);
-
- assertNotNull(addActionExecSpec);
- assertNotNull(addCoveredInStart);
- assertNotNull(addExecutionInStart);
- assertNotNull(addCoveredInFinish);
- assertNotNull(addExecutionInFinish);
- assertNotNull(addFinishInActionExecSpec);
- assertNotNull(addStartInActionExecSpec);
- assertNotNull(addCoveredByInLifeline1_1);
- assertNotNull(addCoveredByInLifeline1_2);
- assertNotNull(addCoveredByInLifeline1_3);
- assertNotNull(addStart);
- assertNotNull(addFinish);
- assertNotNull(addCoveredInActionExecSpec);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(ExecutionSpecificationChange.class)));
- Diff addUMLMessage = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLMessage = Iterators.find(differences.iterator(), and(
- instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLMessage = Iterators.find(differences.iterator(), and(
- instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLMessage);
- assertSame(Integer.valueOf(13), Integer.valueOf(addUMLMessage.getRefinedBy().size()));
- assertTrue(addUMLMessage.getRefinedBy().contains(addFinishInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addStartInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInStart));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_1));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_2));
- assertTrue(addUMLMessage.getRefinedBy().contains(addStart));
- assertTrue(addUMLMessage.getRefinedBy().contains(addFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addActionExecSpec));
- assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInStart));
- assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInFinish));
- assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_3));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInStart.getRequires().size()));
- assertTrue(addCoveredInStart.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInStart.getRequires().size()));
- assertTrue(addExecutionInStart.getRequires().contains(addStart));
- assertTrue(addExecutionInStart.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInFinish.getRequires().size()));
- assertTrue(addCoveredInFinish.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInFinish.getRequires().size()));
- assertTrue(addExecutionInFinish.getRequires().contains(addFinish));
- assertTrue(addExecutionInFinish.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
- assertTrue(addFinishInActionExecSpec.getRequires().contains(addActionExecSpec));
- assertTrue(addFinishInActionExecSpec.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
- assertTrue(addStartInActionExecSpec.getRequires().contains(addActionExecSpec));
- assertTrue(addStartInActionExecSpec.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_1.getRequires().contains(addStart));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_2.getRequires().contains(addFinish));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
- assertTrue(addCoveredByInLifeline1_3.getRequires().contains(addActionExecSpec));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
- assertTrue(addCoveredInActionExecSpec.getRequires().contains(addActionExecSpec));
-
- } else {
- assertSame(Integer.valueOf(6), Integer.valueOf(addActionExecSpec.getRequires().size()));
- assertTrue(addActionExecSpec.getRequires().contains(addFinishInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addStartInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addCoveredInActionExecSpec));
- assertTrue(addActionExecSpec.getRequires().contains(addExecutionInFinish));
- assertTrue(addActionExecSpec.getRequires().contains(addExecutionInStart));
- assertTrue(addActionExecSpec.getRequires().contains(addCoveredByInLifeline1_3));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInStart.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInFinish.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addStart.getRequires().size()));
- assertTrue(addStart.getRequires().contains(addStartInActionExecSpec));
- assertTrue(addStart.getRequires().contains(addCoveredByInLifeline1_1));
- assertTrue(addStart.getRequires().contains(addCoveredInStart));
- assertTrue(addStart.getRequires().contains(addExecutionInStart));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addFinish.getRequires().size()));
- assertTrue(addFinish.getRequires().contains(addFinishInActionExecSpec));
- assertTrue(addFinish.getRequires().contains(addCoveredByInLifeline1_2));
- assertTrue(addFinish.getRequires().contains(addCoveredInFinish));
- assertTrue(addFinish.getRequires().contains(addExecutionInFinish));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(3), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addCoveredInStart.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInStart.getEquivalence().getDifferences()
- .size()));
- assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredInStart));
- assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_1));
-
- assertNotNull(addCoveredInFinish.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInFinish.getEquivalence().getDifferences()
- .size()));
- assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredInFinish));
- assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_2));
-
- assertNotNull(addCoveredInActionExecSpec.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInActionExecSpec.getEquivalence()
- .getDifferences().size()));
- assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
- addCoveredInActionExecSpec));
- assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
- addCoveredByInLifeline1_3));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.executionSpecification;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.executionSpecification.data.ExecutionSpecificationInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddBehaviorExecutionSpecificationTest extends AbstractUMLTest {
+
+ private ExecutionSpecificationInputData input = new ExecutionSpecificationInputData();
+
+ @Test
+ public void testA20UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA21UseCase() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA20UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA21UseCase3way() throws IOException {
+ final Resource left = input.getA2Left();
+ final Resource right = input.getA2Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 14 differences
+ assertSame(Integer.valueOf(14), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> addActionExecSpecDescription = null;
+ Predicate<? super Diff> addCoveredInStartDescription = null;
+ Predicate<? super Diff> addExecutionInStartDescription = null;
+ Predicate<? super Diff> addCoveredInFinishDescription = null;
+ Predicate<? super Diff> addExecutionInFinishDescription = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description1 = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description2 = null;
+ Predicate<? super Diff> addCoveredByInLifeline1Description3 = null;
+ Predicate<? super Diff> addFinishInActionExecSpecDescription = null;
+ Predicate<? super Diff> addStartInActionExecSpecDescription = null;
+ Predicate<? super Diff> addStartDescription = null;
+ Predicate<? super Diff> addFinishDescription = null;
+ Predicate<? super Diff> addCoveredInActionExecSpecDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addActionExecSpecDescription = removed("model.interaction0.BehaviorExecSpec0"); //$NON-NLS-1$
+ addStartDescription = removed("model.interaction0.BehaviorExecSpec0Start0"); //$NON-NLS-1$
+ addFinishDescription = removed("model.interaction0.BehaviorExecSpec0Finish0"); //$NON-NLS-1$
+ addCoveredInStartDescription = removedFromReference("model.interaction0.BehaviorExecSpec0Start0",
+ "covered", "model.interaction0.Lifeline2");
+ addExecutionInStartDescription = changedReference("model.interaction0.BehaviorExecSpec0Start0",
+ "execution", "model.interaction0.BehaviorExecSpec0", null);
+ addCoveredInFinishDescription = removedFromReference(
+ "model.interaction0.BehaviorExecSpec0Finish0", "covered", "model.interaction0.Lifeline2");
+ addExecutionInFinishDescription = changedReference("model.interaction0.BehaviorExecSpec0Finish0",
+ "execution", "model.interaction0.BehaviorExecSpec0", null);
+ addFinishInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
+ "finish", "model.interaction0.BehaviorExecSpec0Finish0", null);
+ addStartInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
+ "start", "model.interaction0.BehaviorExecSpec0Start0", null);
+ addCoveredByInLifeline1Description1 = removedFromReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0Start0");
+ addCoveredByInLifeline1Description2 = removedFromReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0Finish0");
+ addCoveredByInLifeline1Description3 = removedFromReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0");
+ addCoveredInActionExecSpecDescription = removedFromReference(
+ "model.interaction0.BehaviorExecSpec0", "covered", "model.interaction0.Lifeline2");
+ } else {
+ addActionExecSpecDescription = added("model.interaction0.BehaviorExecSpec0"); //$NON-NLS-1$
+ addStartDescription = added("model.interaction0.BehaviorExecSpec0Start0"); //$NON-NLS-1$
+ addFinishDescription = added("model.interaction0.BehaviorExecSpec0Finish0");
+ addCoveredInStartDescription = addedToReference("model.interaction0.BehaviorExecSpec0Start0",
+ "covered", "model.interaction0.Lifeline2");
+ addExecutionInStartDescription = changedReference("model.interaction0.BehaviorExecSpec0Start0",
+ "execution", null, "model.interaction0.BehaviorExecSpec0");
+ addCoveredInFinishDescription = addedToReference("model.interaction0.BehaviorExecSpec0Finish0",
+ "covered", "model.interaction0.Lifeline2");
+ addExecutionInFinishDescription = changedReference("model.interaction0.BehaviorExecSpec0Finish0",
+ "execution", null, "model.interaction0.BehaviorExecSpec0");
+ addFinishInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
+ "finish", null, "model.interaction0.BehaviorExecSpec0Finish0");
+ addStartInActionExecSpecDescription = changedReference("model.interaction0.BehaviorExecSpec0",
+ "start", null, "model.interaction0.BehaviorExecSpec0Start0");
+ addCoveredByInLifeline1Description1 = addedToReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0Start0");
+ addCoveredByInLifeline1Description2 = addedToReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0Finish0");
+ addCoveredByInLifeline1Description3 = addedToReference("model.interaction0.Lifeline2",
+ "coveredBy", "model.interaction0.BehaviorExecSpec0");
+ addCoveredInActionExecSpecDescription = addedToReference("model.interaction0.BehaviorExecSpec0",
+ "covered", "model.interaction0.Lifeline2");
+ }
+
+ final Diff addActionExecSpec = Iterators.find(differences.iterator(), addActionExecSpecDescription);
+ final Diff addCoveredInStart = Iterators.find(differences.iterator(), addCoveredInStartDescription);
+ final Diff addExecutionInStart = Iterators.find(differences.iterator(),
+ addExecutionInStartDescription);
+ final Diff addCoveredInFinish = Iterators.find(differences.iterator(), addCoveredInFinishDescription);
+ final Diff addExecutionInFinish = Iterators.find(differences.iterator(),
+ addExecutionInFinishDescription);
+ final Diff addFinishInActionExecSpec = Iterators.find(differences.iterator(),
+ addFinishInActionExecSpecDescription);
+ final Diff addStartInActionExecSpec = Iterators.find(differences.iterator(),
+ addStartInActionExecSpecDescription);
+ final Diff addCoveredByInLifeline1_1 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description1);
+ final Diff addCoveredByInLifeline1_2 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description2);
+ final Diff addCoveredByInLifeline1_3 = Iterators.find(differences.iterator(),
+ addCoveredByInLifeline1Description3);
+ final Diff addStart = Iterators.find(differences.iterator(), addStartDescription);
+ final Diff addFinish = Iterators.find(differences.iterator(), addFinishDescription);
+ final Diff addCoveredInActionExecSpec = Iterators.find(differences.iterator(),
+ addCoveredInActionExecSpecDescription);
+
+ assertNotNull(addActionExecSpec);
+ assertNotNull(addCoveredInStart);
+ assertNotNull(addExecutionInStart);
+ assertNotNull(addCoveredInFinish);
+ assertNotNull(addExecutionInFinish);
+ assertNotNull(addFinishInActionExecSpec);
+ assertNotNull(addStartInActionExecSpec);
+ assertNotNull(addCoveredByInLifeline1_1);
+ assertNotNull(addCoveredByInLifeline1_2);
+ assertNotNull(addCoveredByInLifeline1_3);
+ assertNotNull(addStart);
+ assertNotNull(addFinish);
+ assertNotNull(addCoveredInActionExecSpec);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(ExecutionSpecificationChange.class)));
+ Diff addUMLMessage = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLMessage = Iterators.find(differences.iterator(), and(
+ instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLMessage = Iterators.find(differences.iterator(), and(
+ instanceOf(ExecutionSpecificationChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLMessage);
+ assertSame(Integer.valueOf(13), Integer.valueOf(addUMLMessage.getRefinedBy().size()));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addFinishInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addStartInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInStart));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredInActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_1));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_2));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addStart));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addActionExecSpec));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInStart));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addExecutionInFinish));
+ assertTrue(addUMLMessage.getRefinedBy().contains(addCoveredByInLifeline1_3));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInStart.getRequires().size()));
+ assertTrue(addCoveredInStart.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInStart.getRequires().size()));
+ assertTrue(addExecutionInStart.getRequires().contains(addStart));
+ assertTrue(addExecutionInStart.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInFinish.getRequires().size()));
+ assertTrue(addCoveredInFinish.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addExecutionInFinish.getRequires().size()));
+ assertTrue(addExecutionInFinish.getRequires().contains(addFinish));
+ assertTrue(addExecutionInFinish.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
+ assertTrue(addFinishInActionExecSpec.getRequires().contains(addActionExecSpec));
+ assertTrue(addFinishInActionExecSpec.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
+ assertTrue(addStartInActionExecSpec.getRequires().contains(addActionExecSpec));
+ assertTrue(addStartInActionExecSpec.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_1.getRequires().contains(addStart));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_2.getRequires().contains(addFinish));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
+ assertTrue(addCoveredByInLifeline1_3.getRequires().contains(addActionExecSpec));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
+ assertTrue(addCoveredInActionExecSpec.getRequires().contains(addActionExecSpec));
+
+ } else {
+ assertSame(Integer.valueOf(6), Integer.valueOf(addActionExecSpec.getRequires().size()));
+ assertTrue(addActionExecSpec.getRequires().contains(addFinishInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addStartInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addCoveredInActionExecSpec));
+ assertTrue(addActionExecSpec.getRequires().contains(addExecutionInFinish));
+ assertTrue(addActionExecSpec.getRequires().contains(addExecutionInStart));
+ assertTrue(addActionExecSpec.getRequires().contains(addCoveredByInLifeline1_3));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInStart.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addExecutionInFinish.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addFinishInActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addStartInActionExecSpec.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_1.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_2.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredByInLifeline1_3.getRequires().size()));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addStart.getRequires().size()));
+ assertTrue(addStart.getRequires().contains(addStartInActionExecSpec));
+ assertTrue(addStart.getRequires().contains(addCoveredByInLifeline1_1));
+ assertTrue(addStart.getRequires().contains(addCoveredInStart));
+ assertTrue(addStart.getRequires().contains(addExecutionInStart));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addFinish.getRequires().size()));
+ assertTrue(addFinish.getRequires().contains(addFinishInActionExecSpec));
+ assertTrue(addFinish.getRequires().contains(addCoveredByInLifeline1_2));
+ assertTrue(addFinish.getRequires().contains(addCoveredInFinish));
+ assertTrue(addFinish.getRequires().contains(addExecutionInFinish));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addCoveredInActionExecSpec.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(3), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addCoveredInStart.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInStart.getEquivalence().getDifferences()
+ .size()));
+ assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredInStart));
+ assertTrue(addCoveredInStart.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_1));
+
+ assertNotNull(addCoveredInFinish.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInFinish.getEquivalence().getDifferences()
+ .size()));
+ assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredInFinish));
+ assertTrue(addCoveredInFinish.getEquivalence().getDifferences().contains(addCoveredByInLifeline1_2));
+
+ assertNotNull(addCoveredInActionExecSpec.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addCoveredInActionExecSpec.getEquivalence()
+ .getDifferences().size()));
+ assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
+ addCoveredInActionExecSpec));
+ assertTrue(addCoveredInActionExecSpec.getEquivalence().getDifferences().contains(
+ addCoveredByInLifeline1_3));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/data/ExecutionSpecificationInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/data/ExecutionSpecificationInputData.java
index 65d3b0d76..eb7b04a1b 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/data/ExecutionSpecificationInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/executionSpecification/data/ExecutionSpecificationInputData.java
@@ -1,25 +1,25 @@
-package org.eclipse.emf.compare.uml2.tests.executionSpecification.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class ExecutionSpecificationInputData extends AbstractUMLInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Left() throws IOException {
- return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA2Right() throws IOException {
- return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.executionSpecification.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class ExecutionSpecificationInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Left() throws IOException {
+ return loadFromClassLoader("a2/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA2Right() throws IOException {
+ return loadFromClassLoader("a2/right.uml"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/AddExtendTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/AddExtendTest.java
index af991bb86..ae68b2206 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/AddExtendTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/AddExtendTest.java
@@ -1,177 +1,177 @@
-package org.eclipse.emf.compare.uml2.tests.extend;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.ExtendChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.extend.data.ExtendInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddExtendTest extends AbstractUMLTest {
-
- private ExtendInputData input = new ExtendInputData();
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(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> addExtendDescription = null;
- Predicate<? super Diff> changeRefExtendedCaseInExtendDescription = null;
- Predicate<? super Diff> addRefExtensionLocationInExtendDescription = null;
- Predicate<? super Diff> addExtensionPointDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addExtendDescription = removed("model.UseCase2.useCase2Extension"); //$NON-NLS-1$
- changeRefExtendedCaseInExtendDescription = changedReference("model.UseCase2.useCase2Extension",
- "extendedCase", "model.UseCase1", null);
- addRefExtensionLocationInExtendDescription = removedFromReference(
- "model.UseCase2.useCase2Extension", "extensionLocation", "model.UseCase1.point");
- addExtensionPointDescription = removed("model.UseCase1.point");
- } else {
- addExtendDescription = added("model.UseCase2.useCase2Extension"); //$NON-NLS-1$
- changeRefExtendedCaseInExtendDescription = changedReference("model.UseCase2.useCase2Extension",
- "extendedCase", null, "model.UseCase1");
- addRefExtensionLocationInExtendDescription = addedToReference("model.UseCase2.useCase2Extension",
- "extensionLocation", "model.UseCase1.point");
- addExtensionPointDescription = added("model.UseCase1.point");
- }
-
- final Diff addExtend = Iterators.find(differences.iterator(), addExtendDescription);
- final Diff addRefExtendedCaseInExtend = Iterators.find(differences.iterator(),
- changeRefExtendedCaseInExtendDescription);
- final Diff addRefExtensionLocationInExtend = Iterators.find(differences.iterator(),
- addRefExtensionLocationInExtendDescription);
- final Diff addExtensionPoint = Iterators.find(differences.iterator(), addExtensionPointDescription);
-
- assertNotNull(addExtend);
- assertNotNull(addRefExtendedCaseInExtend);
- assertNotNull(addRefExtensionLocationInExtend);
- assertNotNull(addExtensionPoint);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(ExtendChange.class)));
- Diff addUMLExtend = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLExtend = Iterators.find(differences.iterator(), and(instanceOf(ExtendChange.class),
- ofKind(DifferenceKind.ADD)));
- } else {
- addUMLExtend = Iterators.find(differences.iterator(), and(instanceOf(ExtendChange.class),
- ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLExtend);
- assertSame(Integer.valueOf(4), Integer.valueOf(addUMLExtend.getRefinedBy().size()));
- assertTrue(addUMLExtend.getRefinedBy().contains(addRefExtendedCaseInExtend));
- assertTrue(addUMLExtend.getRefinedBy().contains(addRefExtensionLocationInExtend));
- assertTrue(addUMLExtend.getRefinedBy().contains(addExtensionPoint));
- assertTrue(addUMLExtend.getRefinedBy().contains(addExtend));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefExtendedCaseInExtend.getRequires().size()));
- assertTrue(addRefExtendedCaseInExtend.getRequires().contains(addExtend));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefExtensionLocationInExtend.getRequires()
- .size()));
- assertTrue(addRefExtensionLocationInExtend.getRequires().contains(addExtend));
- assertTrue(addRefExtensionLocationInExtend.getRequires().contains(addExtensionPoint));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addExtend.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLExtend.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefExtendedCaseInExtend.getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefExtensionLocationInExtend.getRequires()
- .size()));
-
- assertSame(Integer.valueOf(2), Integer.valueOf(addExtend.getRequires().size()));
- assertTrue(addExtend.getRequires().contains(addRefExtendedCaseInExtend));
- assertTrue(addExtend.getRequires().contains(addRefExtensionLocationInExtend));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLExtend.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
-
- testIntersections(comparison);
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.extend;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.ExtendChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.extend.data.ExtendInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddExtendTest extends AbstractUMLTest {
+
+ private ExtendInputData input = new ExtendInputData();
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(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> addExtendDescription = null;
+ Predicate<? super Diff> changeRefExtendedCaseInExtendDescription = null;
+ Predicate<? super Diff> addRefExtensionLocationInExtendDescription = null;
+ Predicate<? super Diff> addExtensionPointDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addExtendDescription = removed("model.UseCase2.useCase2Extension"); //$NON-NLS-1$
+ changeRefExtendedCaseInExtendDescription = changedReference("model.UseCase2.useCase2Extension",
+ "extendedCase", "model.UseCase1", null);
+ addRefExtensionLocationInExtendDescription = removedFromReference(
+ "model.UseCase2.useCase2Extension", "extensionLocation", "model.UseCase1.point");
+ addExtensionPointDescription = removed("model.UseCase1.point");
+ } else {
+ addExtendDescription = added("model.UseCase2.useCase2Extension"); //$NON-NLS-1$
+ changeRefExtendedCaseInExtendDescription = changedReference("model.UseCase2.useCase2Extension",
+ "extendedCase", null, "model.UseCase1");
+ addRefExtensionLocationInExtendDescription = addedToReference("model.UseCase2.useCase2Extension",
+ "extensionLocation", "model.UseCase1.point");
+ addExtensionPointDescription = added("model.UseCase1.point");
+ }
+
+ final Diff addExtend = Iterators.find(differences.iterator(), addExtendDescription);
+ final Diff addRefExtendedCaseInExtend = Iterators.find(differences.iterator(),
+ changeRefExtendedCaseInExtendDescription);
+ final Diff addRefExtensionLocationInExtend = Iterators.find(differences.iterator(),
+ addRefExtensionLocationInExtendDescription);
+ final Diff addExtensionPoint = Iterators.find(differences.iterator(), addExtensionPointDescription);
+
+ assertNotNull(addExtend);
+ assertNotNull(addRefExtendedCaseInExtend);
+ assertNotNull(addRefExtensionLocationInExtend);
+ assertNotNull(addExtensionPoint);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(ExtendChange.class)));
+ Diff addUMLExtend = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLExtend = Iterators.find(differences.iterator(), and(instanceOf(ExtendChange.class),
+ ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLExtend = Iterators.find(differences.iterator(), and(instanceOf(ExtendChange.class),
+ ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLExtend);
+ assertSame(Integer.valueOf(4), Integer.valueOf(addUMLExtend.getRefinedBy().size()));
+ assertTrue(addUMLExtend.getRefinedBy().contains(addRefExtendedCaseInExtend));
+ assertTrue(addUMLExtend.getRefinedBy().contains(addRefExtensionLocationInExtend));
+ assertTrue(addUMLExtend.getRefinedBy().contains(addExtensionPoint));
+ assertTrue(addUMLExtend.getRefinedBy().contains(addExtend));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefExtendedCaseInExtend.getRequires().size()));
+ assertTrue(addRefExtendedCaseInExtend.getRequires().contains(addExtend));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefExtensionLocationInExtend.getRequires()
+ .size()));
+ assertTrue(addRefExtensionLocationInExtend.getRequires().contains(addExtend));
+ assertTrue(addRefExtensionLocationInExtend.getRequires().contains(addExtensionPoint));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addExtend.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLExtend.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefExtendedCaseInExtend.getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefExtensionLocationInExtend.getRequires()
+ .size()));
+
+ assertSame(Integer.valueOf(2), Integer.valueOf(addExtend.getRequires().size()));
+ assertTrue(addExtend.getRequires().contains(addRefExtendedCaseInExtend));
+ assertTrue(addExtend.getRequires().contains(addRefExtensionLocationInExtend));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLExtend.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(0), Integer.valueOf(comparison.getEquivalences().size()));
+
+ testIntersections(comparison);
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/ExtendInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/ExtendInputData.java
index de8f2b608..3f7f8b44a 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/ExtendInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/ExtendInputData.java
@@ -1,17 +1,17 @@
-package org.eclipse.emf.compare.uml2.tests.extend.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class ExtendInputData extends AbstractUMLInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.extend.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class ExtendInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/a1/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/a1/left.uml
index ec2e7d080..10cca1e9a 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/a1/left.uml
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/extend/data/a1/left.uml
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_7VF30YdpEeCq9MraWB7Llg" name="model">
- <packagedElement xmi:type="uml:Actor" xmi:id="_83gFwIdpEeCq9MraWB7Llg" name="Actor"/>
- <packagedElement xmi:type="uml:UseCase" xmi:id="_-x-1cIdpEeCq9MraWB7Llg" name="UseCase"/>
- <packagedElement xmi:type="uml:UseCase" xmi:id="__HpjcIdpEeCq9MraWB7Llg" name="UseCase1">
- <extensionPoint xmi:id="_ZT1jgIdqEeCq9MraWB7Llg" name="point"/>
- </packagedElement>
- <packagedElement xmi:type="uml:UseCase" xmi:id="__eJ-8IdpEeCq9MraWB7Llg" name="UseCase2">
- <extend xmi:id="_ZTsZkIdqEeCq9MraWB7Llg" name="useCase2Extension" extendedCase="__HpjcIdpEeCq9MraWB7Llg" extensionLocation="_ZT1jgIdqEeCq9MraWB7Llg"/>
- </packagedElement>
- <packagedElement xmi:type="uml:Package" xmi:id="_Fr898IdqEeCq9MraWB7Llg" name="package">
- <packagedElement xmi:type="uml:Actor" xmi:id="_-fpIQIdpEeCq9MraWB7Llg" name="Actor1"/>
- </packagedElement>
-</uml:Model>
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_7VF30YdpEeCq9MraWB7Llg" name="model">
+ <packagedElement xmi:type="uml:Actor" xmi:id="_83gFwIdpEeCq9MraWB7Llg" name="Actor"/>
+ <packagedElement xmi:type="uml:UseCase" xmi:id="_-x-1cIdpEeCq9MraWB7Llg" name="UseCase"/>
+ <packagedElement xmi:type="uml:UseCase" xmi:id="__HpjcIdpEeCq9MraWB7Llg" name="UseCase1">
+ <extensionPoint xmi:id="_ZT1jgIdqEeCq9MraWB7Llg" name="point"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:UseCase" xmi:id="__eJ-8IdpEeCq9MraWB7Llg" name="UseCase2">
+ <extend xmi:id="_ZTsZkIdqEeCq9MraWB7Llg" name="useCase2Extension" extendedCase="__HpjcIdpEeCq9MraWB7Llg" extensionLocation="_ZT1jgIdqEeCq9MraWB7Llg"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Package" xmi:id="_Fr898IdqEeCq9MraWB7Llg" name="package">
+ <packagedElement xmi:type="uml:Actor" xmi:id="_-fpIQIdpEeCq9MraWB7Llg" name="Actor1"/>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/AddGeneralizationSetTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/AddGeneralizationSetTest.java
index e0fd5b3aa..71e67698e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/AddGeneralizationSetTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/AddGeneralizationSetTest.java
@@ -1,260 +1,260 @@
-package org.eclipse.emf.compare.uml2.tests.generalizationSet;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.referenceValueMatch;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-
-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.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.generalizationSet.data.GeneralizationSetInputData;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class AddGeneralizationSetTest extends AbstractUMLTest {
-
- private GeneralizationSetInputData input = new GeneralizationSetInputData();
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, null);
- testMergeRightToLeft(left, right, null);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(right, left, null);
- testMergeRightToLeft(right, left, null);
- }
-
- @Test
- public void testA10UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
-
- testMergeLeftToRight(left, right, right);
- testMergeRightToLeft(left, right, right);
- }
-
- @Test
- public void testA11UseCase3way() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- final Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
-
- testMergeLeftToRight(left, right, left);
- testMergeRightToLeft(left, right, left);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final 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> addGeneralizationSetDescription = null;
- Predicate<? super Diff> addRefGeneralizationSetInClass2Description = null;
- Predicate<? super Diff> addRefGeneralizationSetInClass0Description = null;
- Predicate<? super Diff> addRefGeneralizationInGeneralizationSetDescription1 = null;
- Predicate<? super Diff> addRefGeneralizationInGeneralizationSetDescription2 = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addGeneralizationSetDescription = removed("model.GeneralizationSet_Class2_Class0"); //$NON-NLS-1$
- addRefGeneralizationSetInClass2Description = removedFromReference1("model.Class2.Class1",
- "generalizationSet", "model.GeneralizationSet_Class2_Class0",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationSetInClass0Description = removedFromReference1("model.Class0.Class1",
- "generalizationSet", "model.GeneralizationSet_Class2_Class0",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationInGeneralizationSetDescription1 = removedFromReference2(
- "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class0.Class1",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationInGeneralizationSetDescription2 = removedFromReference2(
- "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class2.Class1",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- } else {
- addGeneralizationSetDescription = added("model.GeneralizationSet_Class2_Class0"); //$NON-NLS-1$
- addRefGeneralizationSetInClass2Description = addedToReference1("model.Class2.Class1",
- "generalizationSet", "model.GeneralizationSet_Class2_Class0",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationSetInClass0Description = addedToReference1("model.Class0.Class1",
- "generalizationSet", "model.GeneralizationSet_Class2_Class0",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationInGeneralizationSetDescription1 = addedToReference2(
- "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class0.Class1",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- addRefGeneralizationInGeneralizationSetDescription2 = addedToReference2(
- "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class2.Class1",
- UMLPackage.Literals.GENERALIZATION__GENERAL);
- }
-
- final Diff addGeneralizationSet = Iterators.find(differences.iterator(),
- addGeneralizationSetDescription);
- final Diff addRefGeneralizationSetInClass0 = Iterators.find(differences.iterator(),
- addRefGeneralizationSetInClass0Description);
- final Diff addRefGeneralizationSetInClass2 = Iterators.find(differences.iterator(),
- addRefGeneralizationSetInClass2Description);
- final Diff addRefGeneralizationInGeneralizationSet1 = Iterators.find(differences.iterator(),
- addRefGeneralizationInGeneralizationSetDescription1);
- final Diff addRefGeneralizationInGeneralizationSet2 = Iterators.find(differences.iterator(),
- addRefGeneralizationInGeneralizationSetDescription2);
-
- assertNotNull(addGeneralizationSet);
- assertNotNull(addRefGeneralizationSetInClass0);
- assertNotNull(addRefGeneralizationSetInClass2);
- assertNotNull(addRefGeneralizationInGeneralizationSet1);
- assertNotNull(addRefGeneralizationInGeneralizationSet2);
-
- // CHECK EXTENSION
- assertSame(Integer.valueOf(1), count(differences, instanceOf(GeneralizationSetChange.class)));
- Diff addUMLGeneralizationSet = null;
- if (kind.equals(TestKind.ADD)) {
- addUMLGeneralizationSet = Iterators.find(differences.iterator(), and(
- instanceOf(GeneralizationSetChange.class), ofKind(DifferenceKind.ADD)));
- } else {
- addUMLGeneralizationSet = Iterators.find(differences.iterator(), and(
- instanceOf(GeneralizationSetChange.class), ofKind(DifferenceKind.DELETE)));
- }
- assertNotNull(addUMLGeneralizationSet);
- assertSame(Integer.valueOf(5), Integer.valueOf(addUMLGeneralizationSet.getRefinedBy().size()));
- assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationInGeneralizationSet1));
- assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationInGeneralizationSet2));
- assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addGeneralizationSet));
- assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationSetInClass0));
- assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationSetInClass2));
-
- // CHECK REQUIREMENT
- if (kind.equals(TestKind.ADD)) {
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
- .getRequires().size()));
- assertTrue(addRefGeneralizationInGeneralizationSet1.getRequires().contains(addGeneralizationSet));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
- .getRequires().size()));
- assertTrue(addRefGeneralizationInGeneralizationSet2.getRequires().contains(addGeneralizationSet));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationSetInClass0.getRequires()
- .size()));
- assertTrue(addRefGeneralizationSetInClass0.getRequires().contains(addGeneralizationSet));
-
- assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationSetInClass2.getRequires()
- .size()));
- assertTrue(addRefGeneralizationSetInClass2.getRequires().contains(addGeneralizationSet));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addGeneralizationSet.getRequires().size()));
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLGeneralizationSet.getRequires().size()));
- } else {
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
- .getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
- .getRequires().size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationSetInClass0.getRequires()
- .size()));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationSetInClass2.getRequires()
- .size()));
-
- assertSame(Integer.valueOf(4), Integer.valueOf(addGeneralizationSet.getRequires().size()));
- assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationInGeneralizationSet1));
- assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationInGeneralizationSet2));
- assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationSetInClass0));
- assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationSetInClass2));
-
- assertSame(Integer.valueOf(0), Integer.valueOf(addUMLGeneralizationSet.getRequires().size()));
- }
-
- // CHECK EQUIVALENCE
- assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getEquivalences().size()));
-
- assertNotNull(addRefGeneralizationInGeneralizationSet1.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
- .getEquivalence().getDifferences().size()));
- assertTrue(addRefGeneralizationInGeneralizationSet1.getEquivalence().getDifferences().contains(
- addRefGeneralizationSetInClass0));
-
- assertNotNull(addRefGeneralizationInGeneralizationSet2.getEquivalence());
- assertSame(Integer.valueOf(2), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
- .getEquivalence().getDifferences().size()));
- assertTrue(addRefGeneralizationInGeneralizationSet2.getEquivalence().getDifferences().contains(
- addRefGeneralizationSetInClass2));
-
- testIntersections(comparison);
-
- }
-
- public static Predicate<? super Diff> removedFromReference1(final String qualifiedName,
- final String referenceName, final String removedQualifiedName,
- final EStructuralFeature featureDelegate) {
- // This is only meant for multi-valued references
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName, featureDelegate),
- referenceValueMatch(referenceName, removedQualifiedName, true));
- }
-
- public static Predicate<? super Diff> removedFromReference2(final String qualifiedName,
- final String referenceName, final String removedQualifiedName,
- final EStructuralFeature featureDelegate) {
- // This is only meant for multi-valued references
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), referenceValueMatch(
- referenceName, removedQualifiedName, true, featureDelegate));
- }
-
- public static Predicate<? super Diff> addedToReference1(final String qualifiedName,
- final String referenceName, final String removedQualifiedName,
- final EStructuralFeature featureDelegate) {
- // This is only meant for multi-valued references
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName, featureDelegate),
- referenceValueMatch(referenceName, removedQualifiedName, true));
- }
-
- public static Predicate<? super Diff> addedToReference2(final String qualifiedName,
- final String referenceName, final String removedQualifiedName,
- final EStructuralFeature featureDelegate) {
- // This is only meant for multi-valued references
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), referenceValueMatch(referenceName,
- removedQualifiedName, true, featureDelegate));
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.generalizationSet;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.referenceValueMatch;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+
+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.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.generalizationSet.data.GeneralizationSetInputData;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class AddGeneralizationSetTest extends AbstractUMLTest {
+
+ private GeneralizationSetInputData input = new GeneralizationSetInputData();
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, null);
+ testMergeRightToLeft(left, right, null);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(right, left, null);
+ testMergeRightToLeft(right, left, null);
+ }
+
+ @Test
+ public void testA10UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+
+ testMergeLeftToRight(left, right, right);
+ testMergeRightToLeft(left, right, right);
+ }
+
+ @Test
+ public void testA11UseCase3way() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ final Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+
+ testMergeLeftToRight(left, right, left);
+ testMergeRightToLeft(left, right, left);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final 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> addGeneralizationSetDescription = null;
+ Predicate<? super Diff> addRefGeneralizationSetInClass2Description = null;
+ Predicate<? super Diff> addRefGeneralizationSetInClass0Description = null;
+ Predicate<? super Diff> addRefGeneralizationInGeneralizationSetDescription1 = null;
+ Predicate<? super Diff> addRefGeneralizationInGeneralizationSetDescription2 = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addGeneralizationSetDescription = removed("model.GeneralizationSet_Class2_Class0"); //$NON-NLS-1$
+ addRefGeneralizationSetInClass2Description = removedFromReference1("model.Class2.Class1",
+ "generalizationSet", "model.GeneralizationSet_Class2_Class0",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationSetInClass0Description = removedFromReference1("model.Class0.Class1",
+ "generalizationSet", "model.GeneralizationSet_Class2_Class0",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationInGeneralizationSetDescription1 = removedFromReference2(
+ "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class0.Class1",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationInGeneralizationSetDescription2 = removedFromReference2(
+ "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class2.Class1",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ } else {
+ addGeneralizationSetDescription = added("model.GeneralizationSet_Class2_Class0"); //$NON-NLS-1$
+ addRefGeneralizationSetInClass2Description = addedToReference1("model.Class2.Class1",
+ "generalizationSet", "model.GeneralizationSet_Class2_Class0",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationSetInClass0Description = addedToReference1("model.Class0.Class1",
+ "generalizationSet", "model.GeneralizationSet_Class2_Class0",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationInGeneralizationSetDescription1 = addedToReference2(
+ "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class0.Class1",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ addRefGeneralizationInGeneralizationSetDescription2 = addedToReference2(
+ "model.GeneralizationSet_Class2_Class0", "generalization", "model.Class2.Class1",
+ UMLPackage.Literals.GENERALIZATION__GENERAL);
+ }
+
+ final Diff addGeneralizationSet = Iterators.find(differences.iterator(),
+ addGeneralizationSetDescription);
+ final Diff addRefGeneralizationSetInClass0 = Iterators.find(differences.iterator(),
+ addRefGeneralizationSetInClass0Description);
+ final Diff addRefGeneralizationSetInClass2 = Iterators.find(differences.iterator(),
+ addRefGeneralizationSetInClass2Description);
+ final Diff addRefGeneralizationInGeneralizationSet1 = Iterators.find(differences.iterator(),
+ addRefGeneralizationInGeneralizationSetDescription1);
+ final Diff addRefGeneralizationInGeneralizationSet2 = Iterators.find(differences.iterator(),
+ addRefGeneralizationInGeneralizationSetDescription2);
+
+ assertNotNull(addGeneralizationSet);
+ assertNotNull(addRefGeneralizationSetInClass0);
+ assertNotNull(addRefGeneralizationSetInClass2);
+ assertNotNull(addRefGeneralizationInGeneralizationSet1);
+ assertNotNull(addRefGeneralizationInGeneralizationSet2);
+
+ // CHECK EXTENSION
+ assertSame(Integer.valueOf(1), count(differences, instanceOf(GeneralizationSetChange.class)));
+ Diff addUMLGeneralizationSet = null;
+ if (kind.equals(TestKind.ADD)) {
+ addUMLGeneralizationSet = Iterators.find(differences.iterator(), and(
+ instanceOf(GeneralizationSetChange.class), ofKind(DifferenceKind.ADD)));
+ } else {
+ addUMLGeneralizationSet = Iterators.find(differences.iterator(), and(
+ instanceOf(GeneralizationSetChange.class), ofKind(DifferenceKind.DELETE)));
+ }
+ assertNotNull(addUMLGeneralizationSet);
+ assertSame(Integer.valueOf(5), Integer.valueOf(addUMLGeneralizationSet.getRefinedBy().size()));
+ assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationInGeneralizationSet1));
+ assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationInGeneralizationSet2));
+ assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addGeneralizationSet));
+ assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationSetInClass0));
+ assertTrue(addUMLGeneralizationSet.getRefinedBy().contains(addRefGeneralizationSetInClass2));
+
+ // CHECK REQUIREMENT
+ if (kind.equals(TestKind.ADD)) {
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
+ .getRequires().size()));
+ assertTrue(addRefGeneralizationInGeneralizationSet1.getRequires().contains(addGeneralizationSet));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
+ .getRequires().size()));
+ assertTrue(addRefGeneralizationInGeneralizationSet2.getRequires().contains(addGeneralizationSet));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationSetInClass0.getRequires()
+ .size()));
+ assertTrue(addRefGeneralizationSetInClass0.getRequires().contains(addGeneralizationSet));
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(addRefGeneralizationSetInClass2.getRequires()
+ .size()));
+ assertTrue(addRefGeneralizationSetInClass2.getRequires().contains(addGeneralizationSet));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addGeneralizationSet.getRequires().size()));
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLGeneralizationSet.getRequires().size()));
+ } else {
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
+ .getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
+ .getRequires().size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationSetInClass0.getRequires()
+ .size()));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addRefGeneralizationSetInClass2.getRequires()
+ .size()));
+
+ assertSame(Integer.valueOf(4), Integer.valueOf(addGeneralizationSet.getRequires().size()));
+ assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationInGeneralizationSet1));
+ assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationInGeneralizationSet2));
+ assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationSetInClass0));
+ assertTrue(addGeneralizationSet.getRequires().contains(addRefGeneralizationSetInClass2));
+
+ assertSame(Integer.valueOf(0), Integer.valueOf(addUMLGeneralizationSet.getRequires().size()));
+ }
+
+ // CHECK EQUIVALENCE
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getEquivalences().size()));
+
+ assertNotNull(addRefGeneralizationInGeneralizationSet1.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefGeneralizationInGeneralizationSet1
+ .getEquivalence().getDifferences().size()));
+ assertTrue(addRefGeneralizationInGeneralizationSet1.getEquivalence().getDifferences().contains(
+ addRefGeneralizationSetInClass0));
+
+ assertNotNull(addRefGeneralizationInGeneralizationSet2.getEquivalence());
+ assertSame(Integer.valueOf(2), Integer.valueOf(addRefGeneralizationInGeneralizationSet2
+ .getEquivalence().getDifferences().size()));
+ assertTrue(addRefGeneralizationInGeneralizationSet2.getEquivalence().getDifferences().contains(
+ addRefGeneralizationSetInClass2));
+
+ testIntersections(comparison);
+
+ }
+
+ public static Predicate<? super Diff> removedFromReference1(final String qualifiedName,
+ final String referenceName, final String removedQualifiedName,
+ final EStructuralFeature featureDelegate) {
+ // This is only meant for multi-valued references
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName, featureDelegate),
+ referenceValueMatch(referenceName, removedQualifiedName, true));
+ }
+
+ public static Predicate<? super Diff> removedFromReference2(final String qualifiedName,
+ final String referenceName, final String removedQualifiedName,
+ final EStructuralFeature featureDelegate) {
+ // This is only meant for multi-valued references
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), referenceValueMatch(
+ referenceName, removedQualifiedName, true, featureDelegate));
+ }
+
+ public static Predicate<? super Diff> addedToReference1(final String qualifiedName,
+ final String referenceName, final String removedQualifiedName,
+ final EStructuralFeature featureDelegate) {
+ // This is only meant for multi-valued references
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName, featureDelegate),
+ referenceValueMatch(referenceName, removedQualifiedName, true));
+ }
+
+ public static Predicate<? super Diff> addedToReference2(final String qualifiedName,
+ final String referenceName, final String removedQualifiedName,
+ final EStructuralFeature featureDelegate) {
+ // This is only meant for multi-valued references
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), referenceValueMatch(referenceName,
+ removedQualifiedName, true, featureDelegate));
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/data/GeneralizationSetInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/data/GeneralizationSetInputData.java
index af5e57ee1..ab8c2be44 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/data/GeneralizationSetInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/generalizationSet/data/GeneralizationSetInputData.java
@@ -1,17 +1,17 @@
-package org.eclipse.emf.compare.uml2.tests.generalizationSet.data;
-
-import java.io.IOException;
-
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class GeneralizationSetInputData extends AbstractUMLInputData {
- public Resource getA1Left() throws IOException {
- return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
- }
-
- public Resource getA1Right() throws IOException {
- return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
- }
-
-}
+package org.eclipse.emf.compare.uml2.tests.generalizationSet.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class GeneralizationSetInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java
index b6e430be7..b1793ab3d 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsAssociationTest.java
@@ -1,1036 +1,1036 @@
-package org.eclipse.emf.compare.uml2.tests.implications;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.AssociationChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ImplicationsAssociationTest extends AbstractUMLTest {
-
- private static final int NB_DIFFS = 16;
-
- private ImplicationsInputData input = new ImplicationsInputData();
-
- private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
- final List<Diff> differences = comparison.getDifferences();
- Predicate<? super Diff> addAssociationDescription = null;
- Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
- Predicate<? super Diff> addNavigableOwnedEndClass2InAssociationDescription = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
- Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
- Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
- Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
- Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
- Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
- Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
- Predicate<? super Diff> addOwnedEndClass1Description = null;
- Predicate<? super Diff> addOwnedEndClass2Description = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
- addNavigableOwnedEndClass1InAssociationDescription = removedFromReference(
- "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
- addNavigableOwnedEndClass2InAssociationDescription = removedFromReference(
- "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
- addRefAssociationInPropertyClass1Description = changedReference(
- "myModel.class1sToClass2s.class1s", "association", "myModel.class1sToClass2s", null);
- addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
- "type", "myModel.Class1", null);
- addRefAssociationInPropertyClass2Description = changedReference(
- "myModel.class1sToClass2s.class2s", "association", "myModel.class1sToClass2s", null);
- addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
- "type", "myModel.Class2", null);
- addLiteralIntegerInClass1Description = removedLowerValueIn("myModel.class1sToClass2s.class1s");
- addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
- addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
- addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
- addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class1s");
- addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class2s");
- addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class1s");
- addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class2s");
- } else {
- addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
- addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
- addNavigableOwnedEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
- addRefAssociationInPropertyClass1Description = changedReference(
- "myModel.class1sToClass2s.class1s", "association", null, "myModel.class1sToClass2s");
- addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
- "type", null, "myModel.Class1");
- addRefAssociationInPropertyClass2Description = changedReference(
- "myModel.class1sToClass2s.class2s", "association", null, "myModel.class1sToClass2s");
- addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
- "type", null, "myModel.Class2");
- addLiteralIntegerInClass1Description = addedLowerValueIn("myModel.class1sToClass2s.class1s");
- addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
- addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
- addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
- addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class1s");
- addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
- "memberEnd", "myModel.class1sToClass2s.class2s");
- addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class1s");
- addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
- "myModel.class1sToClass2s.class2s");
- }
-
- DiffsOfInterest diffs = new DiffsOfInterest();
- diffs.addAssociation = Iterators.find(differences.iterator(), addAssociationDescription, null);
- diffs.addNavigableOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
- addNavigableOwnedEndClass1InAssociationDescription, null);
- diffs.addNavigableOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
- addNavigableOwnedEndClass2InAssociationDescription, null);
- diffs.addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
- addMemberEndClass1InAssociationDescription, null);
- diffs.addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
- addMemberEndClass2InAssociationDescription, null);
- diffs.addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
- addOwnedEndClass1Description, null);
- diffs.addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
- addOwnedEndClass2Description, null);
- diffs.addUMLAssociation = Iterators.find(differences.iterator(), instanceOf(AssociationChange.class),
- null);
- diffs.addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass1Description, null);
- diffs.addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass1Description, null);
- diffs.addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefAssociationInPropertyClass2Description, null);
- diffs.addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
- addRefTypeInPropertyClass2Description, null);
- diffs.addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass1Description, null);
- diffs.addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass1Description, null);
- diffs.addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
- addLiteralIntegerInClass2Description, null);
- diffs.addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
- addUnlimitedNaturalInClass2Description, null);
-
- return diffs;
- }
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // local ADD
- public void testA10UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // remote ADD
- public void testA10UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA10MergeLtR1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- private void checkMergeAddNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
- assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
- assertNull(diffs.addOwnedEndClass1InAssociation);
- assertNull(diffs.addMemberEndClass1InAssociation);
- assertNull(diffs.addRefAssociationInPropertyClass1);
- assertNull(diffs.addAssociation);
- assertNull(diffs.addUMLAssociation);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- private void checkMergeDeleteNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 1, comparison.getDifferences().size());
- assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
- }
-
- @Test
- public void testA10MergeLtR2UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- private void checkMergeAddOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
- assertNull(diffs.addOwnedEndClass1InAssociation);
- assertNull(diffs.addMemberEndClass1InAssociation);
- assertNull(diffs.addRefAssociationInPropertyClass1);
- assertNull(diffs.addAssociation);
- assertNull(diffs.addUMLAssociation);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- private void checkMergeDeleteOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 7, comparison.getDifferences().size());
- assertNull(diffs.addOwnedEndClass1InAssociation);
- assertNull(diffs.addMemberEndClass1InAssociation);
- assertNull(diffs.addRefAssociationInPropertyClass1);
- assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
- assertNull(diffs.addLiteralIntegerInClass1);
- assertNull(diffs.addUnlimitedNaturalInClass1);
- assertNull(diffs.addRefTypeInPropertyClass1);
- }
-
- @Test
- public void testA10MergeLtR3UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- private void checkMergeAddMemberEnd(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
- assertNull(diffs.addMemberEndClass1InAssociation);
- assertNull(diffs.addRefAssociationInPropertyClass1);
- assertNull(diffs.addOwnedEndClass1InAssociation);
- assertNull(diffs.addAssociation);
- assertNull(diffs.addUMLAssociation);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase3way1() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase3way2() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- // local DELETE
- public void testA11UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- // remote DELETE
- public void testA11UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA11MergeLtR1UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR1UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR1UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
- .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
- diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase3way1() throws IOException {
- final Resource left = input.getA1Right();
- final Resource right = input.getA1Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddMemberEnd(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase3way2() throws IOException {
- final Resource left = input.getA1Left();
- final Resource right = input.getA1Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
- diffs.addMemberEndClass1InAssociation, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteOwnedEnd(comparison, diffs);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- // We should have no less and no more than 16 differences
- assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
-
- DiffsOfInterest diffs = getDiffs(comparison, kind);
-
- if (kind.equals(TestKind.DELETE)) {
- assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
- assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
- assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().contains(
- diffs.addOwnedEndClass1InAssociation));
-
- assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
- assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
- diffs.addNavigableOwnedEndClass1InAssociation));
- assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
- assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
- diffs.addMemberEndClass1InAssociation));
-
- assertEquals(1, diffs.addMemberEndClass1InAssociation.getImplies().size());
- assertTrue(diffs.addMemberEndClass1InAssociation.getImplies().contains(
- diffs.addOwnedEndClass1InAssociation));
- assertEquals(0, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
- } else {
- assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
- assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImplies().contains(
- diffs.addOwnedEndClass1InAssociation));
- assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
-
- assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
- assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
- diffs.addMemberEndClass1InAssociation));
- assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
- assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
- diffs.addNavigableOwnedEndClass1InAssociation));
-
- assertEquals(0, diffs.addMemberEndClass1InAssociation.getImplies().size());
- assertEquals(1, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
- assertTrue(diffs.addMemberEndClass1InAssociation.getImpliedBy().contains(
- diffs.addOwnedEndClass1InAssociation));
- }
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
- private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
- }
-
- private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
- return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
- }
-
- private class DiffsOfInterest {
- public Diff addAssociation;
-
- public Diff addNavigableOwnedEndClass1InAssociation;
-
- public Diff addNavigableOwnedEndClass2InAssociation;
-
- public Diff addMemberEndClass1InAssociation;
-
- public Diff addMemberEndClass2InAssociation;
-
- public Diff addOwnedEndClass1InAssociation;
-
- public Diff addOwnedEndClass2InAssociation;
-
- public Diff addRefAssociationInPropertyClass1;
-
- public Diff addRefTypeInPropertyClass1;
-
- public Diff addRefAssociationInPropertyClass2;
-
- public Diff addRefTypeInPropertyClass2;
-
- public Diff addLiteralIntegerInClass1;
-
- public Diff addUnlimitedNaturalInClass1;
-
- public Diff addLiteralIntegerInClass2;
-
- public Diff addUnlimitedNaturalInClass2;
-
- public Diff addUMLAssociation;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.implications;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onEObject;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.uml2.internal.AssociationChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ImplicationsAssociationTest extends AbstractUMLTest {
+
+ private static final int NB_DIFFS = 16;
+
+ private ImplicationsInputData input = new ImplicationsInputData();
+
+ private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
+ final List<Diff> differences = comparison.getDifferences();
+ Predicate<? super Diff> addAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addNavigableOwnedEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass1Description = null;
+ Predicate<? super Diff> addRefAssociationInPropertyClass2Description = null;
+ Predicate<? super Diff> addRefTypeInPropertyClass2Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass1Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass1Description = null;
+ Predicate<? super Diff> addLiteralIntegerInClass2Description = null;
+ Predicate<? super Diff> addUnlimitedNaturalInClass2Description = null;
+ Predicate<? super Diff> addMemberEndClass1InAssociationDescription = null;
+ Predicate<? super Diff> addMemberEndClass2InAssociationDescription = null;
+ Predicate<? super Diff> addOwnedEndClass1Description = null;
+ Predicate<? super Diff> addOwnedEndClass2Description = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addAssociationDescription = removed("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = removedFromReference(
+ "myModel.class1sToClass2s", "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", "myModel.Class1", null);
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", "myModel.class1sToClass2s", null);
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", "myModel.Class2", null);
+ addLiteralIntegerInClass1Description = removedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = removedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = removedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = removedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = removedFromReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = removedFromReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ } else {
+ addAssociationDescription = added("myModel.class1sToClass2s"); //$NON-NLS-1$
+ addNavigableOwnedEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class1s");
+ addNavigableOwnedEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "navigableOwnedEnd", "myModel.class1sToClass2s.class2s");
+ addRefAssociationInPropertyClass1Description = changedReference(
+ "myModel.class1sToClass2s.class1s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass1Description = changedReference("myModel.class1sToClass2s.class1s",
+ "type", null, "myModel.Class1");
+ addRefAssociationInPropertyClass2Description = changedReference(
+ "myModel.class1sToClass2s.class2s", "association", null, "myModel.class1sToClass2s");
+ addRefTypeInPropertyClass2Description = changedReference("myModel.class1sToClass2s.class2s",
+ "type", null, "myModel.Class2");
+ addLiteralIntegerInClass1Description = addedLowerValueIn("myModel.class1sToClass2s.class1s");
+ addUnlimitedNaturalInClass1Description = addedUpperValueIn("myModel.class1sToClass2s.class1s");
+ addLiteralIntegerInClass2Description = addedLowerValueIn("myModel.class1sToClass2s.class2s");
+ addUnlimitedNaturalInClass2Description = addedUpperValueIn("myModel.class1sToClass2s.class2s");
+ addMemberEndClass1InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class1s");
+ addMemberEndClass2InAssociationDescription = addedToReference("myModel.class1sToClass2s",
+ "memberEnd", "myModel.class1sToClass2s.class2s");
+ addOwnedEndClass1Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class1s");
+ addOwnedEndClass2Description = addedToReference("myModel.class1sToClass2s", "ownedEnd",
+ "myModel.class1sToClass2s.class2s");
+ }
+
+ DiffsOfInterest diffs = new DiffsOfInterest();
+ diffs.addAssociation = Iterators.find(differences.iterator(), addAssociationDescription, null);
+ diffs.addNavigableOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass1InAssociationDescription, null);
+ diffs.addNavigableOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addNavigableOwnedEndClass2InAssociationDescription, null);
+ diffs.addMemberEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass1InAssociationDescription, null);
+ diffs.addMemberEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addMemberEndClass2InAssociationDescription, null);
+ diffs.addOwnedEndClass1InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass1Description, null);
+ diffs.addOwnedEndClass2InAssociation = Iterators.find(differences.iterator(),
+ addOwnedEndClass2Description, null);
+ diffs.addUMLAssociation = Iterators.find(differences.iterator(), instanceOf(AssociationChange.class),
+ null);
+ diffs.addRefAssociationInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass1Description, null);
+ diffs.addRefTypeInPropertyClass1 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass1Description, null);
+ diffs.addRefAssociationInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefAssociationInPropertyClass2Description, null);
+ diffs.addRefTypeInPropertyClass2 = Iterators.find(differences.iterator(),
+ addRefTypeInPropertyClass2Description, null);
+ diffs.addLiteralIntegerInClass1 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass1Description, null);
+ diffs.addUnlimitedNaturalInClass1 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass1Description, null);
+ diffs.addLiteralIntegerInClass2 = Iterators.find(differences.iterator(),
+ addLiteralIntegerInClass2Description, null);
+ diffs.addUnlimitedNaturalInClass2 = Iterators.find(differences.iterator(),
+ addUnlimitedNaturalInClass2Description, null);
+
+ return diffs;
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // local ADD
+ public void testA10UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // remote ADD
+ public void testA10UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeDeleteNavigableOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 1, comparison.getDifferences().size());
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ private void checkMergeDeleteOwnedEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 7, comparison.getDifferences().size());
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addNavigableOwnedEndClass1InAssociation);
+ assertNull(diffs.addLiteralIntegerInClass1);
+ assertNull(diffs.addUnlimitedNaturalInClass1);
+ assertNull(diffs.addRefTypeInPropertyClass1);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ private void checkMergeAddMemberEnd(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 5, comparison.getDifferences().size());
+ assertNull(diffs.addMemberEndClass1InAssociation);
+ assertNull(diffs.addRefAssociationInPropertyClass1);
+ assertNull(diffs.addOwnedEndClass1InAssociation);
+ assertNull(diffs.addAssociation);
+ assertNull(diffs.addUMLAssociation);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // local DELETE
+ public void testA11UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // remote DELETE
+ public void testA11UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyLeftToRight(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyLeftToRight(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyLeftToRight(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addNavigableOwnedEndClass1InAssociation)
+ .copyRightToLeft(diffs.addNavigableOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteNavigableOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addOwnedEndClass1InAssociation).copyRightToLeft(
+ diffs.addOwnedEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA1Right();
+ final Resource right = input.getA1Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddMemberEnd(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addMemberEndClass1InAssociation).copyRightToLeft(
+ diffs.addMemberEndClass1InAssociation, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteOwnedEnd(comparison, diffs);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ // We should have no less and no more than 16 differences
+ assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
+
+ DiffsOfInterest diffs = getDiffs(comparison, kind);
+
+ if (kind.equals(TestKind.DELETE)) {
+ assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
+ assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addOwnedEndClass1InAssociation));
+
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addNavigableOwnedEndClass1InAssociation));
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addMemberEndClass1InAssociation));
+
+ assertEquals(1, diffs.addMemberEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addMemberEndClass1InAssociation.getImplies().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ assertEquals(0, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
+ } else {
+ assertEquals(1, diffs.addNavigableOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addNavigableOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ assertEquals(0, diffs.addNavigableOwnedEndClass1InAssociation.getImpliedBy().size());
+
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImplies().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImplies().contains(
+ diffs.addMemberEndClass1InAssociation));
+ assertEquals(1, diffs.addOwnedEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addOwnedEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addNavigableOwnedEndClass1InAssociation));
+
+ assertEquals(0, diffs.addMemberEndClass1InAssociation.getImplies().size());
+ assertEquals(1, diffs.addMemberEndClass1InAssociation.getImpliedBy().size());
+ assertTrue(diffs.addMemberEndClass1InAssociation.getImpliedBy().contains(
+ diffs.addOwnedEndClass1InAssociation));
+ }
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+ private static Predicate<? super Diff> addedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> addedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.ADD), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private static Predicate<? super Diff> removedLowerValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("lowerValue"));
+ }
+
+ private static Predicate<? super Diff> removedUpperValueIn(final String qualifiedName) {
+ return and(ofKind(DifferenceKind.DELETE), onEObject(qualifiedName), onFeature("upperValue"));
+ }
+
+ private class DiffsOfInterest {
+ public Diff addAssociation;
+
+ public Diff addNavigableOwnedEndClass1InAssociation;
+
+ public Diff addNavigableOwnedEndClass2InAssociation;
+
+ public Diff addMemberEndClass1InAssociation;
+
+ public Diff addMemberEndClass2InAssociation;
+
+ public Diff addOwnedEndClass1InAssociation;
+
+ public Diff addOwnedEndClass2InAssociation;
+
+ public Diff addRefAssociationInPropertyClass1;
+
+ public Diff addRefTypeInPropertyClass1;
+
+ public Diff addRefAssociationInPropertyClass2;
+
+ public Diff addRefTypeInPropertyClass2;
+
+ public Diff addLiteralIntegerInClass1;
+
+ public Diff addUnlimitedNaturalInClass1;
+
+ public Diff addLiteralIntegerInClass2;
+
+ public Diff addUnlimitedNaturalInClass2;
+
+ public Diff addUMLAssociation;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java
index ec3e54390..dec729d99 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsInterfaceRealizationTest.java
@@ -1,968 +1,968 @@
-package org.eclipse.emf.compare.uml2.tests.implications;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ImplicationsInterfaceRealizationTest extends AbstractUMLTest {
-
- private static final int NB_DIFFS = 11;
-
- private ImplicationsInputData input = new ImplicationsInputData();
-
- private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
- final List<Diff> differences = comparison.getDifferences();
-
- Predicate<? super Diff> addInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
- Predicate<? super Diff> addClientDependencyInClass0Description = null;
- Predicate<? super Diff> addSubstitutionDescription = null;
- Predicate<? super Diff> addClientInSubstitutionDescription = null;
- Predicate<? super Diff> addSupplierInSubstitutionDescription = null;
- Predicate<? super Diff> addClientDependencyInClass0Description2 = null;
- Predicate<? super Diff> addUMLInterfaceRealizationDescription = null;
- Predicate<? super Diff> addUMLSubstitutionDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addInterfaceRealizationDescription = removedFromReference("model.Class0", "interfaceRealization",
- "model.Class0.InterfaceRealization0");
- addClientInInterfaceRealizationDescription = removedFromReference(
- "model.Class0.InterfaceRealization0", "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = removedFromReference(
- "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
- addContractInInterfaceRealizationDescription = changedReference(
- "model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
- addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
- "model.Class0.InterfaceRealization0");
- addSubstitutionDescription = removedFromReference("model.Class0", "substitution",
- "model.Class0.substitution1");
- addClientInSubstitutionDescription = removedFromReference("model.Class0.substitution1", "client",
- "model.Class0");
- addSupplierInSubstitutionDescription = removedFromReference("model.Class0.substitution1",
- "supplier", "model.Interface0");
- addClientDependencyInClass0Description2 = removedFromReference("model.Class0",
- "clientDependency", "model.Class0.substitution1");
- } else {
- addInterfaceRealizationDescription = addedToReference(
- "model.Class0", "interfaceRealization", "model.Class0.InterfaceRealization0"); //$NON-NLS-1$
- addClientInInterfaceRealizationDescription = addedToReference(
- "model.Class0.InterfaceRealization0", "client", "model.Class0");
- addSupplierInInterfaceRealizationDescription = addedToReference(
- "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
- addContractInInterfaceRealizationDescription = changedReference(
- "model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
- addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
- "model.Class0.InterfaceRealization0");
- addSubstitutionDescription = addedToReference("model.Class0", "substitution",
- "model.Class0.substitution1");
- addClientInSubstitutionDescription = addedToReference("model.Class0.substitution1", "client",
- "model.Class0");
- addSupplierInSubstitutionDescription = addedToReference("model.Class0.substitution1", "supplier",
- "model.Interface0");
- addClientDependencyInClass0Description2 = addedToReference("model.Class0", "clientDependency",
- "model.Class0.substitution1");
- }
-
- DiffsOfInterest diffs = new DiffsOfInterest();
- diffs.addInterfaceRealization = Iterators.find(differences.iterator(),
- addInterfaceRealizationDescription, null);
- diffs.addClientInInterfaceRealization = Iterators.find(differences.iterator(),
- addClientInInterfaceRealizationDescription, null);
- diffs.addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
- addSupplierInInterfaceRealizationDescription, null);
- diffs.addContractInInterfaceRealization = Iterators.find(differences.iterator(),
- addContractInInterfaceRealizationDescription, null);
- diffs.addClientDependencyInClass0 = Iterators.find(differences.iterator(),
- addClientDependencyInClass0Description, null);
- diffs.addSubstitution = Iterators.find(differences.iterator(), addSubstitutionDescription, null);
- diffs.addClientInSubstitution = Iterators.find(differences.iterator(),
- addClientInSubstitutionDescription, null);
- diffs.addSupplierInSubstitution = Iterators.find(differences.iterator(),
- addSupplierInSubstitutionDescription, null);
- diffs.addClientDependencyInClass02 = Iterators.find(differences.iterator(),
- addClientDependencyInClass0Description2, null);
- diffs.addUMLInterfaceRealization = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class),
- discriminantInstanceOf(UMLPackage.Literals.INTERFACE_REALIZATION)), null);
- diffs.addUMLSubstitution = Iterators.find(differences.iterator(), and(
- instanceOf(DirectedRelationshipChange.class),
- discriminantInstanceOf(UMLPackage.Literals.SUBSTITUTION)), null);
- return diffs;
- }
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // local ADD
- public void testA10UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // remote ADD
- public void testA10UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA10MergeLtR1UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- private void checkMergeAddClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- private void checkMergeDeleteClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addSupplierInInterfaceRealization);
- assertNull(diffs.addContractInInterfaceRealization);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeLtR2UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- private void checkMergeAddClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- private void checkMergeDeleteClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addSupplierInInterfaceRealization);
- assertNull(diffs.addContractInInterfaceRealization);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeLtR3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- private void checkMergeAddInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- private void checkMergeDeleteInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
- assertNull(diffs.addInterfaceRealization);
- assertNull(diffs.addClientInInterfaceRealization);
- assertNull(diffs.addSupplierInInterfaceRealization);
- assertNull(diffs.addContractInInterfaceRealization);
- assertNull(diffs.addClientDependencyInClass0);
- assertNull(diffs.addUMLInterfaceRealization);
- }
-
- @Test
- public void testA10MergeRtL1UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase3way1() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase3way2() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- // local DELETE
- public void testA11UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- // remote DELETE
- public void testA11UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
- testAB1(TestKind.DELETE, comparison);
- }
-
- @Test
- public void testA11MergeLtR1UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR1UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR1UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR2UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeLtR3UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL1UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
- diffs.addClientInInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL2UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
- diffs.addClientDependencyInClass0, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteClientDependencyInClass0(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase3way1() throws IOException {
- final Resource left = input.getA3Right();
- final Resource right = input.getA3Left();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeAddInterfaceRealization(comparison, diffs);
- }
-
- @Test
- public void testA11MergeRtL3UseCase3way2() throws IOException {
- final Resource left = input.getA3Left();
- final Resource right = input.getA3Right();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
- diffs.addInterfaceRealization, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.DELETE);
-
- checkMergeDeleteInterfaceRealization(comparison, diffs);
- }
-
- private void testAB1(TestKind kind, final Comparison comparison) {
- final List<Diff> differences = comparison.getDifferences();
-
- assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
-
- DiffsOfInterest diffs = getDiffs(comparison, kind);
-
- if (kind.equals(TestKind.DELETE)) {
- assertEquals(1, diffs.addClientDependencyInClass0.getImplies().size());
- assertTrue(diffs.addClientDependencyInClass0.getImplies().contains(diffs.addInterfaceRealization));
-
- assertEquals(1, diffs.addClientDependencyInClass02.getImplies().size());
- assertTrue(diffs.addClientDependencyInClass02.getImplies().contains(diffs.addSubstitution));
- } else {
- assertEquals(1, diffs.addInterfaceRealization.getImplies().size());
- assertTrue(diffs.addInterfaceRealization.getImplies().contains(diffs.addClientDependencyInClass0));
-
- assertEquals(1, diffs.addSubstitution.getImplies().size());
- assertTrue(diffs.addSubstitution.getImplies().contains(diffs.addClientDependencyInClass02));
- }
- assertEquals(0, diffs.addClientInInterfaceRealization.getImplies().size());
- assertEquals(0, diffs.addClientInSubstitution.getImplies().size());
-
- }
-
- @Override
- protected AbstractUMLInputData getInput() {
- return input;
- }
-
- private class DiffsOfInterest {
- public Diff addInterfaceRealization;
-
- public Diff addClientInInterfaceRealization;
-
- public Diff addSupplierInInterfaceRealization;
-
- public Diff addContractInInterfaceRealization;
-
- public Diff addClientDependencyInClass0;
-
- public Diff addSubstitution;
-
- public Diff addClientInSubstitution;
-
- public Diff addSupplierInSubstitution;
-
- public Diff addClientDependencyInClass02;
-
- public Diff addUMLInterfaceRealization;
-
- public Diff addUMLSubstitution;
- }
-}
+package org.eclipse.emf.compare.uml2.tests.implications;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Test;
+
+@SuppressWarnings("nls")
+public class ImplicationsInterfaceRealizationTest extends AbstractUMLTest {
+
+ private static final int NB_DIFFS = 11;
+
+ private ImplicationsInputData input = new ImplicationsInputData();
+
+ private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ Predicate<? super Diff> addInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addSupplierInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addContractInInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description = null;
+ Predicate<? super Diff> addSubstitutionDescription = null;
+ Predicate<? super Diff> addClientInSubstitutionDescription = null;
+ Predicate<? super Diff> addSupplierInSubstitutionDescription = null;
+ Predicate<? super Diff> addClientDependencyInClass0Description2 = null;
+ Predicate<? super Diff> addUMLInterfaceRealizationDescription = null;
+ Predicate<? super Diff> addUMLSubstitutionDescription = null;
+
+ if (kind.equals(TestKind.DELETE)) {
+ addInterfaceRealizationDescription = removedFromReference("model.Class0", "interfaceRealization",
+ "model.Class0.InterfaceRealization0");
+ addClientInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = removedFromReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", "model.Interface0", null);
+ addClientDependencyInClass0Description = removedFromReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ addSubstitutionDescription = removedFromReference("model.Class0", "substitution",
+ "model.Class0.substitution1");
+ addClientInSubstitutionDescription = removedFromReference("model.Class0.substitution1", "client",
+ "model.Class0");
+ addSupplierInSubstitutionDescription = removedFromReference("model.Class0.substitution1",
+ "supplier", "model.Interface0");
+ addClientDependencyInClass0Description2 = removedFromReference("model.Class0",
+ "clientDependency", "model.Class0.substitution1");
+ } else {
+ addInterfaceRealizationDescription = addedToReference(
+ "model.Class0", "interfaceRealization", "model.Class0.InterfaceRealization0"); //$NON-NLS-1$
+ addClientInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "client", "model.Class0");
+ addSupplierInInterfaceRealizationDescription = addedToReference(
+ "model.Class0.InterfaceRealization0", "supplier", "model.Interface0");
+ addContractInInterfaceRealizationDescription = changedReference(
+ "model.Class0.InterfaceRealization0", "contract", null, "model.Interface0");
+ addClientDependencyInClass0Description = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.InterfaceRealization0");
+ addSubstitutionDescription = addedToReference("model.Class0", "substitution",
+ "model.Class0.substitution1");
+ addClientInSubstitutionDescription = addedToReference("model.Class0.substitution1", "client",
+ "model.Class0");
+ addSupplierInSubstitutionDescription = addedToReference("model.Class0.substitution1", "supplier",
+ "model.Interface0");
+ addClientDependencyInClass0Description2 = addedToReference("model.Class0", "clientDependency",
+ "model.Class0.substitution1");
+ }
+
+ DiffsOfInterest diffs = new DiffsOfInterest();
+ diffs.addInterfaceRealization = Iterators.find(differences.iterator(),
+ addInterfaceRealizationDescription, null);
+ diffs.addClientInInterfaceRealization = Iterators.find(differences.iterator(),
+ addClientInInterfaceRealizationDescription, null);
+ diffs.addSupplierInInterfaceRealization = Iterators.find(differences.iterator(),
+ addSupplierInInterfaceRealizationDescription, null);
+ diffs.addContractInInterfaceRealization = Iterators.find(differences.iterator(),
+ addContractInInterfaceRealizationDescription, null);
+ diffs.addClientDependencyInClass0 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description, null);
+ diffs.addSubstitution = Iterators.find(differences.iterator(), addSubstitutionDescription, null);
+ diffs.addClientInSubstitution = Iterators.find(differences.iterator(),
+ addClientInSubstitutionDescription, null);
+ diffs.addSupplierInSubstitution = Iterators.find(differences.iterator(),
+ addSupplierInSubstitutionDescription, null);
+ diffs.addClientDependencyInClass02 = Iterators.find(differences.iterator(),
+ addClientDependencyInClass0Description2, null);
+ diffs.addUMLInterfaceRealization = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class),
+ discriminantInstanceOf(UMLPackage.Literals.INTERFACE_REALIZATION)), null);
+ diffs.addUMLSubstitution = Iterators.find(differences.iterator(), and(
+ instanceOf(DirectedRelationshipChange.class),
+ discriminantInstanceOf(UMLPackage.Literals.SUBSTITUTION)), null);
+ return diffs;
+ }
+
+ @Test
+ public void testA10UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // local ADD
+ public void testA10UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ // remote ADD
+ public void testA10UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.ADD, comparison);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeAddClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeDeleteClientInInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ private void checkMergeAddClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ private void checkMergeDeleteClientDependencyInClass0(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeAddInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ private void checkMergeDeleteInterfaceRealization(Comparison comparison, DiffsOfInterest diffs) {
+ assertEquals(NB_DIFFS - 6, comparison.getDifferences().size());
+ assertNull(diffs.addInterfaceRealization);
+ assertNull(diffs.addClientInInterfaceRealization);
+ assertNull(diffs.addSupplierInInterfaceRealization);
+ assertNull(diffs.addContractInInterfaceRealization);
+ assertNull(diffs.addClientDependencyInClass0);
+ assertNull(diffs.addUMLInterfaceRealization);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA10MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.ADD);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // local DELETE
+ public void testA11UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ // remote DELETE
+ public void testA11UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+ testAB1(TestKind.DELETE, comparison);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyLeftToRight(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyLeftToRight(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeLtR3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyLeftToRight(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL1UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientInInterfaceRealization).copyRightToLeft(
+ diffs.addClientInInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientInInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL2UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addClientDependencyInClass0).copyRightToLeft(
+ diffs.addClientDependencyInClass0, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteClientDependencyInClass0(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way1() throws IOException {
+ final Resource left = input.getA3Right();
+ final Resource right = input.getA3Left();
+
+ Comparison comparison = compare(left, right, right);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeAddInterfaceRealization(comparison, diffs);
+ }
+
+ @Test
+ public void testA11MergeRtL3UseCase3way2() throws IOException {
+ final Resource left = input.getA3Left();
+ final Resource right = input.getA3Right();
+
+ Comparison comparison = compare(left, right, left);
+
+ DiffsOfInterest diffs = getDiffs(comparison, TestKind.DELETE);
+
+ // ** MERGE **
+ getMergerRegistry().getHighestRankingMerger(diffs.addInterfaceRealization).copyRightToLeft(
+ diffs.addInterfaceRealization, new BasicMonitor());
+
+ comparison = compare(left, right);
+ diffs = getDiffs(comparison, TestKind.DELETE);
+
+ checkMergeDeleteInterfaceRealization(comparison, diffs);
+ }
+
+ private void testAB1(TestKind kind, final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+
+ assertSame(Integer.valueOf(NB_DIFFS), Integer.valueOf(differences.size()));
+
+ DiffsOfInterest diffs = getDiffs(comparison, kind);
+
+ if (kind.equals(TestKind.DELETE)) {
+ assertEquals(1, diffs.addClientDependencyInClass0.getImplies().size());
+ assertTrue(diffs.addClientDependencyInClass0.getImplies().contains(diffs.addInterfaceRealization));
+
+ assertEquals(1, diffs.addClientDependencyInClass02.getImplies().size());
+ assertTrue(diffs.addClientDependencyInClass02.getImplies().contains(diffs.addSubstitution));
+ } else {
+ assertEquals(1, diffs.addInterfaceRealization.getImplies().size());
+ assertTrue(diffs.addInterfaceRealization.getImplies().contains(diffs.addClientDependencyInClass0));
+
+ assertEquals(1, diffs.addSubstitution.getImplies().size());
+ assertTrue(diffs.addSubstitution.getImplies().contains(diffs.addClientDependencyInClass02));
+ }
+ assertEquals(0, diffs.addClientInInterfaceRealization.getImplies().size());
+ assertEquals(0, diffs.addClientInSubstitution.getImplies().size());
+
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+
+ private class DiffsOfInterest {
+ public Diff addInterfaceRealization;
+
+ public Diff addClientInInterfaceRealization;
+
+ public Diff addSupplierInInterfaceRealization;
+
+ public Diff addContractInInterfaceRealization;
+
+ public Diff addClientDependencyInClass0;
+
+ public Diff addSubstitution;
+
+ public Diff addClientInSubstitution;
+
+ public Diff addSupplierInSubstitution;
+
+ public Diff addClientDependencyInClass02;
+
+ public Diff addUMLInterfaceRealization;
+
+ public Diff addUMLSubstitution;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java
index 966f03a72..24411beab 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/implications/ImplicationsTransitionTest.java
@@ -1,901 +1,901 @@
-package org.eclipse.emf.compare.uml2.tests.implications;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.assertTrue;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterators;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
-import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
-import org.eclipse.emf.compare.uml2.tests.implications.data.ImplicationsInputData;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.junit.Test;
-
-@SuppressWarnings("nls")
-public class ImplicationsTransitionTest extends AbstractUMLTest {
-
- private static final int NB_DIFFS = 6;
-
- private ImplicationsInputData input = new ImplicationsInputData();
-
- private DiffsOfInterest getDiffs(Comparison comparison, TestKind kind) {
- final List<Diff> differences = comparison.getDifferences();
- Predicate<? super Diff> addTransitionDescription = null;
- Predicate<? super Diff> addPreConditionDescription = null;
- Predicate<? super Diff> addOwnedRuleDescription = null;
- Predicate<? super Diff> addGuardDescription = null;
-
- if (kind.equals(TestKind.DELETE)) {
- addTransitionDescription = removed("model.StateMachine0.Region0.transition1"); //$NON-NLS-1$
- addPreConditionDescription = changedReference("model.StateMachine0.Region0.transition1",
- "preCondition", "model.StateMachine0.Region0.transition1.rule1", null);
- addOwnedRuleDescription = removedFromReference("model.StateMachine0.Region0.transition1",
- "ownedRule", "model.StateMachine0.Region0.transition1.rule1");
- addGuardDescription = changedReference("model.StateMachine0.Region0.transition1", "guard",
- "model.StateMachine0.Region0.transition1.rule1", null);
- } else {
- addTransitionDescription = added("model.StateMachine0.Region0.transition1"); //$NON-NLS-1$
- addPreConditionDescription = changedReference("model.StateMachine0.Region0.transition1",
- "preCondition", null, "model.StateMachine0.Region0.transition1.rule1");
- addOwnedRuleDescription = addedToReference("model.StateMachine0.Region0.transition1",
- "ownedRule", "model.StateMachine0.Region0.transition1.rule1");
- addGuardDescription = changedReference("model.StateMachine0.Region0.transition1", "guard", null,
- "model.StateMachine0.Region0.transition1.rule1");
- }
-
- DiffsOfInterest diffs = new DiffsOfInterest();
- diffs.addTransition = Iterators.find(differences.iterator(), addTransitionDescription, null);
- diffs.addPrecondition = Iterators.find(differences.iterator(), addPreConditionDescription, null);
- diffs.addOwnedRule = Iterators.find(differences.iterator(), addOwnedRuleDescription, null);
- diffs.addGuard = Iterators.find(differences.iterator(), addGuardDescription, null);
-
- return diffs;
- }
-
- @Test
- public void testA10UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // local ADD
- public void testA10UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- // remote ADD
- public void testA10UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
- testAB1(TestKind.ADD, comparison);
- }
-
- @Test
- public void testA10MergeLtR1UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddPrecondition(comparison, diffs);
- }
-
- private void checkMergeAddPrecondition(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 4, comparison.getDifferences().size());
- assertNull(diffs.addPrecondition);
- assertNull(diffs.addGuard);
- assertNull(diffs.addOwnedRule);
- assertNull(diffs.addTransition);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddPrecondition(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR1UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyLeftToRight(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeletePrecondition(comparison, diffs);
- }
-
- private void checkMergeDeletePrecondition(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 1, comparison.getDifferences().size());
- assertNull(diffs.addPrecondition);
- }
-
- @Test
- public void testA10MergeLtR2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddGuard(comparison, diffs);
- }
-
- private void checkMergeAddGuard(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
- assertNull(diffs.addGuard);
- assertNull(diffs.addOwnedRule);
- assertNull(diffs.addTransition);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddGuard(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR2UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyLeftToRight(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteGuard(comparison, diffs);
- }
-
- private void checkMergeDeleteGuard(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 2, comparison.getDifferences().size());
- assertNull(diffs.addGuard);
- assertNull(diffs.addPrecondition);
- }
-
- @Test
- public void testA10MergeLtR3UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddOwnedRule(comparison, diffs);
- }
-
- private void checkMergeAddOwnedRule(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 2, comparison.getDifferences().size());
- assertNull(diffs.addOwnedRule);
- assertNull(diffs.addTransition);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddOwnedRule(comparison, diffs);
- }
-
- @Test
- public void testA10MergeLtR3UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addOwnedRule).copyLeftToRight(diffs.addOwnedRule,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteOwnedRule(comparison, diffs);
- }
-
- private void checkMergeDeleteOwnedRule(Comparison comparison, DiffsOfInterest diffs) {
- assertEquals(NB_DIFFS - 3, comparison.getDifferences().size());
- assertNull(diffs.addOwnedRule);
- assertNull(diffs.addGuard);
- assertNull(diffs.addPrecondition);
- }
-
- @Test
- public void testA10MergeRtL1UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeletePrecondition(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeletePrecondition(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL1UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addPrecondition).copyRightToLeft(
- diffs.addPrecondition, new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddPrecondition(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteGuard(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way1() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Right();
-
- Comparison comparison = compare(left, right, right);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeDeleteGuard(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL2UseCase3way2() throws IOException {
- final Resource left = input.getA2Right();
- final Resource right = input.getA2Left();
-
- Comparison comparison = compare(left, right, left);
-
- DiffsOfInterest diffs = getDiffs(comparison, TestKind.ADD);
-
- // ** MERGE **
- getMergerRegistry().getHighestRankingMerger(diffs.addGuard).copyRightToLeft(diffs.addGuard,
- new BasicMonitor());
-
- comparison = compare(left, right);
- diffs = getDiffs(comparison, TestKind.ADD);
-
- checkMergeAddGuard(comparison, diffs);
- }
-
- @Test
- public void testA10MergeRtL3UseCase() throws IOException {
- final Resource left = input.getA2Left();
- final Resource right = input.getA2Ri