diff --git a/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/rules/interaction/FunctionCapabilityInvolvementRule.java b/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/rules/interaction/FunctionCapabilityInvolvementRule.java index aa1e16542f..ec87810cae 100644 --- a/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/rules/interaction/FunctionCapabilityInvolvementRule.java +++ b/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/rules/interaction/FunctionCapabilityInvolvementRule.java @@ -12,10 +12,16 @@ *******************************************************************************/ package org.polarsys.capella.core.transition.system.topdown.rules.interaction; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.EClass; - +import org.eclipse.emf.ecore.EObject; +import org.polarsys.capella.core.data.interaction.AbstractFunctionAbstractCapabilityInvolvement; import org.polarsys.capella.core.data.interaction.InteractionPackage; +import org.polarsys.capella.core.data.pa.PhysicalFunction; +import org.polarsys.capella.core.transition.common.constants.Messages; import org.polarsys.capella.core.transition.system.topdown.rules.common.InvolvementRule; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; /** * @@ -26,5 +32,17 @@ public class FunctionCapabilityInvolvementRule extends InvolvementRule { protected EClass getSourceType() { return InteractionPackage.Literals.ABSTRACT_FUNCTION_ABSTRACT_CAPABILITY_INVOLVEMENT; } + + /** + * {@inheritDoc} + */ + @Override + public IStatus transformRequired(EObject element_p, IContext context_p) { + AbstractFunctionAbstractCapabilityInvolvement involvement = (AbstractFunctionAbstractCapabilityInvolvement) element_p; + if (involvement.getInvolved() instanceof PhysicalFunction) { + return new Status(IStatus.WARNING, Messages.Activity_Transformation, "involvement not transitioned"); + } + return super.transformRequired(element_p, context_p); + } } diff --git a/tests/plugins/org.polarsys.capella.test.transition.ju/META-INF/MANIFEST.MF b/tests/plugins/org.polarsys.capella.test.transition.ju/META-INF/MANIFEST.MF index 7d182ffe13..9e86fe8f0c 100644 --- a/tests/plugins/org.polarsys.capella.test.transition.ju/META-INF/MANIFEST.MF +++ b/tests/plugins/org.polarsys.capella.test.transition.ju/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui, org.polarsys.capella.core.transition.system.topdown.ui, org.eclipse.emf.diffmerge.ui, org.polarsys.capella.core.re.ui, - org.polarsys.capella.common.re.ui + org.polarsys.capella.common.re.ui, + org.polarsys.capella.core.data.interaction.validation Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %providerName diff --git a/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.aird b/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.aird index 6b403c06eb..88c4f5606d 100644 --- a/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.aird +++ b/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.aird @@ -103,7 +103,7 @@ - + @@ -27103,7 +27103,7 @@ - + @@ -27112,7 +27112,7 @@ - + @@ -27124,7 +27124,7 @@ - + @@ -27153,7 +27153,7 @@ - + diff --git a/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.melodymodeller b/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.melodymodeller index 953db1fc13..2ef43617ca 100644 --- a/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.melodymodeller +++ b/tests/plugins/org.polarsys.capella.test.transition.ju/model/CreateRule_Scenario/CreateRule_Scenario.melodymodeller @@ -15439,6 +15439,8 @@ + @@ -16228,5 +16230,24 @@ id="5bb8acd3-c606-4ccd-9d96-a9e38f17e3e6" targetElement="#9d32828d-c9a3-4a27-9e32-ad326e409306" sourceElement="#3a7b9a6b-2c1e-4058-b1f4-be73fab19087"/> + + + + + + + + + + diff --git a/tests/plugins/org.polarsys.capella.test.transition.ju/src/org/polarsys/capella/test/transition/ju/transitions/ReferencedScenarios_02.java b/tests/plugins/org.polarsys.capella.test.transition.ju/src/org/polarsys/capella/test/transition/ju/transitions/ReferencedScenarios_02.java index 135cbe523a..82201a1651 100644 --- a/tests/plugins/org.polarsys.capella.test.transition.ju/src/org/polarsys/capella/test/transition/ju/transitions/ReferencedScenarios_02.java +++ b/tests/plugins/org.polarsys.capella.test.transition.ju/src/org/polarsys/capella/test/transition/ju/transitions/ReferencedScenarios_02.java @@ -15,9 +15,13 @@ import java.util.Arrays; import java.util.List; +import org.eclipse.emf.common.util.EList; +import org.polarsys.capella.core.data.capellacore.Involvement; import org.polarsys.capella.core.data.interaction.InteractionPackage; import org.polarsys.capella.core.data.interaction.InteractionUse; import org.polarsys.capella.core.data.interaction.Scenario; +import org.polarsys.capella.core.data.interaction.validation.interactionUse.MDCHK_InteractionUse_ReferencedScenario; +import org.polarsys.capella.core.data.la.CapabilityRealization; import org.polarsys.capella.test.transition.ju.TopDownTransitionTestCase; /** @@ -57,6 +61,9 @@ public class ReferencedScenarios_02 extends TopDownTransitionTestCase { public static final String INTERACTIONUSE_OES_OPERATIONALCAPABILITY_2 = "0c1ada3b-b6ec-45f8-b6bd-c5110e352a54"; //$NON-NLS-1$ public static final String INTERACTIONUSE_OES_OPERATIONALCAPABILITY_2_1 = "fed23a79-5aa4-4dec-8bd5-f36833599e1f"; //$NON-NLS-1$ + Scenario prevScenario; + InteractionUse prevReference; + @Override public List getRequiredTestModels() { return Arrays.asList("CreateRule_Scenario"); @@ -69,6 +76,9 @@ public void performTest() throws Exception { step3(); step4(); step5(); + step6(); + step7(); + step8(); } /* @@ -103,6 +113,9 @@ private void checksStep1() { InteractionUse reference4 = (InteractionUse) mustBeTransitionedTo(INTERACTIONUSE_OAS_OPERATIONALCAPABILITY_3_B_1, InteractionPackage.Literals.INTERACTION_USE, scenario3); assertTrue(reference4.getReferencedScenario().equals(scenario1)); + + prevScenario = scenario1; + prevReference = reference1; } /* @@ -167,7 +180,7 @@ private void step4() { // checks for OAS_OPERATIONALCAPABILITY_3 checksStep1(); } - + /* * OES to ES (System), when an invalid scenario is referenced */ @@ -186,4 +199,48 @@ private void step5() { InteractionPackage.Literals.INTERACTION_USE, scenario1); assertTrue(reference3.getReferencedScenario() == null); } + + /* + * continue the transition started at step1 FS (System) to FS Logical + */ + private void step6() { + performFStoFSTransition(Arrays.asList(prevScenario)); + + Scenario scenario = mustBeTransitioned(prevScenario.getId()); + + InteractionUse reference1 = (InteractionUse) mustBeTransitionedTo(prevReference.getId(), + InteractionPackage.Literals.INTERACTION_USE, scenario); + + assertTrue(reference1.getReferencedScenario() != null); + assertTrue(new MDCHK_InteractionUse_ReferencedScenario().isValidReference(reference1, scenario, + reference1.getReferencedScenario())); + + prevScenario = scenario; + prevReference = reference1; + } + + /* + * continue the transition started at step6 FS (Logical) to FS Physical + */ + private void step7() { + step6(); + } + + /* + * continue the transition started at step7 FS (Physical) to IS, then IS to EPBS + */ + private void step8() { + performFStoESTransition(Arrays.asList(prevScenario)); + Scenario scenario = mustBeTransitioned(prevScenario.getId()); + + performEStoISTransition(Arrays.asList(scenario)); + Scenario scenarioIS = mustBeTransitioned(scenario.getId()); + + performIStoISTransition(Arrays.asList(scenarioIS)); + Scenario scenarioEPBS = mustBeTransitioned(scenarioIS.getId()); + + // AbstractFunctionAbstractCapabilityInvolvement shall not be transited to EPBS + EList involvements = ((CapabilityRealization) scenarioEPBS.eContainer()).getInvolvedInvolvements(); + assertTrue(involvements.isEmpty()); + } }