diff options
Diffstat (limited to 'tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml')
-rw-r--r-- | tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java | 15 | ||||
-rw-r--r-- | tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java (renamed from tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTest.java) | 12 | ||||
-rw-r--r-- | tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/CustomCreateFromPaletteTest.xtend | 49 | ||||
-rw-r--r-- | tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/ProfileDiagramGenerateTestsWorkflow.xtend | 69 |
4 files changed, 137 insertions, 8 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java index 57e5eef23f3..ecba0442871 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2014 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,18 +9,25 @@ * Contributors:
* Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
* Christian W. Damus - bug 451613
+ * Christian W. Damus - bug 464647
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.profile.tests;
+import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
+import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite.DynamicClasses;
import org.eclipse.papyrus.uml.diagram.profile.custom.commands.tests.AllCustomCommandTests;
import org.eclipse.papyrus.uml.diagram.profile.tests.canonical.AllCanonicalTests;
import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-@RunWith(Suite.class)
-@Suite.SuiteClasses({ AllCustomCommandTests.class, AllCanonicalTests.class })
+@RunWith(ClassificationSuite.class)
+@SuiteClasses({
+ AllCustomCommandTests.class,
+ AllCanonicalTests.class,
+})
+@DynamicClasses("org.eclipse.papyrus.uml.diagram.profile.tests.AllGenTests")
public class AllTests {
// Test suite
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java index 87b6ee5d101..3490d6e4eb0 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTest.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -7,13 +7,17 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
+ * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
+ * Christian W. Damus - bug 464647
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.profile.tests;
-
-public abstract interface IProfileDiagramTest {
+/**
+ * Repository of string constants used throughout the Profile Diagram tests.
+ */
+public abstract interface IProfileDiagramTestsConstants {
public static final String PROJECT_NAME = "ProfileDiagramTestProject";
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/CustomCreateFromPaletteTest.xtend b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/CustomCreateFromPaletteTest.xtend new file mode 100644 index 00000000000..99c6510a971 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/CustomCreateFromPaletteTest.xtend @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2015 Christian W. Damus 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.profile.tests.generation + +import javax.inject.Inject +import javax.inject.Singleton +import org.eclipse.papyrus.tests.framework.gmfgenuml2utp.CreateFromPaletteTest +import org.eclipse.papyrus.tests.framework.gmfgenuml2utp.TransformationUtilities +import org.eclipse.uml2.uml.CallOperationAction +import org.eclipse.uml2.uml.InstanceSpecification + +/** + * Customization of the create-from-palette test UTP transformation for profile diagrams, to + * account for specific custom editing behaviours of this diagram. + */ + @Singleton +class CustomCreateFromPaletteTest extends CreateFromPaletteTest { + @Inject extension TransformationUtilities + final String defaultAssociationName = 'srcMul' + + override protected def toCallTestLinkOperationActivity(InstanceSpecification linkEditPart, InstanceSpecification sourceEditPart, InstanceSpecification targetEditPart) { + super.toCallTestLinkOperationActivity(linkEditPart, sourceEditPart, targetEditPart) => [ + if (linkEditPart.editPart == 'AssociationEditPart') { + // Insert a parameter for the association name (invokes a different overloaded variant of the framework method) + ownedNodes.filter(CallOperationAction).head.arguments.add(3, defaultAssociationName.toValuePin('initialName')) + } + ] + } + + override protected def toCallTestLinkOperationActivity(InstanceSpecification linkEditPart, InstanceSpecification sourceEditPart, InstanceSpecification targetEditPart, InstanceSpecification containerEditPart) { + super.toCallTestLinkOperationActivity(linkEditPart, sourceEditPart, targetEditPart, containerEditPart) => [ + if (linkEditPart.editPart == 'AssociationEditPart') { + // Insert a parameter for the association name (invokes a different overloaded variant of the framework method) + ownedNodes.filter(CallOperationAction).head.arguments.add(4, defaultAssociationName.toValuePin('initialName')) + } + ] + } +} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/ProfileDiagramGenerateTestsWorkflow.xtend b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/ProfileDiagramGenerateTestsWorkflow.xtend new file mode 100644 index 00000000000..6c141521092 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/generation/ProfileDiagramGenerateTestsWorkflow.xtend @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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 + * Christian W. Damus - bug 464647 + * + ******************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile.tests.generation + +import org.eclipse.emf.mwe2.runtime.workflow.WorkflowContextImpl +import org.eclipse.papyrus.tests.framework.mwe.GenerateTestsWorkflow +import org.eclipse.papyrus.tests.framework.gmfgenuml2utp.GMFGen2UTPModule +import org.eclipse.papyrus.tests.framework.gmfgenuml2utp.CreateFromPaletteTest + +/** + * Xtend program for the generation of the Profile Diagram tests. + */ +class ProfileDiagramGenerateTestsWorkflow { + + def static void main(String[] args) { + val workflow = new GenerateTestsWorkflow() + runWorkflow(workflow); + } + + def static void runWorkflow(extension GenerateTestsWorkflow workflow) { + testProjectName = 'org.eclipse.papyrus.uml.diagram.profile.tests' + gmfgenUri = resourceURI('/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen') + testSrcGenLocation = 'test-gen/' + testModel = 'model/ProfileDiagramTest.uml' + + utpModuleFunction = [gmfgen, framework, utp | + new GMFGen2UTPModule(gmfgen, framework, utp) { + override protected void bindTestRules() { + // Inject our custom test transformation rules + bind(CreateFromPaletteTest).to(CustomCreateFromPaletteTest) + } + } => [ + diagramTestPackageName = 'org.eclipse.papyrus.uml.diagram.profile.tests' + topContainerEditPart = 'PackageEditPart'; + ] + ] + + except [ + editPart [ + reason = 'Most tests aren\'t applicable.' + editPart = named('AssociationNodeEditPart') || 'DependencyNodeEditPart' + || 'AssociationBranchEditPart' || 'DependencyBranchEditPart' + ] + editPart [ + critical + reason = 'Cannot generate tests for non-UML elements.' + editPart = named('ShortCutDiagramEditPart') + ] + editPart [ + kind = interactive + reason = 'Pops up dialog to select metaclasses to import.' + editPart = named('MetaclassEditPart') || 'MetaclassEditPartCN' + ] + ] + + run(new WorkflowContextImpl); + } + +} |