Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2015-12-07 08:55:40 +0000
committerRemi Schnekenburger2015-12-07 08:56:00 +0000
commit87199897086030f1792df6480afaa626b5643591 (patch)
tree923f71d9699e3fbac0c1b4cfb981eed4ef259238 /tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse
parente90f7c9ab2c42dea26fb6cd771d0c5090d869bb4 (diff)
downloadorg.eclipse.papyrus-rt-87199897086030f1792df6480afaa626b5643591.tar.gz
org.eclipse.papyrus-rt-87199897086030f1792df6480afaa626b5643591.tar.xz
org.eclipse.papyrus-rt-87199897086030f1792df6480afaa626b5643591.zip
Bug 477033: [Tooling] Improve the relation between properties of a port
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477033 - added RTPortUtils#isConnectedInside(Port) & RTPortUtils#isConnectedOutside(Port) - fix read-only state for connected relay/external/internal behaviors. - fix tests Change-Id: I0000000000000000000000000000000000000000 Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
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/utils/AbstractRTPortTest.java55
-rw-r--r--tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTest.java145
2 files changed, 200 insertions, 0 deletions
diff --git a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/AbstractRTPortTest.java b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/AbstractRTPortTest.java
index aae68d949..b36136186 100644
--- a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/AbstractRTPortTest.java
+++ b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/AbstractRTPortTest.java
@@ -20,11 +20,13 @@ import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTy
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrusrt.umlrt.core.Activator;
import org.eclipse.papyrusrt.umlrt.core.utils.RTPortKindEnum;
import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils;
import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTPort;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Port;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -45,6 +47,21 @@ public abstract class AbstractRTPortTest extends AbstractPapyrusTest {
protected static Port capsule_legacySap;
protected static Port capsule_legacySpp;
+ protected static Class connectedCapsule;
+ protected static Class connectedCapsule2;
+ protected static Port connectedCapsule_externalBehavior;
+ protected static Port connectedCapsule_internalBehavior;
+ protected static Port connectedCapsule_relay;
+ protected static Port connectedCapsule_externalBehaviorNotConnected;
+ protected static Port connectedCapsule_internalBehaviorNotConnected;
+ protected static Port connectedCapsule_relayNotConnected;
+ protected static Port connectedCapsule2_externalBehavior;
+ protected static Port connectedCapsule2_internalBehavior;
+ protected static Port connectedCapsule2_relay;
+ protected static Connector connectedCapsule_externalBehaviorConnector;
+ protected static Connector connectedCapsule_internalBehaviorConnector;
+ protected static Connector connectedCapsule_relayConnector;
+
@ClassRule
public final static ModelSetFixture modelSetFixture = new ModelSetFixture();
@@ -71,6 +88,43 @@ public abstract class AbstractRTPortTest extends AbstractPapyrusTest {
capsule_legacySpp = capsule.getOwnedPort("legacySpp", null);
Assert.assertNotNull(capsule_legacySpp);
+ // connections tests - classes
+ connectedCapsule = (Class) modelSetFixture.getModel().getMember("ConnectedCapsule");
+ Assert.assertNotNull(connectedCapsule);
+ connectedCapsule2 = (Class) modelSetFixture.getModel().getMember("ConnectedCapsule2");
+ Assert.assertNotNull(connectedCapsule2);
+
+ // connections tests - ports
+ connectedCapsule_externalBehavior = connectedCapsule.getOwnedPort("externalBehavior", null);
+ Assert.assertNotNull(connectedCapsule_externalBehavior);
+ connectedCapsule_internalBehavior = connectedCapsule.getOwnedPort("internalBehavior", null);
+ Assert.assertNotNull(connectedCapsule_internalBehavior);
+ connectedCapsule_relay = connectedCapsule.getOwnedPort("relay", null);
+ Assert.assertNotNull(connectedCapsule_relay);
+ // not connected
+ connectedCapsule_externalBehaviorNotConnected = connectedCapsule.getOwnedPort("externalBehaviorNotConnected", null);
+ Assert.assertNotNull(connectedCapsule_externalBehaviorNotConnected);
+ connectedCapsule_internalBehaviorNotConnected = connectedCapsule.getOwnedPort("internalBehaviorNotConnected", null);
+ Assert.assertNotNull(connectedCapsule_internalBehaviorNotConnected);
+ connectedCapsule_relayNotConnected = connectedCapsule.getOwnedPort("relayNotConnected", null);
+ Assert.assertNotNull(connectedCapsule_relayNotConnected);
+
+ // port on part
+ connectedCapsule2_externalBehavior = connectedCapsule2.getOwnedPort("externalBehavior", null);
+ Assert.assertNotNull(connectedCapsule2_externalBehavior);
+ connectedCapsule2_internalBehavior = connectedCapsule2.getOwnedPort("internalBehavior", null);
+ Assert.assertNotNull(connectedCapsule2_internalBehavior);
+ connectedCapsule2_relay = connectedCapsule2.getOwnedPort("relay", null);
+ Assert.assertNotNull(connectedCapsule2_relay);
+
+ // connector
+ connectedCapsule_externalBehaviorConnector = connectedCapsule.getOwnedConnector("externalBehaviorConnector");
+ Assert.assertNotNull(connectedCapsule_externalBehaviorConnector);
+ connectedCapsule_internalBehaviorConnector = connectedCapsule.getOwnedConnector("internalBehaviorConnector");
+ Assert.assertNotNull(connectedCapsule_internalBehaviorConnector);
+ connectedCapsule_relayConnector = connectedCapsule.getOwnedConnector("relayConnector");
+ Assert.assertNotNull(connectedCapsule_relayConnector);
+
// ensure ElementTypeRegistry is started
Display.getDefault().syncExec(new Runnable() {
@@ -78,6 +132,7 @@ public abstract class AbstractRTPortTest extends AbstractPapyrusTest {
public void run() {
// force loading of the state machine plugin, but in UI thread, as the element types require some UI...
ElementTypeSetConfigurationRegistry registry = ElementTypeSetConfigurationRegistry.getInstance();
+ Activator.log.debug("Configuration size: " + registry.getElementTypeSetConfigurations().size());
}
});
}
diff --git a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTest.java b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTest.java
index 24ebf5b92..a8f6afb87 100644
--- a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTest.java
+++ b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTest.java
@@ -367,6 +367,151 @@ public class RTPortUtilsTest extends AbstractRTPortTest {
Assert.assertFalse(RTPortUtils.isLegacySap(capsule_relay));
}
+ // ------------------------------------------------------------------------
+ // RTPortUtils#isConnected()
+ // ------------------------------------------------------------------------
+ @Test
+ public void testRTPortUtils_isConnected_ExternalBehaviorConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_InternalBehaviorConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_RelayConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule_relay));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_ExternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnected(connectedCapsule_externalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_InternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnected(connectedCapsule_internalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_RelayNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnected(connectedCapsule_relayNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_ExternalBehavior2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule2_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_InternalBehavior2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule2_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnected_Relay2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnected(connectedCapsule2_relay));
+ }
+
+
+ // ------------------------------------------------------------------------
+ // RTPortUtils#isConnectedInside()
+ // ------------------------------------------------------------------------
+ @Test
+ public void testRTPortUtils_isConnectedInside_ExternalBehaviorConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedInside(connectedCapsule_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_InternalBehaviorConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedInside(connectedCapsule_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_RelayConnected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedInside(connectedCapsule_relay));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_ExternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule_externalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_InternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule_internalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_RelayNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule_relayNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_ExternalBehavior2Connected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule2_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_InternalBehavior2Connected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule2_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedInside_Relay2Connected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedInside(connectedCapsule2_relay));
+ }
+
+ // ------------------------------------------------------------------------
+ // RTPortUtils#isConnectedOutside()
+ // ------------------------------------------------------------------------
+ @Test
+ public void testRTPortUtils_isConnectedOutside_ExternalBehaviorConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_InternalBehaviorConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_RelayConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_relay));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_ExternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_externalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_InternalBehaviorNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_internalBehaviorNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_RelayNotConnected() throws Exception {
+ Assert.assertFalse(RTPortUtils.isConnectedOutside(connectedCapsule_relayNotConnected));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_ExternalBehavior2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedOutside(connectedCapsule2_externalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_InternalBehavior2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedOutside(connectedCapsule2_internalBehavior));
+ }
+
+ @Test
+ public void testRTPortUtils_isConnectedOutside_Relay2Connected() throws Exception {
+ Assert.assertTrue(RTPortUtils.isConnectedOutside(connectedCapsule2_relay));
+ }
+
// ------------------------------------------------------------------------
// test methods

Back to the top