Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPauline DEVILLE2017-01-24 10:37:21 +0000
committerFlorian Noyrit2017-04-19 09:24:53 +0000
commitbfc914f11e72c5091f0ff5d3d410bdf2af3520c7 (patch)
tree76fc51d8fd2e2c3a9c8c331052cd0eb770a6c99a /tests
parent32052bf471aa6fb854509129da7df3ad2c69ece6 (diff)
downloadorg.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.tar.gz
org.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.tar.xz
org.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.zip
Bug 510131 - [ActivityDiagram] Pin of StartClassifierBehaviorAction
should be create and update automatically Change-Id: Ib5799da629561d47289ed43ea39b805e120f4bfa Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestSemanticContainerFeature.java15
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/AllPinDerivationTests.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/TestStartClassifierBehaviorActionPinDerivation.java126
3 files changed, 142 insertions, 1 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestSemanticContainerFeature.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestSemanticContainerFeature.java
index 6e3fd4af6eb..3abbb5a19e2 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestSemanticContainerFeature.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestSemanticContainerFeature.java
@@ -1353,6 +1353,11 @@ public class TestSemanticContainerFeature extends AbstractPapyrusTestCase {
@Test
public void testInputPinAsObjectIngetStartClassifierBehaviorAction() {
+ // Pin of StartClassifierBehaviorAction should be create and update automatically
+ // Set Automated Model Completion preference to NONE
+ IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ prefStore.setValue(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION, AutomatedModelCompletionPreferencesInitializer.NONE);
+
IGraphicalEditPart actionEP = createChild(StartClassifierBehaviorActionEditPart.VISUAL_ID, getActivityCompartmentEditPart());
IGraphicalEditPart pinEP = createChild(InputPinInStartClassifierBehaviorActionAsObjectEditPart.VISUAL_ID, actionEP);
@@ -1362,6 +1367,11 @@ public class TestSemanticContainerFeature extends AbstractPapyrusTestCase {
@Test
public void testActionPinAsObjectIngetStartClassifierBehaviorAction() {
+ // Pin of StartClassifierBehaviorAction should be create and update automatically
+ // Set Automated Model Completion preference to NONE
+ IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ prefStore.setValue(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION, AutomatedModelCompletionPreferencesInitializer.NONE);
+
IGraphicalEditPart actionEP = createChild(StartClassifierBehaviorActionEditPart.VISUAL_ID, getActivityCompartmentEditPart());
IGraphicalEditPart pinEP = createChild(ActionPinInStartClassifierBehaviorActionAsObjectEditPart.VISUAL_ID, actionEP);
@@ -1371,6 +1381,11 @@ public class TestSemanticContainerFeature extends AbstractPapyrusTestCase {
@Test
public void testValuePinAsObjectIngetStartClassifierBehaviorAction() {
+ // Pin of StartClassifierBehaviorAction should be create and update automatically
+ // Set Automated Model Completion preference to NONE
+ IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ prefStore.setValue(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION, AutomatedModelCompletionPreferencesInitializer.NONE);
+
IGraphicalEditPart actionEP = createChild(StartClassifierBehaviorActionEditPart.VISUAL_ID, getActivityCompartmentEditPart());
IGraphicalEditPart pinEP = createChild(ValuePinInStartClassifierBehaviorActionAsObjectEditPart.VISUAL_ID, actionEP);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/AllPinDerivationTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/AllPinDerivationTests.java
index 4c9e33e5449..ca29c6362a6 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/AllPinDerivationTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/AllPinDerivationTests.java
@@ -20,7 +20,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(ClassificationSuite.class)
@SuiteClasses({ TestAcceptCallActionPinDerivation.class, TestAcceptEventActionPinDerivation.class, TestAddStructuralFeatureValueActionPinDerivation.class, TestCallBehaviorActionPinDerivation.class, TestCallOperationActionPinDerivation.class,
TestCreateLinkActionPinDerivation.class, TestCreateObjectActionPinDerivation.class, TestDestroyLinkActionPinDerivation.class, TestReadLinkActionPinDerivation.class, TestReadStructuralFeatureActionPinDerivation.class,
- TestSendSignalActionPinDerivation.class, TestTestIdentityActionPinDerivation.class, TestValueSpecificationActionPinDerivation.class })
+ TestSendSignalActionPinDerivation.class, TestStartClassifierBehaviorActionPinDerivation.class, TestTestIdentityActionPinDerivation.class, TestValueSpecificationActionPinDerivation.class })
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/TestStartClassifierBehaviorActionPinDerivation.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/TestStartClassifierBehaviorActionPinDerivation.java
new file mode 100644
index 00000000000..78eab127be2
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/derivation/pins/TestStartClassifierBehaviorActionPinDerivation.java
@@ -0,0 +1,126 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.tests.derivation.pins;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartClassifierBehaviorActionEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.AutomatedModelCompletionPreferencesInitializer;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.IAutomatedModelCompletionPreferencesConstants;
+import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.StartClassifierBehaviorAction;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * Pin of StartClassifierBehaviorAction should be create and update automatically
+ *
+ */
+public class TestStartClassifierBehaviorActionPinDerivation extends AbstractTestPinDerivation {
+
+ /**
+ * CallBehaviorAction advice identifier
+ */
+ private final String TARGET_ADVICE_IDENTIFIER = "org.eclipse.papyrus.uml.diagram.activity.edit.advices.StartClassifierBehaviorActionEditHelperAdvice";
+ private StartClassifierBehaviorAction startClassifierBehaviorAction;
+ private Activity activity;
+
+ /**
+ * Constructor.
+ */
+ public TestStartClassifierBehaviorActionPinDerivation() {
+ this.activity = null;
+ this.startClassifierBehaviorAction = null;
+ this.populateBaseTestModel();
+ // Set Automated Model Completion preference to PIN_SYNCHRONIZATION
+ IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ prefStore.setValue(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION, AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION);
+ }
+
+ /**
+ * Role:
+ * - Ensure that the advice for the StartClassifierBehaviorAction is available
+ */
+ @Test
+ public void testAdviceForStartClassifierBehaviorActionExists() {
+ Assert.assertNotNull("StartClassifierBehaviorAction advice for activity models is missing", this.getAdvice(TARGET_ADVICE_IDENTIFIER));
+ }
+
+ /**
+ * Role:
+ * - For a StartClassifierBehaviorAction having no referenced signal, ensure that if a signal gets referenced then target and argument pins
+ * are inferred.
+ *
+ * Scenario:
+ * - 1] StartClassifierBehaviorAction 'signal' feature is set with the 'baseSignal'
+ * - 2] Synchronization is performed via the advice
+ * - StartClassifierBehaviorAction has now 3 pins
+ * - 1 target (of type C)
+ * - 2 argument pins (p1 and p2)
+ */
+ @Test
+ public void testPinDerivation_StartClassifierBehaviorAction() {
+ ConfigureRequest request = new ConfigureRequest(editingDomain, this.startClassifierBehaviorAction, UMLElementTypes.getElementType(StartClassifierBehaviorActionEditPart.VISUAL_ID));
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(this.activity);
+ ICommand editStartClassifierBehaviorActionCommand = elementEditService.getEditCommand(request);
+ if (!editStartClassifierBehaviorActionCommand.canExecute()) {
+ Assert.fail("The TestIdentityAction cannot be edited (Edit command is not executable)");
+ }
+ this.editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(editStartClassifierBehaviorActionCommand));
+
+ // Assert object
+ Assert.assertTrue("StartClassifierBehaviorAction shall have a target", this.startClassifierBehaviorAction.getObject() != null);
+
+ if (!editStartClassifierBehaviorActionCommand.canUndo()) {
+ Assert.fail("It shall be possible to undo the pin derivation");
+ }
+ this.editingDomain.getCommandStack().undo();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.activity.tests.derivation.pins.AbstractTestPinDerivation#populateBaseTestModel()
+ *
+ */
+ @Override
+ public void populateBaseTestModel() {
+ super.populateBaseTestModel();
+
+ // Create the startClassifierBehaviorAction
+ this.startClassifierBehaviorAction = UMLFactory.eINSTANCE.createStartClassifierBehaviorAction();
+
+ // Create the activity containing the startClassifierBehaviorAction
+ activity = UMLFactory.eINSTANCE.createActivity();
+ activity.getOwnedNodes().add(this.startClassifierBehaviorAction);
+
+ // Add the different elements to the model
+ this.umlTestModel.getPackagedElements().add(activity);
+
+ // Add the test model within the model set
+ Resource umlTestModelResource = new ResourceImpl();
+ umlTestModelResource.setURI(URI.createURI("UMLBaseTestModel.tmp"));
+ umlTestModelResource.getContents().add(this.umlTestModel);
+ this.modelSet.getResources().add(umlTestModelResource);
+ }
+}

Back to the top