Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Lorenzo2018-09-20 14:44:50 +0000
committerVincent Lorenzo2018-09-24 12:48:11 +0000
commit8cecd76dc09d03a13f583cb3e88077ef4cc49b32 (patch)
tree1ed452773a292a3ace9a85d06341061573631f0d /tests
parent63b1a888a459657f473eae4b23af6092fb6b02f2 (diff)
downloadorg.eclipse.papyrus-8cecd76dc09d03a13f583cb3e88077ef4cc49b32.tar.gz
org.eclipse.papyrus-8cecd76dc09d03a13f583cb3e88077ef4cc49b32.tar.xz
org.eclipse.papyrus-8cecd76dc09d03a13f583cb3e88077ef4cc49b32.zip
Bug 539293: [XText] Validation rules written by the developper are ignored during the final setValue process.
+ upgrade to java 1.8 Change-Id: Ic4fbb3f2b47e63c022df39b084f4ce9652f142e2 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF2
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/pom.xml2
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/AbstractGrammarTest.java15
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/Activator.java19
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/XTextEditorTester.java50
5 files changed, 79 insertions, 9 deletions
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
index eb93549175e..0c3c833ffaf 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
@@ -16,7 +16,7 @@ Export-Package: org.eclipse.papyrus.uml.textedit.tests,
org.eclipse.papyrus.uml.textedit.tests.editor
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Name: Textedit Tests
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.uml.textedit.tests.Activator
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/pom.xml b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/pom.xml
index fbd8c736ac1..24819150c49 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/pom.xml
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.papyrus.tests</groupId>
<artifactId>org.eclipse.papyrus.uml.textedit.tests</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/AbstractGrammarTest.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/AbstractGrammarTest.java
index df4325fb31b..bb9332b8e27 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/AbstractGrammarTest.java
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/AbstractGrammarTest.java
@@ -1,3 +1,18 @@
+/*****************************************************************************
+ * 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 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.uml.textedit.tests;
import org.eclipse.emf.ecore.EObject;
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/Activator.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/Activator.java
index 1b3180a573f..4d18d6c7901 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/Activator.java
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/Activator.java
@@ -1,3 +1,18 @@
+/*****************************************************************************
+ * 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 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.uml.textedit.tests;
import org.osgi.framework.BundleActivator;
@@ -13,16 +28,20 @@ public class Activator implements BundleActivator {
/*
* (non-Javadoc)
+ *
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
+ *
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/XTextEditorTester.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/XTextEditorTester.java
index bb6ec0be069..558652e3a58 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/XTextEditorTester.java
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/XTextEditorTester.java
@@ -1,7 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2014, 2018 CEA LIST
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Bug 539293
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.textedit.tests;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
@@ -9,20 +25,28 @@ import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfigu
public class XTextEditorTester<T extends EObject> {
+ /**
+ * the XText editor configuration to use for the JUnit tests
+ */
protected DefaultXtextDirectEditorConfiguration editor;
- public XTextEditorTester(DefaultXtextDirectEditorConfiguration editor){
+ /**
+ * the result of the executed command
+ */
+ private CommandResult commandResult;
+
+ public XTextEditorTester(final DefaultXtextDirectEditorConfiguration editor) {
this.editor = editor;
}
- public T parseText(T initialElement, String textToParse) throws Exception{
+ public T parseText(final T initialElement, final String textToParse) throws Exception {
IParser parser = editor.createParser(initialElement);
ICommand parseCommand = parser.getParseCommand(new EObjectAdapter(initialElement), textToParse, 0);
parseCommand.execute(new NullProgressMonitor(), null);
-
+ this.commandResult = parseCommand.getCommandResult();
return initialElement;
}
-
+
public T parseText(final EObject parentElement, final T initialElement, final String textToParse) throws Exception {
IParser parser = editor.createParser(parentElement);
ICommand parseCommand = parser.getParseCommand(new EObjectAdapter(initialElement), textToParse, 0);
@@ -30,14 +54,26 @@ public class XTextEditorTester<T extends EObject> {
parseCommand.execute(new NullProgressMonitor(), null);
}
+ this.commandResult = parseCommand.getCommandResult();
return initialElement;
}
- public String getInitialText(T element){
- return editor.getTextToEdit(element);
+ public String getInitialText(T element) {
+ return this.editor.getTextToEdit(element);
}
public String getParentInitialText(final Object element) {
- return editor.getTextToEdit(element);
+ return this.editor.getTextToEdit(element);
+ }
+
+ /**
+ *
+ * @return
+ * the command result. This method must be called after the method parseText. If not, this method will return <code>null</code>;
+ *
+ * @since 1.3
+ */
+ public CommandResult getCommandResult() {
+ return this.commandResult;
}
}

Back to the top