diff options
author | Christian W. Damus | 2017-03-20 13:46:45 +0000 |
---|---|---|
committer | Christian W. Damus | 2017-03-27 12:47:53 +0000 |
commit | 4743bdb441a05f7a2e1b3a3310e993962f870d72 (patch) | |
tree | ef90a146345b415e0c090276b2442c2152a92474 /tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse | |
parent | b73bd6f08bfcf24fdc28f5c24387a57f50ef4450 (diff) | |
download | org.eclipse.papyrus-rt-4743bdb441a05f7a2e1b3a3310e993962f870d72.tar.gz org.eclipse.papyrus-rt-4743bdb441a05f7a2e1b3a3310e993962f870d72.tar.xz org.eclipse.papyrus-rt-4743bdb441a05f7a2e1b3a3310e993962f870d72.zip |
Bug 513508: [Inheritance] Excluded elements are inherited
Use the new API for all redefinitions of a façade object
to find all redefinitions to exclude/re-inherit in the
edit command.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=513508
Change-Id: I98bf2684750072bc2c35c986a95cd61f99672913
Diffstat (limited to 'tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse')
-rw-r--r-- | tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/edition/ExclusionCommandTest.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/edition/ExclusionCommandTest.java b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/edition/ExclusionCommandTest.java index 3a188e0ee..5e0ad17f3 100644 --- a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/edition/ExclusionCommandTest.java +++ b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/edition/ExclusionCommandTest.java @@ -15,6 +15,9 @@ package org.eclipse.papyrusrt.umlrt.core.tests.edition; import static org.eclipse.papyrusrt.junit.matchers.CommandMatchers.isExecutable; import static org.hamcrest.CoreMatchers.everyItem; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assume.assumeThat; @@ -30,11 +33,14 @@ import org.eclipse.papyrusrt.umlrt.core.commands.ExclusionCommand; import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsule; import org.eclipse.papyrusrt.umlrt.uml.UMLRTCapsulePart; import org.eclipse.papyrusrt.umlrt.uml.UMLRTConnector; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTInheritanceKind; import org.eclipse.papyrusrt.umlrt.uml.UMLRTNamedElement; import org.eclipse.papyrusrt.umlrt.uml.UMLRTPackage; import org.eclipse.papyrusrt.umlrt.uml.UMLRTPort; import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocol; import org.eclipse.papyrusrt.umlrt.uml.UMLRTProtocolMessage; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTState; +import org.eclipse.papyrusrt.umlrt.uml.UMLRTStateMachine; import org.eclipse.uml2.uml.NamedElement; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; @@ -196,6 +202,51 @@ public class ExclusionCommandTest { assertThat(message, notExcluded()); } + @PluginResource("resource/inheritance/statemachines.di") + @Test + public void excludedStateNotInherited() { + UMLRTStateMachine parentSM = getCapsule("Subcapsule").getStateMachine(); + UMLRTStateMachine extendingSM = modelSet.execute(() -> getCapsule("Subsubcapsule").createStateMachine()); + + UMLRTState parent = (UMLRTState) parentSM.getVertex("State1"); + assumeThat(parent, notNullValue()); + + // Exclude the parent state + exclude(parent); + assertThat("Parent state not excluded from inheriting context", parent, isExcluded()); + + UMLRTState redefining = (UMLRTState) extendingSM.getVertex("State1"); + assertThat("Redefining state not excluded from inheriting context", redefining, nullValue()); + assertThat("Container is not redefined", UMLRTInheritanceKind.of(extendingSM.toRegion()), + is(UMLRTInheritanceKind.REDEFINED)); + } + + @PluginResource("resource/inheritance/statemachines.di") + @Test + public void excludedStateRedefinitionAlreadyExcluded() { + UMLRTStateMachine parentSM = getCapsule("Subcapsule").getStateMachine(); + UMLRTStateMachine extendingSM = modelSet.execute(() -> getCapsule("Subsubcapsule").createStateMachine()); + + UMLRTState parent = (UMLRTState) parentSM.getVertex("State1"); + assumeThat(parent, notNullValue()); + + UMLRTState redefining = (UMLRTState) extendingSM.getVertex("State1"); + assumeThat(redefining, notNullValue()); + + // Exclude the redefining state + exclude(redefining); + assumeThat("Redefining state not excluded from inheriting context", redefining, isExcluded()); + + // Exclude the parent state + exclude(parent); + assertThat("Parent state not excluded from inheriting context", parent, isExcluded()); + + redefining = (UMLRTState) extendingSM.getVertex("State1"); + assertThat("Redefining state re-inherited in inheriting context", redefining, nullValue()); + assertThat("Container is not redefined", UMLRTInheritanceKind.of(extendingSM.toRegion()), + is(UMLRTInheritanceKind.REDEFINED)); + } + // // Test framework // |