From 4e4d7fcebfb0311496123d9f4144387af7691ee7 Mon Sep 17 00:00:00 2001 From: Sandu Postaru Date: Wed, 4 Nov 2020 11:28:15 +0100 Subject: [PATCH] Requirements cherrypick (#12) * [568173] Import ReqIf fails for model size greater than Integer.MAX_SIZE - Replace the Model Resource save by a Session save - Run resource save in Workspace Runnable - Improve performance by avoiding resource unloading and loading after save Change-Id: I6fea74041880d9da362d6cc016c86dbd4913aa25 Signed-off-by: Sandu Postaru * [test] Update Transposer transformation test Change-Id: I74b208d586891b97e2d249391382dd1be101a95f Signed-off-by: Sandu Postaru * [568336] Iterative ReqIf import does not match CapellaOutgoingRelations - Fix the bug -- In addition to the Requif Elements also remove CapellaRelations during the construction of the intermediate data set -- For more details check https://bugs.eclipse.org/bugs/show_bug.cgi?id=568336 - Add JUnit -- Since this commit is a cherry pick, the test model was migrated to the current version Change-Id: Ib8b3eb6f8db9d020d7ff6dbd362f61858af3952d Signed-off-by: Sandu Postaru * [releng] Update Jenkinsfile - Update Capella download URL to '1.4.x' branch instead of 'master' Change-Id: Id71a70993e4bdba1ff2df1dbd9bb4576867509b1 Signed-off-by: Sandu Postaru --- Jenkinsfile | 7 +- .../activities/TransposerTransformation.java | 259 ++++-- .../bridge/RequirementsVPBridge.java | 85 +- .../.project | 12 + .../model-with-manually-created-elements.afm | 6 + .../model-with-manually-created-elements.aird | 566 +++++++++++++ ...h-manually-created-elements.melodymodeller | 792 ++++++++++++++++++ ...eated-elements.melodymodeller.bridgetraces | 150 ++++ .../ju/testcases/FragmentationTestCase.java | 2 +- .../ju/testcases/ModelDiffTestCase2.java | 2 +- .../ModelDiffWithManuallyCreatedElements.java | 149 ++++ .../ju/testsuites/RequirementsTestSuite.java | 5 +- .../TestInitializeTransformation.java | 26 +- .../TestTransposerTransformation.java | 8 +- 14 files changed, 1977 insertions(+), 92 deletions(-) create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/.project create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.afm create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.aird create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller.bridgetraces create mode 100644 tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffWithManuallyCreatedElements.java diff --git a/Jenkinsfile b/Jenkinsfile index 1d6322ea..11e9379d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,8 @@ pipeline { environment { BUILD_KEY = (github.isPullRequest() ? CHANGE_TARGET : BRANCH_NAME).replaceFirst(/^v/, '') - CAPELLA_PRODUCT_PATH = "${WORKSPACE}/capella/capella" + CAPELLA_PRODUCT_PATH = "${WORKSPACE}/capella/eclipse/eclipse" + CAPELLA_BRANCH = '1.4.x' } stages { @@ -63,7 +64,7 @@ pipeline { steps { script { - def capellaURL = capella.getDownloadURL("${BUILD_KEY}", 'linux', '') + def capellaURL = capella.getDownloadURL("${CAPELLA_BRANCH}", 'linux', '') sh "curl -k -o capella.zip ${capellaURL}" sh "unzip -q capella.zip" @@ -84,7 +85,7 @@ pipeline { sh "chmod 755 ${CAPELLA_PRODUCT_PATH}" eclipse.installFeature("${CAPELLA_PRODUCT_PATH}", 'http://download.eclipse.org/tools/orbit/downloads/drops/R20130827064939/repository', 'org.jsoup') - eclipse.installFeature("${CAPELLA_PRODUCT_PATH}", capella.getTestUpdateSiteURL("${BUILD_KEY}"), 'org.polarsys.capella.test.feature.feature.group') + eclipse.installFeature("${CAPELLA_PRODUCT_PATH}", capella.getTestUpdateSiteURL("${CAPELLA_BRANCH}"), 'org.polarsys.capella.test.feature.feature.group') eclipse.installFeature("${CAPELLA_PRODUCT_PATH}", "file:/${WORKSPACE}/releng/org.polarsys.capella.vp.requirements.site/target/repository/".replace("\\", "/"), 'org.polarsys.capella.vp.requirements.feature.feature.group') eclipse.installFeature("${CAPELLA_PRODUCT_PATH}", "file:/${WORKSPACE}/releng/org.polarsys.capella.vp.requirements.site/target/repository/".replace("\\", "/"), 'org.polarsys.capella.vp.requirements.tests.feature.feature.group') diff --git a/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/activities/TransposerTransformation.java b/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/activities/TransposerTransformation.java index 6cd49e16..4c41b4ea 100644 --- a/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/activities/TransposerTransformation.java +++ b/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/activities/TransposerTransformation.java @@ -11,25 +11,33 @@ package org.polarsys.capella.vp.requirements.importer.transposer.activities; import java.io.IOException; -import java.util.HashMap; +import java.util.Collections; import java.util.List; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; import org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace; import org.eclipse.emf.diffmerge.bridge.api.incremental.IIncrementalBridgeExecution; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.plugin.EcorePlugin; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.progress.UIJob; +import org.polarsys.capella.common.ef.ExecutionManager; import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand; import org.polarsys.capella.common.helpers.TransactionHelper; import org.polarsys.capella.core.data.cs.BlockArchitecture; @@ -42,22 +50,84 @@ import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; /** - * @author Joao Barata + * This class managers the merge of requirements into the model and the save of the associated resources. + * */ public class TransposerTransformation extends AbstractActivity { - public static String getId() { - return TransposerTransformation.class.getCanonicalName(); + /** + * Flag to detect if the merge operation was canceled by the user. This is required since the merge operation and the + * save of the resources are executed in two different transactions. If they are executed in the same transaction, the + * Sirius Session does not detect that the model has changed, and thus the save does not have any effect. + * + * The second transactions depends on the first one. + * + * There must be a cleaner way to achieve this. But for the moment this will do. + */ + final boolean[] mergeOperationCanceled = { false }; + + /** + * The UI job that manages the transformation. + */ + private class MergeAndSaveRequirementsUIJob extends UIJob { + + private ActivityParameters activityParams; + + public MergeAndSaveRequirementsUIJob(ActivityParameters activityParams) { + super("Import and Merge Requirements Job"); + this.activityParams = activityParams; + } + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + return mergeAndSave(activityParams, monitor); + } } + /** + * The Workspace Runnable that manages the resource save. The save must be executed in a Workspace Runnable, since it + * is the workspace who manages the lifecycle of the save. + * + * Reason: When resources are saved, the buffer used to save the resource can be flushed multiple times if the + * resource content is bigger than the buffer. For resources that are not saved in a WorkspaceRunnable (by invoking + * resource.save() for example, the workspace detects that a resource has changed and notifies any + * listener that is registered to the event. The problem is that if multiple flushes are required, the file is + * incomplete for all flushed except the last one, so the listener fail since the resource is corrupted. Thus only the + * last flush should generated a notification, and the runnable ensured this. + * + * In our case we do a resource.save() for the bridgetraces resource, since this resource is + * not a semantic resource of our model, and thus the session save does not have an effect on it. + * + * Running the save in a Workspace Runnable ensure that the Workspace does not get confused. + */ + private class SaveResourcesWorkspaceRunnable implements IWorkspaceRunnable { + private Resource modelResource; + private Resource traceResource; + + public SaveResourcesWorkspaceRunnable(Resource modelResource, Resource traceResource) { + this.modelResource = modelResource; + this.traceResource = traceResource; + } + + @Override + public void run(IProgressMonitor monitor) throws CoreException { + SubMonitor subMonitor = SubMonitor.convert(monitor, "Save resources", 100); + subMonitor.split(30); + try { + traceResource.save(Collections.emptyMap()); + Session session = SessionManager.INSTANCE.getSession(modelResource); + session.save(subMonitor.split(70)); + } catch (IOException e) { + e.printStackTrace(); + } + } + }; + @Override protected IStatus _run(final ActivityParameters activityParams) { - Job job = new UIJob("Merge of ReqIF elements") { - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - return mergeAndSave(activityParams); - } - }; + + Job job = new MergeAndSaveRequirementsUIJob(activityParams); + job.setRule(ReqIFJobSchedulingRule.getInstance()); job.setPriority(Job.SHORT); job.schedule(); @@ -65,70 +135,145 @@ public IStatus runInUIThread(IProgressMonitor monitor) { return Status.OK_STATUS; } - protected IStatus mergeAndSave(ActivityParameters activityParams) { - final IContext context = (IContext) activityParams.getParameter(ITransposerWorkflow.TRANSPOSER_CONTEXT).getValue(); + /** + * The main method executed by the MergeAndSaveRequirementsUIJob. + * + * @param activityParams + * @param monitor + * @return the execution status. + */ + protected IStatus mergeAndSave(ActivityParameters activityParams, IProgressMonitor monitor) { + IContext context = (IContext) activityParams.getParameter(ITransposerWorkflow.TRANSPOSER_CONTEXT).getValue(); - Object reqIfContainsModule = context.get(IRequirementsImporterBridgeConstants.REQIF_MODEL_CONTAINS_MODULE); - // Only run diffmerge activity if at least a module found in the reqif file - if (reqIfContainsModule instanceof Boolean && ((Boolean) reqIfContainsModule).booleanValue()) { + if (reqIfContainsModule(context)) { + BlockArchitecture blockArchitecture = (BlockArchitecture) context + .get(IRequirementsImporterBridgeConstants.TARGET_ELEMENT); + RequirementsVPBridge requirementBridge = (RequirementsVPBridge) context + .get(IRequirementsImporterBridgeConstants.BRIDGE); + IIncrementalBridgeExecution requirementBridgeExecution = (IIncrementalBridgeExecution) context + .get(IRequirementsImporterBridgeConstants.BRIDGE_EXECUTION); - final IEditableModelScope targetScope = (IEditableModelScope) context - .get(IRequirementsImporterBridgeConstants.TARGET_SCOPE); - BlockArchitecture target = (BlockArchitecture) context.get(IRequirementsImporterBridgeConstants.TARGET_ELEMENT); + ExecutionManager executionManager = TransactionHelper.getExecutionManager(blockArchitecture); - TransactionHelper.getExecutionManager(target).execute(new AbstractReadWriteCommand() { - @Override - public void run() { - RequirementsVPBridge bridge = (RequirementsVPBridge) context.get(IRequirementsImporterBridgeConstants.BRIDGE); - Resource traceResource = (Resource) context.get(IRequirementsImporterBridgeConstants.TRACE_RESOURCE); - final IIncrementalBridgeExecution execution2 = (IIncrementalBridgeExecution) context - .get(IRequirementsImporterBridgeConstants.BRIDGE_EXECUTION); + SubMonitor subMonitor = SubMonitor.convert(monitor, "Merge and Save requirements", 2); - IStatus result = bridge.mergeInteractively(execution2, new NullProgressMonitor()); - if (result == Status.CANCEL_STATUS) { - throw new OperationCanceledException(result.getMessage()); - } + mergeRequirements(executionManager, requirementBridge, requirementBridgeExecution, subMonitor.split(1)); - // Save traces and output model - save(execution2, traceResource, execution2.getTrace(), targetScope); + if (!isMergeOperationCanceled()) { + IEditableModelScope targetScope = (IEditableModelScope) context + .get(IRequirementsImporterBridgeConstants.TARGET_SCOPE); - TransactionHelper.getExecutionManager(traceResource).execute(new AbstractReadWriteCommand() { - @Override - public void run() { - HoldingResourceHelper - .flushHoldingResource(TransactionHelper.getEditingDomain(targetScope.getContents().get(0))); - } - }); + List targetScopeContents = targetScope.getContents(); + if (!targetScopeContents.isEmpty()) { + EObject rootScopeElement = targetScopeContents.get(0); + Resource modelResource = rootScopeElement.eResource(); + Resource traceResource = (Resource) context.get(IRequirementsImporterBridgeConstants.TRACE_RESOURCE); + + saveAndCleanResources(executionManager, modelResource, traceResource, subMonitor.split(1)); } - }); - } else { + } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - String title = Messages.ReqIfImport_NoModuleFoundPopup_Title; - String content = Messages.ReqIfImport_NoModuleFoundPopup_Content; - MessageDialog.openInformation(shell, title, content); + } else { + displayNoModuleFoundInformationDialog(); } return Status.OK_STATUS; } /** + * Displays the Diff Merge Window, and merges the Requirements on user feedback. The code is executed in a + * transaction. + * + * @param executionManager + * @param requirementBridge + * @param requirementBridgeExecution + * @param monitor + */ + private void mergeRequirements(ExecutionManager executionManager, RequirementsVPBridge requirementBridge, + IIncrementalBridgeExecution requirementBridgeExecution, SubMonitor monitor) { + + monitor.beginTask("Merge requirements", 1); + setMergeOperationCanceled(false); + + executionManager.execute(new AbstractReadWriteCommand() { + @Override + public void run() { + IStatus result = requirementBridge.mergeInteractively(requirementBridgeExecution, monitor); + if (result == Status.CANCEL_STATUS) { + setMergeOperationCanceled(true); + throw new OperationCanceledException(result.getMessage()); + } + } + }); + } + + /** + * Saves the model resource, trace resource and cleans existing holding resources. + * + * @param executionManager + * @param modelResource + * @param traceResource + * @param monitor + */ + private void saveAndCleanResources(ExecutionManager executionManager, Resource modelResource, Resource traceResource, + SubMonitor monitor) { + executionManager.execute(new AbstractReadWriteCommand() { + @Override + public void run() { + saveResources(modelResource, traceResource, monitor); + + HoldingResourceHelper.flushHoldingResource(TransactionHelper.getEditingDomain(modelResource)); + } + }); + } + + /** + * Saves the model and trace resources in a workspace runnable. + * + * @param modelResource * @param traceResource - * @param trace + * @param progressMonitor */ - @SuppressWarnings("rawtypes") - private void save(IIncrementalBridgeExecution execution, Resource traceResource, IBridgeTrace trace, - IEditableModelScope targetScope) { - - try { - // setTrace(traceResource, execution.getTrace()); - // compact(traceResource); - traceResource.save(new HashMap()); - targetScope.getContents().get(0).eResource().save(new HashMap()); - } catch (IOException e) { - e.printStackTrace(); + private void saveResources(Resource modelResource, Resource traceResource, SubMonitor progressMonitor) { + + IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); + if (workspaceRoot != null) { + IWorkspace workspace = workspaceRoot.getWorkspace(); + + if (workspace != null) { + SaveResourcesWorkspaceRunnable saveRunnable = new SaveResourcesWorkspaceRunnable(modelResource, traceResource); + + try { + workspace.run(saveRunnable, progressMonitor); + } catch (CoreException e) { + e.printStackTrace(); + } + } } + } + + private void displayNoModuleFoundInformationDialog() { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + String title = Messages.ReqIfImport_NoModuleFoundPopup_Title; + String content = Messages.ReqIfImport_NoModuleFoundPopup_Content; + MessageDialog.openInformation(shell, title, content); + } + + private void setMergeOperationCanceled(boolean isCanceled) { + mergeOperationCanceled[0] = isCanceled; + } + + private boolean isMergeOperationCanceled() { + return mergeOperationCanceled[0]; + } + + public static String getId() { + return TransposerTransformation.class.getCanonicalName(); + } + private boolean reqIfContainsModule(IContext context) { + Object isModulePresent = context.get(IRequirementsImporterBridgeConstants.REQIF_MODEL_CONTAINS_MODULE); + return isModulePresent instanceof Boolean && ((Boolean) isModulePresent).booleanValue(); } protected static void compact(Resource resource) { diff --git a/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/bridge/RequirementsVPBridge.java b/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/bridge/RequirementsVPBridge.java index 6647af36..756fd5ad 100644 --- a/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/bridge/RequirementsVPBridge.java +++ b/plugins/org.polarsys.capella.vp.requirements.importer/src/org/polarsys/capella/vp/requirements/importer/transposer/bridge/RequirementsVPBridge.java @@ -11,8 +11,11 @@ package org.polarsys.capella.vp.requirements.importer.transposer.bridge; import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.util.TreeIterator; @@ -21,6 +24,7 @@ import org.eclipse.emf.diffmerge.api.IMatchPolicy; import org.eclipse.emf.diffmerge.api.IMergePolicy; import org.eclipse.emf.diffmerge.api.IMergeSelector; +import org.eclipse.emf.diffmerge.api.diff.IDifference; import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; import org.eclipse.emf.diffmerge.api.scopes.IModelScope; import org.eclipse.emf.diffmerge.bridge.api.IBridge; @@ -36,6 +40,7 @@ import org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode; import org.eclipse.emf.diffmerge.ui.viewers.categories.DifferenceCategorySet; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.EditingDomain; @@ -52,6 +57,7 @@ import org.polarsys.capella.core.model.handler.helpers.HoldingResourceHelper; import org.polarsys.capella.core.model.helpers.ProjectExt; import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaModule; +import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaRelation; import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaTypesFolder; import org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.EClassCategory; import org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.RelationIdentifierCategory; @@ -88,7 +94,7 @@ protected EComparison compare(IEditableModelScope created, IEditableModelScope e IBridgeTrace existingTrace, IProgressMonitor monitor) { EComparison result = new EComparisonImpl(existing, created); IMatchPolicy matchPolicy = new BridgeTraceBasedMatchPolicy(created, createdTrace, existingTrace) { - + @Override public Object getMatchID(EObject element, IModelScope scope) { Object trace = super.getMatchID(element, scope); @@ -118,9 +124,11 @@ protected void initializeTemporaryScope(final IEditableModelScope scope) { // We want to create an empty model with same IDs than the target (to avoid reconciliation) final IEditableModelScope targetScope = _targetScope; Resource target = EcoreUtil.getRootContainer(targetScope.getContents().get(0)).eResource(); - // We load the target elements using the source editing domain to avoid blocking the target editing domain during Import - Resource targetLoadedInSourceScope= _sourceScope.getContents().get(0).eResource().getResourceSet().getResource(target.getURI(), true); - + // We load the target elements using the source editing domain to avoid blocking the target editing domain during + // Import + Resource targetLoadedInSourceScope = _sourceScope.getContents().get(0).eResource().getResourceSet() + .getResource(target.getURI(), true); + scope.add(targetLoadedInSourceScope.getContents().get(0)); // We remove the imported modules content since we create only elements in this package @@ -129,21 +137,31 @@ protected void initializeTemporaryScope(final IEditableModelScope scope) { manager.execute(new AbstractReadWriteCommand() { @Override public void run() { - Resource holdingResource = HoldingResourceHelper.getHoldingResource(TransactionHelper - .getEditingDomain(_sourceScope.getContents())); + Resource holdingResource = HoldingResourceHelper + .getHoldingResource(TransactionHelper.getEditingDomain(_sourceScope.getContents())); Project project = ProjectExt.getProject(scope.getContents().get(0)); HoldingResourceHelper.attachToHoldingResource(project, holdingResource); removeImportedModules(project); TreeIterator it = project.eAllContents(); + Map> capellaRelationsMap = new HashMap<>(); + while (it.hasNext()) { - EObject o = it.next(); - if (o instanceof ModelElement) { - ((ModelElement) o).getId(); + EObject element = it.next(); + + if (element instanceof CapellaRelation) { + updateCapellaRelationsMap((CapellaRelation) element, capellaRelationsMap); + } + + else if (element instanceof ModelElement) { + ((ModelElement) element).getId(); } } + + removeCapellaRelations(capellaRelationsMap); } + }); } } @@ -170,6 +188,35 @@ void removeImportedModules(Project project) { } } + private void updateCapellaRelationsMap(CapellaRelation capellaRelation, + Map> capellaRelationsMap) { + EObject container = capellaRelation.eContainer(); + if (container != null) { + EStructuralFeature containingFeature = capellaRelation.eContainingFeature(); + if (containingFeature != null) { + Object containingObject = container.eGet(containingFeature); + if (containingObject instanceof Collection) { + Collection containingCollection = (Collection) containingObject; + capellaRelationsMap.put(capellaRelation, containingCollection); + } + } + } + } + + private void removeCapellaRelations(Map> capellaRelationsMap) { + for (Map.Entry> entry : capellaRelationsMap.entrySet()) { + CapellaRelation capellaRelation = entry.getKey(); + Collection containingCollection = entry.getValue(); + + try { + containingCollection.remove(capellaRelation); + } catch (UnsupportedOperationException e) { + e.printStackTrace(); + } + } + + } + @Override protected void handleMergedDifferences(final IComparison comparison, final IBridgeTrace createdTrace, final IBridgeTrace existingTrace) { @@ -184,23 +231,25 @@ public void run() { } } + @Override protected EMFDiffNode createDiffNode(EComparison comparison, EditingDomain domain) { final EMFDiffNode diffNode = super.createDiffNode(comparison, domain); + Collection remainingDifferences = comparison.getRemainingDifferences(); + DifferenceCategorySet set = new DifferenceCategorySet(Messages.Categories_Name, Messages.Categories_Description); - set.getChildren().add( - new EClassCategory(RequirementsPackage.Literals.INTERNAL_RELATION, Messages.Categories_InternalRelations, - RequirementsPackage.Literals.INTERNAL_RELATION)); + set.getChildren().add(new EClassCategory(RequirementsPackage.Literals.INTERNAL_RELATION, + Messages.Categories_InternalRelations, RequirementsPackage.Literals.INTERNAL_RELATION)); EClassCategory typesFolderEClassCategory = new EClassCategory(RequirementsPackage.Literals.TYPES_FOLDER, - Messages.Categories_Types, RequirementsPackage.Literals.ENUM_VALUE, RequirementsPackage.Literals.DATA_TYPE_DEFINITION, - RequirementsPackage.Literals.ATTRIBUTE_DEFINITION, RequirementsPackage.Literals.ABSTRACT_TYPE, - RequirementsPackage.Literals.TYPES_FOLDER); + Messages.Categories_Types, RequirementsPackage.Literals.ENUM_VALUE, + RequirementsPackage.Literals.DATA_TYPE_DEFINITION, RequirementsPackage.Literals.ATTRIBUTE_DEFINITION, + RequirementsPackage.Literals.ABSTRACT_TYPE, RequirementsPackage.Literals.TYPES_FOLDER); typesFolderEClassCategory.setActive(true); /* Types Folder are now filtered */ set.getChildren().add(typesFolderEClassCategory); set.getChildren().add(new RelationIdentifierCategory()); - + diffNode.getCategoryManager().addCategories(set); return diffNode; } @@ -208,11 +257,11 @@ protected EMFDiffNode createDiffNode(EComparison comparison, EditingDomain domai public void initializeTrace(Trace trace) { trace.setSymbolFunction(RequirementEMFSYmbolFunction.getInstance()); } - + protected AbstractComparisonViewer createComparisonViewer(Composite parent) { return new RequirementsComparisonViewer(parent); } - + @Override protected UpdateDialog createMergeDialog(EMFDiffNode diffNode_p) { return new RequirementsVPMergeDialog(Display.getDefault().getActiveShell(), getTitle(), diffNode_p); diff --git a/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/.project b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/.project new file mode 100644 index 00000000..e1355722 --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/.project @@ -0,0 +1,12 @@ + + + model-with-manually-created-elements + + + + + + + org.polarsys.capella.project.nature + + diff --git a/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.afm b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.afm new file mode 100644 index 00000000..b720cee4 --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.afm @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.aird b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.aird new file mode 100644 index 00000000..1b29cc64 --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.aird @@ -0,0 +1,566 @@ + + + + model-with-manually-created-elements.afm + model-with-manually-created-elements.melodymodeller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller new file mode 100644 index 00000000..5e8de15c --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller @@ -0,0 +1,792 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller.bridgetraces b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller.bridgetraces new file mode 100644 index 00000000..bb036704 --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/model/model-with-manually-created-elements/model-with-manually-created-elements.melodymodeller.bridgetraces @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/FragmentationTestCase.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/FragmentationTestCase.java index e4cbf901..74990c34 100644 --- a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/FragmentationTestCase.java +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/FragmentationTestCase.java @@ -86,7 +86,7 @@ public void run() { IContext context = testRequirementsImportLauncher.getContext(); List differencesFromReferenceScope = (List) context - .get(TestInitializeTransformation.COMPARE_RESULT); + .get(TestInitializeTransformation.DIFFERENCES_FROM_REFERENCE_SCOPE); boolean anyMatch = differencesFromReferenceScope.stream().filter(EElementPresence.class::isInstance) .map(EElementPresence.class::cast).anyMatch(diff -> (diff.getElement() instanceof ModelElement)); diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffTestCase2.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffTestCase2.java index 2b17a6bb..3f341077 100644 --- a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffTestCase2.java +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffTestCase2.java @@ -76,7 +76,7 @@ public void run() { IContext context = testRequirementsImportLauncher.getContext(); @SuppressWarnings("unchecked") - List differences = (List) context.get(TestInitializeTransformation.COMPARE_RESULT); + List differences = (List) context.get(TestInitializeTransformation.DIFFERENCES_FROM_REFERENCE_SCOPE); // Take into account the Relation Identifier filter category RelationIdentifierCategory relationIdentifierCategoryFilter = new RelationIdentifierCategory(); diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffWithManuallyCreatedElements.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffWithManuallyCreatedElements.java new file mode 100644 index 00000000..0edebcfb --- /dev/null +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/ModelDiffWithManuallyCreatedElements.java @@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (c) 2017, 2018 THALES GLOBAL SERVICES. + * 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: + * Thales - initial API and implementation + *******************************************************************************/ +package org.polarsys.capella.vp.requirements.ju.testcases; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.api.diff.IDifference; +import org.eclipse.emf.diffmerge.api.diff.IElementPresence; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.business.api.session.Session; +import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand; +import org.polarsys.capella.common.helpers.TransactionHelper; +import org.polarsys.capella.core.data.cs.BlockArchitecture; +import org.polarsys.capella.test.framework.api.BasicTestCase; +import org.polarsys.capella.test.framework.context.SessionContext; +import org.polarsys.capella.test.framework.helpers.IResourceHelpers; +import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaIncomingRelation; +import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaOutgoingRelation; +import org.polarsys.capella.vp.requirements.ju.transposer.TestInitializeTransformation; +import org.polarsys.capella.vp.requirements.ju.transposer.TestRequirementsImportLauncher; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.vp.requirements.Requirements.Requirement; + +/** + * This test is related to the Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=568336 + * + * Here is the context of the test: We have a target model A and a reqif file that we want to import. + * + * When a reqif file is imported, the xml requif elements are transformed into ReqIf model elements. Next a temporary + * copy of model A is is created. All of the existing Reqif model elements are deleted from this temporary model and + * replaced with the newly created ones (at the previous step). Let us call this temporary source model B. + * + * Next a diff merge is done between temporary source model B and target model A. + * + * Any Requif elements that were created in model A (Requirements, CapellaRelations), can not exist into model B since + * this model was created from a reqif file. These newly created elements should be shown as deletions in the diff merge + * TARGET SCOPE. + * + * Any Requif deleted elements in model A that are still present in model B (and thus in the requif file) should be + * shown as additions in the diff merge REFERENCE SCOPE. + * + * The bug was that CapellaIncomingRelations were not removed from source model B during its construction, thus their + * target was not correctly mapped to the existing Requirement in model A, and thus they were not shown as deletions but + * as updates. Since the target of the CapellaIncomingRelation was a Requirement stored in temporary model, if the user + * merges the changes, the save of the model will fail. + * + * + * In this test we have imported the INPUT_REQUIF_FILE_NAME and we have
+ * 1) Created 4 CapellaIncomingRelations
+ * 2) Created 3 CapellaOutgoingRelations
+ * 3) Created 1 Requirement
+ * 4) Deleted 1 Existing Requirement
+ * + * All of these changes must be present as IElementPresences in the target or reference scope. + * + */ +public class ModelDiffWithManuallyCreatedElements extends BasicTestCase { + + public static final String SYSTEM_ANALYSIS = "f02bb545-b9de-4f49-8a99-60d9ad390b3e"; //$NON-NLS-1$ + private static final String INPUT_REQUIF_FILE_NAME = "model/inputs/model1.reqif"; //$NON-NLS-1$ + private static final String MODEL_NAME = "model-with-manually-created-elements"; //$NON-NLS-1$ + + private static final int TARGET_CAPELLA_INCOMING_RELATIONS_NUMBER = 4; + private static final int TARGET_CAPELLA_OUTGOING_RELATIONS_NUMBER = 3; + private static final int TARGET_CAPELLA_REQUIREMENTS_NUMBER = 1; + + private static final int REFERENCE_CAPELLA_INCOMING_RELATIONS_NUMBER = 0; + private static final int REFERENCE_CAPELLA_OUTGOING_RELATIONS_NUMBER = 0; + private static final int REFERENCE_CAPELLA_REQUIREMENTS_NUMBER = 1; + + @Override + public List getRequiredTestModels() { + return Arrays.asList(MODEL_NAME); + } + + @SuppressWarnings("unchecked") + @Override + public void test() throws Exception { + Session session = getSession(MODEL_NAME); + assertNotNull(session); + + SessionContext sessionContext = new SessionContext(session); + final BlockArchitecture systemAnalysis = sessionContext.getSemanticElement(SYSTEM_ANALYSIS); + + final TestRequirementsImportLauncher requirementsImportLauncher = new TestRequirementsImportLauncher(); + + TransactionHelper.getExecutionManager(systemAnalysis).execute(new AbstractReadWriteCommand() { + @Override + public void run() { + File requifFile = IResourceHelpers.getFileOrFolderInTestPlugin(getClass(), INPUT_REQUIF_FILE_NAME); + URI requifFileURI = URI.createFileURI(requifFile.getPath()); + requirementsImportLauncher.launch(requifFileURI, systemAnalysis, new NullProgressMonitor()); + } + }); + + IContext context = requirementsImportLauncher.getContext(); + + List targetScopeDifferences = (List) context + .get(TestInitializeTransformation.DIFFERENCES_FROM_TARGET_SCOPE); + assertScopeDifferences(targetScopeDifferences, TARGET_CAPELLA_INCOMING_RELATIONS_NUMBER, + TARGET_CAPELLA_OUTGOING_RELATIONS_NUMBER, TARGET_CAPELLA_REQUIREMENTS_NUMBER); + + List referenceScopeDifferences = (List) context + .get(TestInitializeTransformation.DIFFERENCES_FROM_REFERENCE_SCOPE); + assertScopeDifferences(referenceScopeDifferences, REFERENCE_CAPELLA_INCOMING_RELATIONS_NUMBER, + REFERENCE_CAPELLA_OUTGOING_RELATIONS_NUMBER, REFERENCE_CAPELLA_REQUIREMENTS_NUMBER); + + } + + private void assertScopeDifferences(List differences, int incomingRelationsNumber, + int outgoingRelationsNumber, int requirementsNumber) { + List incomingRelations = new ArrayList<>(); + List outgoingRelations = new ArrayList<>(); + List requirements = new ArrayList<>(); + + for (IDifference difference : differences) { + if (difference instanceof IElementPresence) { + IElementPresence elementPresence = (IElementPresence) difference; + EObject element = elementPresence.getElement(); + + if (element instanceof CapellaIncomingRelation) { + incomingRelations.add((CapellaIncomingRelation) element); + } else if (element instanceof CapellaOutgoingRelation) { + outgoingRelations.add((CapellaOutgoingRelation) element); + } else if (element instanceof Requirement) { + requirements.add((Requirement) element); + } + } + } + + assertEquals(incomingRelationsNumber, incomingRelations.size()); + assertEquals(outgoingRelationsNumber, outgoingRelations.size()); + assertEquals(requirementsNumber, requirements.size()); + } + +} diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testsuites/RequirementsTestSuite.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testsuites/RequirementsTestSuite.java index 86e7f443..7a4522bc 100644 --- a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testsuites/RequirementsTestSuite.java +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/testsuites/RequirementsTestSuite.java @@ -23,6 +23,7 @@ import org.polarsys.capella.vp.requirements.ju.testcases.ModelDiffTestCase; import org.polarsys.capella.vp.requirements.ju.testcases.ModelDiffTestCase2; import org.polarsys.capella.vp.requirements.ju.testcases.ModelDiffTestCase3; +import org.polarsys.capella.vp.requirements.ju.testcases.ModelDiffWithManuallyCreatedElements; import org.polarsys.capella.vp.requirements.ju.testcases.PropertyViewTestCase; import org.polarsys.capella.vp.requirements.ju.testcases.REQ_Relation_01; import org.polarsys.capella.vp.requirements.ju.testcases.REQ_Relation_02; @@ -81,7 +82,7 @@ protected List getTests() { tests.add(new Requirement_InternalRelationTarget_Requirement()); tests.add(new Requirement_InternalRelationSource_Requirement()); tests.add(new StringValueAttribute_Definition_AttributeDefinition()); - + tests.add(new ModelDiffWithManuallyCreatedElements()); tests.add(new ValidationRulesRegisteringTest()); tests.add(new ImportPreferencesTestCase()); @@ -90,7 +91,7 @@ protected List getTests() { tests.add(new REQ_Relation_02()); tests.add(new PropertyViewTestCase()); - + tests.add(new ModelDiffTestCase()); tests.add(new ModelDiffTestCase2()); tests.add(new ModelDiffTestCase3()); diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestInitializeTransformation.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestInitializeTransformation.java index a67d4dbe..25ad933f 100644 --- a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestInitializeTransformation.java +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestInitializeTransformation.java @@ -26,47 +26,59 @@ import org.polarsys.capella.vp.requirements.importer.transposer.policies.ReqIFImporterDiffPolicy; import org.polarsys.capella.vp.requirements.importer.transposer.policies.ReqIFMergePolicy; import org.polarsys.kitalpha.cadence.core.api.parameter.ActivityParameters; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; public class TestInitializeTransformation extends InitializeTransformation { - public static final String COMPARE_RESULT = "COMPARE_RESULT"; + public static final String DIFFERENCES_FROM_REFERENCE_SCOPE = "DIFFERENCES_FROM_REFERENCE_SCOPE"; + public static final String DIFFERENCES_FROM_TARGET_SCOPE = "DIFFERENCES_FROM_TARGET_SCOPE"; List differencesFromReferenceScope; - + List differencesFromTargetScope; public static String getId() { return TestInitializeTransformation.class.getCanonicalName(); } @Override - protected RequirementsVPBridge createBridge(IEditableModelScope sourceScope, IEditableModelScope targetScope, IBridge bridge) { + protected RequirementsVPBridge createBridge(IEditableModelScope sourceScope, IEditableModelScope targetScope, + IBridge bridge) { IMergeSelector selector = new IMergeSelector() { /** * @see org.eclipse.emf.diffmerge.api.IMergeSelector#getMergeDirection(org.eclipse.emf.diffmerge.api.diff.IDifference) */ + @Override public Role getMergeDirection(IDifference difference_p) { return Role.TARGET; } }; - return new RequirementsVPBridge(sourceScope, targetScope, bridge, new ReqIFImporterDiffPolicy(), new ReqIFMergePolicy(), selector) { + return new RequirementsVPBridge(sourceScope, targetScope, bridge, new ReqIFImporterDiffPolicy(), + new ReqIFMergePolicy(), selector) { @Override protected boolean isAlwaysInteractive() { return false; } - + + @Override protected EComparison compare(IEditableModelScope created, IEditableModelScope existing, IBridgeTrace createdTrace, IBridgeTrace existingTrace, IProgressMonitor monitor) { EComparison compare = super.compare(created, existing, createdTrace, existingTrace, monitor); differencesFromReferenceScope = compare.getDifferences(Role.REFERENCE); + differencesFromTargetScope = compare.getDifferences(Role.TARGET); return compare; } }; } - + + @Override protected IStatus _run(ActivityParameters activityParams) { // Override this to avoid launching the activity in a Job in testing mode IStatus status = initializeTransformation(activityParams); - getContext(activityParams).put(COMPARE_RESULT, differencesFromReferenceScope); + + IContext context = getContext(activityParams); + context.put(DIFFERENCES_FROM_REFERENCE_SCOPE, differencesFromReferenceScope); + context.put(DIFFERENCES_FROM_TARGET_SCOPE, differencesFromTargetScope); + return status; } } diff --git a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestTransposerTransformation.java b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestTransposerTransformation.java index cc85bf8d..e6227a48 100644 --- a/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestTransposerTransformation.java +++ b/tests/org.polarsys.capella.vp.requirements.ju/src/org/polarsys/capella/vp/requirements/ju/transposer/TestTransposerTransformation.java @@ -11,6 +11,7 @@ package org.polarsys.capella.vp.requirements.ju.transposer; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.polarsys.capella.vp.requirements.importer.transposer.activities.TransposerTransformation; import org.polarsys.kitalpha.cadence.core.api.parameter.ActivityParameters; @@ -18,14 +19,15 @@ * @author Joao Barata */ public class TestTransposerTransformation extends TransposerTransformation { - + public static String getId() { return TestTransposerTransformation.class.getCanonicalName(); } - + + @Override protected IStatus _run(ActivityParameters activityParams) { // Override this to avoid launching the activity in a Job in testing mode - IStatus status = mergeAndSave(activityParams); + IStatus status = mergeAndSave(activityParams, new NullProgressMonitor()); return status; } }