diff options
author | Remi Schnekenburger | 2015-11-27 16:24:26 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-11-27 18:32:44 +0000 |
commit | b3bb4ff7c5a4753d735b6472210907a9329e1c29 (patch) | |
tree | c8f319eadbaff68bdf7cde9929393c82e484a552 /tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse | |
parent | 1c026b3b605de22192fd550dd332389d92bb777e (diff) | |
download | org.eclipse.papyrus-rt-b3bb4ff7c5a4753d735b6472210907a9329e1c29.tar.gz org.eclipse.papyrus-rt-b3bb4ff7c5a4753d735b6472210907a9329e1c29.tar.xz org.eclipse.papyrus-rt-b3bb4ff7c5a4753d735b6472210907a9329e1c29.zip |
Bug 477033: [Tooling] Improve the relation between properties of a port
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477033
- fixing the active/deactivate state for the checkboxes on the Property
view
- add junit tests on the isActive(PropertyPath) for Ports
- fix detection issue on legacy SPP and legacy SAP
- reafctor the detection of port kind in Property view based on the util
class RTPortUtils.
- add junit tests for Port kind from RTPortUtils.
Change-Id: Idee4fc6df05cd0abcf1df04faf762fa70427407b
Diffstat (limited to 'tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse')
2 files changed, 131 insertions, 1 deletions
diff --git a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/AllTests.java b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/AllTests.java index 48a48077d..c55a17fa8 100644 --- a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/AllTests.java +++ b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/AllTests.java @@ -15,6 +15,7 @@ import org.eclipse.papyrusrt.umlrt.core.tests.creation.CreateConnectorTests; import org.eclipse.papyrusrt.umlrt.core.tests.creation.CreateElementTest; import org.eclipse.papyrusrt.umlrt.core.tests.deletion.DeleteElementTest; import org.eclipse.papyrusrt.umlrt.core.tests.edition.ProtocolEditionTests; +import org.eclipse.papyrusrt.umlrt.core.tests.utils.RTPortUtilsTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @@ -23,7 +24,7 @@ import org.junit.runners.Suite.SuiteClasses; * All Tests suite class for this plugin */ @RunWith(Suite.class) -@SuiteClasses({ CreateElementTest.class, CreateConnectorTests.class, DeleteElementTest.class, ProtocolEditionTests.class }) +@SuiteClasses({ CreateElementTest.class, CreateConnectorTests.class, DeleteElementTest.class, ProtocolEditionTests.class, RTPortUtilsTests.class }) public class AllTests { } diff --git a/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTests.java b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTests.java new file mode 100644 index 000000000..b9f2d47d3 --- /dev/null +++ b/tests/junit/umlrt/core/org.eclipse.papyrusrt.umlrt.core.tests/src/org/eclipse/papyrusrt/umlrt/core/tests/utils/RTPortUtilsTests.java @@ -0,0 +1,129 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.core.tests.utils; + +import static org.junit.Assert.assertEquals; + +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.utils.RTPortKindEnum; +import org.eclipse.papyrusrt.umlrt.core.utils.RTPortUtils; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Port; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + + +/** + * Test class for {@link RTPortUtils} + */ +@PluginResource("resource/Utils.di") +public class RTPortUtilsTests extends AbstractPapyrusTest { + + protected static Class capsule; + + protected static Port capsule_externalBehavior; + protected static Port capsule_internalBehavior; + protected static Port capsule_relay; + protected static Port capsule_sap; + protected static Port capsule_spp; + protected static Port capsule_legacySap; + protected static Port capsule_legacySpp; + + + @ClassRule + public final static ModelSetFixture modelSetFixture = new ModelSetFixture(); + + @BeforeClass + public static void initModelElements() { + // capsules + capsule = (Class) modelSetFixture.getModel().getMember("Capsule"); + Assert.assertNotNull(capsule); + + // ports + capsule_externalBehavior = capsule.getOwnedPort("externalBehavior", null); + Assert.assertNotNull(capsule_externalBehavior); + capsule_internalBehavior = capsule.getOwnedPort("internalBehavior", null); + Assert.assertNotNull(capsule_internalBehavior); + capsule_relay = capsule.getOwnedPort("relay", null); + Assert.assertNotNull(capsule_relay); + capsule_sap = capsule.getOwnedPort("sap", null); + Assert.assertNotNull(capsule_sap); + capsule_spp = capsule.getOwnedPort("spp", null); + Assert.assertNotNull(capsule_spp); + Assert.assertNotNull(capsule_relay); + capsule_legacySap = capsule.getOwnedPort("legacySap", null); + Assert.assertNotNull(capsule_legacySap); + capsule_legacySpp = capsule.getOwnedPort("legacySpp", null); + Assert.assertNotNull(capsule_legacySpp); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_ExternalKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.EXTERNAL, RTPortUtils.getKind(capsule_externalBehavior)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_InternalKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.INTERNAL, RTPortUtils.getKind(capsule_internalBehavior)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_RelayKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.RELAY, RTPortUtils.getKind(capsule_relay)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_SAPKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.SAP, RTPortUtils.getKind(capsule_sap)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_SPPKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.SPP, RTPortUtils.getKind(capsule_spp)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_legacySAPKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.SAP, RTPortUtils.getKind(capsule_legacySap)); + } + + /** + * Test {@link RTPortUtils#getKind(Port)} + */ + @Test + public void testRTPortUtils_legacySPPKind() { + assertEquals("error in RTPortUtils#getKind(Port)", RTPortKindEnum.SPP, RTPortUtils.getKind(capsule_legacySpp)); + } + +} |