Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java50
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java86
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java87
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java107
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java106
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java96
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java155
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java114
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java71
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java92
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java41
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java129
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java192
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java110
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java112
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java68
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties18
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java22
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java34
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java31
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java19
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java33
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java36
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java30
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java21
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java34
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java47
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java35
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java30
33 files changed, 0 insertions, 2074 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java
deleted file mode 100644
index 586e124ec84..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.papyrus.core.queries.test;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.core.queries.test"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java
deleted file mode 100644
index dbca9a6dbd6..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class for {@link AND} query
- */
-public class ANDTests extends AbstractQueryUtilTest implements IQueryNames {
-
- /** query on which tests are based */
- protected static ModelQuery andQuery;
-
- /** model query configuration model */
- protected static ModiscoQueryConfiguration configuration;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // retrieve the query
- andQuery = QueryUtil.retrieveModelQuery(AND_Boolean_1_Boolean_1, IQueryNames.CoreQueriesSet_Name);
- assertNotNull("Query " + AND_Boolean_1_Boolean_1 + " was not found.", andQuery);
-
- // retrieve the configuration
- configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ANDConfiguration_Path);
- assertNotNull("Configuration " + IQueryNames.ANDConfiguration_Path + " was not found.", configuration);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.QueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryEObjectQueryConfiguration() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertFalse("Query result should be false", result);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java
deleted file mode 100644
index 2e9c13be42e..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Package;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-
-/**
- * Abstract class for all tests
- */
-public abstract class AbstractQueryUtilTest implements IQueryNames {
-
- /** path to the uml model to load */
- public static final String BASIC_UML_MODEL = "/resources/basic.uml";
-
- /** path to the ecore model to load */
- public static final String BASIC_ECORE_MODEL = "/resources/basic.ecore";
-
- /** main uml model */
- protected static EObject umlPackage;
-
- /** sub class: basicClass */
- protected static Class umlClass;
-
-
- /** main ecore package */
- protected static EObject ecorePackage;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeAbstractClass() throws Exception {
- umlPackage = TestUtil.loadModel(Activator.PLUGIN_ID, BASIC_UML_MODEL);
- assertNotNull("test model was not found.", umlPackage);
-
- // retrieve the UML class
- if(umlPackage instanceof Package) {
- umlClass = (Class)((Package)umlPackage).getOwnedMember(UML_CLASS_NAME);
- }
- assertNotNull("test class was not found.", umlClass);
-
- ecorePackage = TestUtil.loadModel(Activator.PLUGIN_ID, BASIC_ECORE_MODEL);
- assertNotNull("test model was not found.", ecorePackage);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterAbstractClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java
deleted file mode 100644
index 4268608f477..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Tests cases for {@link BooleanTest_NoParameters}
- */
-public class BooleanMultipleTest_NoParametersTests extends AbstractQueryUtilTest {
-
- /** query on which tests are based */
- protected static ModelQuery booleanMultipleQuery;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- booleanMultipleQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " was not found.", booleanMultipleQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_BooleanTest_NoParameters() {
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " was not found.", booleanMultipleQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
- */
- @Test
- public final void testIsValidQuery_BooleanTest_NoParameters() {
- IStatus status = QueryUtil.isValidBooleanQuery(booleanMultipleQuery);
- assertFalse("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " should not be a valid query, as it returns many booleans. Current Status: " + status.getMessage(), status.isOK());
-
- status = QueryUtil.isValidQuery(booleanMultipleQuery);
- assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryBooleanTest_NoParameters() {
- boolean exceptionThrown = false;
- boolean result = false;
-
- // test with not an element context
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- assertFalse("The query should not be valid, as the query is not valid", result);
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertTrue("An Exception should be thrown", exceptionThrown);
-
- // test with not an element context
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- assertFalse("The query should not be valid, as the query is not valid", result);
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertTrue("An exception should be thrown", exceptionThrown);
-
- // test with not an element context
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be valid, as the query is not valid", result);
- // assertTrue("An exception should be thrown", exceptionThrown);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java
deleted file mode 100644
index bc25ff4ad97..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Tests cases for {@link BooleanTest_NoParameters}
- */
-public class BooleanTest_NoParametersTests extends AbstractQueryUtilTest {
-
- /** query on which tests are based */
- protected static ModelQuery booleanQuery;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- booleanQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " was not found.", booleanQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_BooleanTest_NoParameters() {
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " was not found.", booleanQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
- */
- @Test
- public final void testIsValidQuery_BooleanTest_NoParameters() {
- IStatus status = QueryUtil.isValidQuery(booleanQuery);
- assertTrue("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " should be a valid query. Current Status: " + status.getMessage(), status.isOK());
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryBooleanTest_NoParameters() {
- boolean exceptionThrown;
- boolean result;
-
- // test with null as parameter
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertTrue(result);
- assertFalse("No Exception should be thrown", exceptionThrown);
-
- // test with an empty array list
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertTrue(result);
- assertFalse("No Exception should be thrown", exceptionThrown);
-
- // test with not an element context
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(booleanQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be valid, as the element is not a UML Element", result);
- // assertTrue("An exception should be thrown", exceptionThrown);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java
deleted file mode 100644
index 2ece8ece34b..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-
-/**
- * Interface that contains all query names available in the test query set
- */
-public interface IQueryNames {
-
- /** query set: configurationTestQuerySet */
- public static final String CoreQueriesConfigurationSet_Name = "CoreQueriesConfigurationSet";
-
- /** query set for queries */
- public static final String CoreQueriesSet_Name = "CoreQueriesTest";
-
- /** configuration name for IsNamed query test */
- public static final String IsNamedQueryConfiguration_Path = "/resources/IsNamedQueryConfiguration.configuration";
-
- /** query isNamed (String[1]) : boolean */
- public final static String IsNamed_String_1 = "IsNamed";
-
- /** query isNameLongerThan (boolean[1], Integer[1) : boolean */
- public static String isNameLongerThan_Boolean_1_Integer_1 = "IsNameLongerThan";
-
- /** query ListelementWithName */
- public static String ListElementsWithName_String_1 = "ListElementsWithName";
-
- /** query ListelementWithName */
- public static String ListElementsInstanceofClassifiers = "ListElementsInstanceofClassifiers";
-
- /** configuration name for ListElementsInstanceofClassifiersWithNameContainingBasic query test */
- public static final String ListElementsInstanceofClassifiersWithNameContainingBasic_path = "/resources/ListElementsInstanceofClassifiersWithNameContainingBasic.configuration";
-
- /** configuration name for ListElementWithName query test */
- public static final String ListElementsWithNameQueryConfiguration_Path = "/resources/ListElementsWithNameBasic.configuration";
-
- /** query AND (boolean[1], booelan[1) : boolean */
- public static String AND_Boolean_1_Boolean_1 = "AND";
-
- /** configuration 1 name for IsNamed query test */
- public static final String IsNameLongerThanConfiguration1_Path = "/resources/IsNameLongerThanQueryConfiguration1.configuration";
-
- /** configuration 2 name for IsNamed query test */
- public static final String IsNameLongerThanConfiguration2_Path = "/resources/IsNameLongerThanQueryConfiguration2.configuration";
-
- /** configuration name for and query test */
- public static final String ANDConfiguration_Path = "/resources/AndConfiguration.configuration";
-
- /** Query: BooleanTest_String_1(String[1]) : boolean */
- public final static String BooleanTest_String_1 = "BooleanTest_String_1";
-
- /** parameter name */
- public final static String BooleanTest_String_1_StringParamName = "paramString";
-
- /** Query: BooleanTest_Boolean_1_Integer_1(Boolean[1], Integer[1]) : boolean */
- public final static String BooleanTest_Boolean_1_Integer_1 = "BooleanTest_Boolean_1_Integer_1";
-
- /** parameter name */
- public final static String BooleanTest_Boolean_1_Integer_1_BooleanParamName = "paramBoolean";
-
- /** parameter name */
- public final static String BooleanTest_Boolean_1_Integer_1_IntegetParamName = "paramInteger";
-
- /** Query: BooleanTest_Enum_1(Enum[1]) : boolean */
- public final static String BooleanTest_Enum_1 = "BooleanTest_Enum_1";
-
- /** parameter name */
- public final static String BooleanTest_Enum_1_EnumParamName = "paramEnum";
-
- /** Query: BooleanTest_String_3(String[3]) : boolean */
- public final static String BooleanTest_String_3 = "BooleanTest_String_3";
-
- /** parameter name */
- public final static String BooleanTest_String_3_StringParamName = "paramString3";
-
- /** Query: BooleanTest_String_Star(String[*]) : boolean */
- public final static String BooleanTest_String_Star = "BooleanTest_String_Star";
-
- /** parameter name */
- public final static String BooleanTest_String_Star_StringParamName = "paramStringStar";
-
- /** name of the class in the test model */
- public static final String UML_CLASS_NAME = "BasicClass";
-
-}
-
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java
deleted file mode 100644
index e6f9243b45c..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class for boolean and integer parameters for queries
- */
-public class IsNameLongerThanTests extends AbstractQueryUtilTest implements IQueryNames {
-
- /** query on which tests are based */
- protected static ModelQuery isNameLongerThanQuery;
-
- /** model query configuration model n°1 */
- protected static ModiscoQueryConfiguration configuration1;
-
- /** model query configuration model n°2 */
- protected static ModiscoQueryConfiguration configuration2;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // retrieve the query
- isNameLongerThanQuery = QueryUtil.retrieveModelQuery(isNameLongerThan_Boolean_1_Integer_1, IQueryNames.CoreQueriesSet_Name);
- assertNotNull("Query " + isNameLongerThan_Boolean_1_Integer_1 + " was not found.", isNameLongerThanQuery);
-
- // retrieve the configuration
- configuration1 = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNameLongerThanConfiguration1_Path);
- assertNotNull("Configuration " + IQueryNames.IsNameLongerThanConfiguration1_Path + " was not found.", configuration1);
-
- // retrieve the configuration
- configuration2 = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNameLongerThanConfiguration2_Path);
- assertNotNull("Configuration " + IQueryNames.IsNameLongerThanConfiguration2_Path + " was not found.", configuration2);
-
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationPackage1() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration1);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertFalse("Query result should be false", result);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationClass1() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlClass, configuration1);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertTrue("Query result should be true", result);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationPackage2() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration2);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertFalse("Query result should be true", result);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationClass2() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlClass, configuration2);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertFalse("Query result should be false", result);
- }
-
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java
deleted file mode 100644
index 472d97cfa77..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * test class for the configuration evaluation for string parameters
- */
-public class IsNamedTests extends AbstractQueryUtilTest implements IQueryNames {
-
- /** query on which tests are based */
- protected static ModelQuery isNamedQuery;
-
- /** model query configuration model */
- protected static ModiscoQueryConfiguration configuration;
-
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // retrieve the query
- isNamedQuery = QueryUtil.retrieveModelQuery(IsNamed_String_1, IQueryNames.CoreQueriesSet_Name);
- assertNotNull("Query " + IsNamed_String_1 + " was not found.", isNamedQuery);
-
- // retrieve the configuration
- configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNamedQueryConfiguration_Path);
- assertNotNull("Configuration " + IQueryNames.IsNamedQueryConfiguration_Path + " was not found.", configuration);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQueryModelQueryEObjectModiscoQueryConfigurationValid() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertTrue("Query result should be true", result);
-
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- */
- @Test
- public final void testEvaluateBooleanQueryModelQueryEObjectModiscoQueryConfigurationNotValid() {
- // test if no exception is thrown
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(umlPackage.eContents().get(0), configuration);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertFalse("Query result should be false", result);
-
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java
deleted file mode 100644
index 8c1d7874891..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class for query chaining, with list of elements given from one list to another
- */
-public class ListElementsInstanceofClassifiersWithNameContainingBasicTests extends AbstractQueryUtilTest implements IQueryNames {
-
- /** query on which tests are based */
- protected static ModelQuery query;
-
- /** model query configuration model */
- protected static ModiscoQueryConfiguration configuration;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // retrieve the query
- query = QueryUtil.retrieveModelQuery(ListElementsInstanceofClassifiers, IQueryNames.CoreQueriesSet_Name);
- assertNotNull("Query " + ListElementsInstanceofClassifiers + " was not found.", query);
-
- // retrieve the configuration
- configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ListElementsInstanceofClassifiersWithNameContainingBasic_path);
- assertNotNull("Configuration " + IQueryNames.ListElementsInstanceofClassifiersWithNameContainingBasic_path + " was not found.", configuration);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.QueryConfiguration)}.
- */
- @Test
- public final void testEvaluateQueryEObjectQueryConfiguration() {
- // test if no exception is thrown
- Object result = false;
- try {
- result = QueryUtil.evaluateQuery(umlPackage, configuration);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertNotNull("Query result should not be null", result);
- assertTrue("Result should be of type list, but is: " + result, result instanceof List<?>);
- assertTrue("There should be 2 elements in the result list - root package and one class. Currently: " + ((List<Object>)result).size(), ((List<Object>)result).size() == 2);
-
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java
deleted file mode 100644
index 64025d548e4..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.core.queries.test.Activator;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test Case for List Element
- */
-public class ListElementsWithNameTest extends AbstractQueryUtilTest implements IQueryNames {
-
- /** query on which tests are based */
- protected static ModelQuery query;
-
- /** model query configuration model */
- protected static ModiscoQueryConfiguration configuration;
-
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // retrieve the query
- query = QueryUtil.retrieveModelQuery(ListElementsWithName_String_1, IQueryNames.CoreQueriesSet_Name);
- assertNotNull("Query " + ListElementsWithName_String_1 + " was not found.", query);
-
- // retrieve the configuration
- configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ListElementsWithNameQueryConfiguration_Path);
- assertNotNull("Configuration " + IQueryNames.ListElementsWithNameQueryConfiguration_Path + " was not found.", configuration);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
- * .
- */
- @SuppressWarnings("unchecked")
- @Test
- public final void testEvaluateBooleanQueryEObjectModiscoQueryConfiguration() {
- // test if no exception is thrown
- Object result = false;
- try {
- result = QueryUtil.evaluateQuery(umlPackage, configuration);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertNotNull("Query result should not be null", result);
- assertTrue("Result should be of type list, but is: " + result, result instanceof List<?>);
- assertTrue("There should be 3 elements in the result list - root package and 2 owned class. Currently: " + ((List<Object>)result).size(), ((List<Object>)result).size() == 3);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java
deleted file mode 100644
index 565011b1863..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.core.queries.test.modisco.messages"; //$NON-NLS-1$
-
- public static String QueryUtilTest_Error_CatalogIsNull;
-
- public static String QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound;
-
- public static String QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound;
-
- public static String QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery;
-
- public static String QueryUtilTest_Error_NotNull_UnfoundableQuery;
-
- public static String QueryUtilTest_Error_NotNull_UnfoundableQuerySet;
-
- public static String QueryUtilTest_NotFoundQuery;
-
- public static String QueryUtilTest_NotFoundQuerySet;
-
- public static String QueryUtilTest_QuerySetName_CoreQueriesTest;
-
- public static String QueryUtilTest_TestName_BooleanTest_NoParameters;
-
- public static String QueryUtilTest_TestName_StringTest_NoParameters;
-
- public static String QueryUtilTest_TestName_StringMultipleTest_NoParameters;
-
- public static String QueryUtilTest_TestName_BooleanMultipleTest_NoParameters;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java
deleted file mode 100644
index 7fb77e77264..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.emf.facet.infra.query.core.ModelQuerySetCatalog;
-import org.eclipse.papyrus.infra.queries.core.modisco.ModelQueryNotFoundException;
-import org.eclipse.papyrus.infra.queries.core.modisco.ModelQuerySetNotFoundException;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class for {@link QueryUtil}
- */
-public class QueryUtilBasicTests {
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#QueryUtil()}.
- */
- @Test
- public final void testQueryUtil() {
- ModelQuerySetCatalog catalog = ModelQuerySetCatalog.getSingleton();
- assertNotNull(Messages.QueryUtilTest_Error_CatalogIsNull, catalog);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_NoQuerySet() {
- // do not retrieve the query set
- boolean exceptionThrown = false;
- ModelQuery queryNoSet = null;
- try {
- queryNoSet = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_NotFoundQuery, Messages.QueryUtilTest_NotFoundQuerySet);
- } catch (ModelQuerySetNotFoundException e) {
- exceptionThrown = true;
- }
- assertTrue(Messages.QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound, exceptionThrown);
- assertNull(Messages.QueryUtilTest_Error_NotNull_UnfoundableQuerySet, queryNoSet);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_NoQuery() {
- // do not retrieve the query
- boolean exceptionThrown = false;
- ModelQuery queryNoQuery = null;
- try {
- queryNoQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_NotFoundQuery, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- } catch (ModelQueryNotFoundException e) {
- exceptionThrown = true;
- } catch (ModelQuerySetNotFoundException e) {
- exceptionThrown = true;
- }
- assertTrue(Messages.QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery, exceptionThrown);
- assertNull(Messages.QueryUtilTest_Error_NotNull_UnfoundableQuery, queryNoQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_QueryFound() {
- // retrieve a query
- boolean exceptionThrown = false;
- ModelQuery queryBooleanTest_NoParameters = null;
- try {
- queryBooleanTest_NoParameters = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- } catch (ModelQueryNotFoundException e) {
- exceptionThrown = true;
- } catch (ModelQuerySetNotFoundException e) {
- exceptionThrown = true;
- }
- assertFalse(Messages.QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound, exceptionThrown);
- Assert.assertNotNull(queryBooleanTest_NoParameters != null);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java
deleted file mode 100644
index b242d26dc93..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.eclipse.uml2.uml.VisibilityKind;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test Class for {@link QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}
- */
-public class QueryUtil_Parameters extends AbstractQueryUtilTest {
-
- /** queries on which tests are based */
- protected static ModelQuery queryBooleanTest_String_1, queryBooleanTest_Boolean_1_Integer_1, queryBooleanTest_Enum_1, queryBooleanTest_String_3, queryBooleanTest_String_Star;
-
- // list of possible values to test
- /** value: String */
- protected static String paramStringValue = "string";
-
- /** value: Integer */
- protected static int paramIntValue = 1;
-
- /** value: boolean */
- protected static boolean paramBooleanValue = true;
-
- /** value: Enumeration */
- protected static VisibilityKind paramEnumValue = VisibilityKind.PUBLIC_LITERAL;
-
- /** list of Strings */
- protected static List<String> paramStringList2Value = Arrays.asList("string1", "String2");
-
- /** list of Strings */
- protected static List<String> paramStringList4Value = Arrays.asList("string1", "String2", "string3", "String4");
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- queryBooleanTest_String_1 = QueryUtil.retrieveModelQuery(BooleanTest_String_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + BooleanTest_String_1 + " was not found.", queryBooleanTest_String_1);
-
- queryBooleanTest_Boolean_1_Integer_1 = QueryUtil.retrieveModelQuery(BooleanTest_Boolean_1_Integer_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + BooleanTest_Boolean_1_Integer_1 + " was not found.", queryBooleanTest_Boolean_1_Integer_1);
-
- queryBooleanTest_Enum_1 = QueryUtil.retrieveModelQuery(BooleanTest_Enum_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + BooleanTest_Enum_1 + " was not found.", queryBooleanTest_Enum_1);
-
- queryBooleanTest_String_3 = QueryUtil.retrieveModelQuery(BooleanTest_String_3, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + BooleanTest_String_3 + " was not found.", queryBooleanTest_String_3);
-
- queryBooleanTest_String_Star = QueryUtil.retrieveModelQuery(BooleanTest_String_Star, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + BooleanTest_String_Star + " was not found.", queryBooleanTest_String_Star);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
- */
- @Test
- public final void testIsValidParameterSet_String_Valid() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
- IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
-
- assertTrue("Status should be OK: " + status, status.isOK());
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
- */
- @Test
- public final void testIsValidParameterSet_String_WrongName() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName + "NotValid", paramStringValue);
- IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
-
- assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
- */
- @Test
- public final void testIsValidParameterSet_String_WrongSize() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
- validParamSet.put(BooleanTest_String_1_StringParamName + "NotValid", paramStringValue);
- IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
-
- assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
- */
- @Test
- public final void testIsValidParameterSet_String_WrongType() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramBooleanValue);
- IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
- System.err.println("warning, no test is currently run for type: " + status);
- // FIXME: warning, no test is currently run for type
- // assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
- */
- @Test
- public final void testIsValidParameterSet_BooleanInteger_WrongSize() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
- IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_Boolean_1_Integer_1, validParamSet);
-
- assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil# evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.Map)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQuery_BooleanTest_String_1_Valid() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
- boolean exceptionThrown = false;
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(queryBooleanTest_String_1, umlPackage, validParamSet);
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertTrue("result should be valid.", result);
- assertFalse("No Exception should be thrown", exceptionThrown);
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil# evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.Map)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQuery_BooleanTest_String_1_NotValid() {
- // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
- HashMap<String, Object> validParamSet = new HashMap<String, Object>();
- validParamSet.put(BooleanTest_String_1_StringParamName, paramBooleanValue);
- @SuppressWarnings("unused")
- boolean exceptionThrown = false;
- boolean result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(queryBooleanTest_String_1, umlPackage, validParamSet);
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("result should not be valid, as the value given is a boolean", result);
- // assertTrue("An exception should be thrown", exceptionThrown);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java
deleted file mode 100644
index 550373d19ba..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Tests cases for {@link BooleanTest_NoParameters}
- */
-public class StringMultipleTest_NoParametersTests extends AbstractQueryUtilTest {
-
- /** query on which tests are based */
- protected static ModelQuery stringsQuery;
-
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- stringsQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " was not found.", stringsQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_StringMultipleTest_NoParameters() {
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " was not found.", stringsQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
- */
- @Test
- public final void testIsValidQuery_StringMultipleTest_NoParameters() {
- IStatus status = QueryUtil.isValidBooleanQuery(stringsQuery);
- assertFalse("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " should not be a valid query, as it returns several Strings. Current Status: " + status.getMessage(), status.isOK());
-
- status = QueryUtil.isValidQuery(stringsQuery);
- assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQuery_StringMultipleTest_NoParameters() {
- boolean exceptionThrown = false;
- boolean result = false;
-
-
- // test with null as parameter
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(stringsQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
- assertFalse("No Exception should be thrown", exceptionThrown);
-
- // test with an empty array list
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(stringsQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
- assertFalse("No Exception should be thrown", exceptionThrown);
-
- // test with not an element context
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(stringsQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
- // assertTrue("An exception should be thrown", exceptionThrown);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java
deleted file mode 100644
index cb0094e4d28..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.facet.infra.query.ModelQuery;
-import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Tests cases for {@link BooleanTest_NoParameters}
- */
-public class StringTest_NoParametersTests extends AbstractQueryUtilTest {
-
- /** query on which tests are based */
- protected static ModelQuery stringQuery;
-
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- stringQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_StringTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " was not found.", stringQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
- */
- @Test
- public final void testRetrieveModelQuery_StringTest_NoParameters() {
- assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " was not found.", stringQuery);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
- */
- @Test
- public final void testIsValidQuery_StringTest_NoParameters() {
- IStatus status = QueryUtil.isValidBooleanQuery(stringQuery);
- assertFalse("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " should not be a valid query, as it returns a String. Current Status: " + status.getMessage(), status.isOK());
-
- status = QueryUtil.isValidQuery(stringQuery);
- assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
-
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
- * .
- */
- @Test
- public final void testEvaluateBooleanQuery_StringTest_NoParameters() {
- boolean exceptionThrown = false;
- boolean result = false;
-
-
- // test with null as parameter
- exceptionThrown = false;
- result = false;
- try {
- // test with null as parameter
- result = QueryUtil.evaluateBooleanQuery(stringQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
- assertFalse("No Exception should be thrown", exceptionThrown);
-
- // test with an empty array list
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(stringQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- assertFalse("No Exception should be thrown", exceptionThrown);
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
-
- // test with not an element context
- exceptionThrown = false;
- result = false;
- try {
- result = QueryUtil.evaluateBooleanQuery(stringQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
- } catch (Exception e) {
- exceptionThrown = true;
- }
- // assertTrue("An exception should be thrown", exceptionThrown);
- assertFalse("The query should not be true, as it returns a string, not a boolean", result);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java
deleted file mode 100644
index 5f608e8ffcb..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco;
-
-import java.io.IOException;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
-
-
-/**
- * Utility class for tests
- */
-public class TestUtil {
-
- /**
- * Loads a model and returns the main element
- *
- * @param pluginPath
- * the identifier of the test plugin
- * @param localPath
- * the path to the file
- * @return the model loaded
- */
- public static EObject loadModel(String pluginPath, String localPath) {
- ResourceSet resourceSet = new ResourceSetImpl();
- Resource resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + pluginPath + localPath, true));
- try {
- resource.load(null);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return resource.getContents().get(0);
- }
-
- /**
- * Loads a model and returns the contained model configuration element
- *
- * @param pluginPath
- * the identifier of the test plugin
- * @param localPath
- * the path to the file
- * @return the model loaded
- */
- public static ModiscoQueryConfiguration loadQueryConfiguration(String pluginPath, String localPath) {
- ResourceSet resourceSet = new ResourceSetImpl();
- Resource resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + pluginPath + localPath, true));
- try {
- resource.load(null);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return (ModiscoQueryConfiguration)resource.getContents().get(0);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties
deleted file mode 100644
index 839db70c4a9..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Query set Names
-QueryUtilTest_NotFoundQuerySet=NotFoundQuerySet
-QueryUtilTest_QuerySetName_CoreQueriesTest=CoreQueriesTest
-
-# Query Names
-QueryUtilTest_NotFoundQuery=NotFoundQuery
-QueryUtilTest_TestName_BooleanTest_NoParameters=BooleanTest_NoParameters
-QueryUtilTest_TestName_BooleanMultipleTest_NoParameters=BooleanMultipleTest_NoParameters
-QueryUtilTest_TestName_StringTest_NoParameters=StringTest_NoParameters
-QueryUtilTest_TestName_StringMultipleTest_NoParameters=StringMultipleTest_NoParameters
-
-# Errors
-QueryUtilTest_Error_CatalogIsNull=Catalog singleton should not be null
-QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound=Exception thrown whereas query should be found
-QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound=No Exception thrown whereas query Set was not found
-QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery=No Exception thrown whereas query was not found
-QueryUtilTest_Error_NotNull_UnfoundableQuery=Non existing Query should be null
-QueryUtilTest_Error_NotNull_UnfoundableQuerySet=Non existing QuerySet should be null \ No newline at end of file
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java
deleted file mode 100644
index 372ac3939db..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.NamedElement;
-
-/** test - AND query */
-public class AND implements IJavaModelQuery<NamedElement, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // retrieve operand left
- boolean leftValue = (Boolean)parameterValues.getValueByParameterName("AND_leftOperand");
- // retrieve operand right
- boolean rightValue = (Boolean)parameterValues.getValueByParameterName("AND_rightOperand");
- // return value
- return (leftValue && rightValue);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java
deleted file mode 100644
index 2b453f63916..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return multiple values - no parameters */
-public class BooleanMultipleTest_NoParameters implements IJavaModelQuery<Element, Collection<Boolean>> {
-
- /**
- * {@inheritDoc}
- */
- public Collection<Boolean> evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return Arrays.asList(true, false, true);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java
deleted file mode 100644
index 3a2fe753106..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - Boolean[1], Integer[1] */
-public class BooleanTest_Boolean_1_Integer_1 implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return true;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java
deleted file mode 100644
index 546bb68085d..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - Enum[1] */
-public class BooleanTest_Enum_1 implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return true;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java
deleted file mode 100644
index 6b8d0062a0c..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - no parameters */
-public class BooleanTest_NoParameters implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return (context instanceof Element);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java
deleted file mode 100644
index d4aaf417b0a..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.papyrus.core.queries.test.modisco.IQueryNames;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - String[1] */
-public class BooleanTest_String_1 implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return (parameterValues.getValueByParameterName(IQueryNames.BooleanTest_String_1_StringParamName) instanceof String);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java
deleted file mode 100644
index 4de555ad4e6..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - String[3] */
-public class BooleanTest_String_3 implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return true;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java
deleted file mode 100644
index 12d1e0da49d..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - boolean return value - String[-1] */
-public class BooleanTest_String_Star implements IJavaModelQuery<Element, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return true;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java
deleted file mode 100644
index 900f94da7fb..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.NamedElement;
-
-/** test - test if the name of the element is equal to the specified name */
-public class CopyOfIsNamed implements IJavaModelQuery<NamedElement, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // retrieve the parameter name
- Object value = parameterValues.getParameterValueByName("name");
- if(value == null) {
- throw new ModelQueryExecutionException("The parameter name has no values");
- }
- if(!(value instanceof LiteralString)) {
- throw new ModelQueryExecutionException("The parameter name does not have a String value");
- }
-
- if(context == null) {
- throw new ModelQueryExecutionException("The context is null, should be a NamedElement");
- }
-
- return ((LiteralString)value).stringValue().equalsIgnoreCase(context.getName());
-
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java
deleted file mode 100644
index 75981cdc3e8..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.NamedElement;
-
-/** test - check if the element's name is longer than the specified number. The booelan indicates if it is tru when length is equal. */
-public class IsNameLongerThan implements IJavaModelQuery<NamedElement, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // retrieve the 2 values for the query
- boolean isTrueWhenEqual = (Boolean)parameterValues.getValueByParameterName("isTrueWhenEqual");
- int length = (Integer)parameterValues.getValueByParameterName("length");
-
- if(!(context instanceof NamedElement)) {
- throw new ModelQueryExecutionException("context is null or is not a Named Element");
- }
-
- String name = context.getName();
- if(name == null) {
- return false;
- }
-
- if(name.length() == length) {
- return isTrueWhenEqual;
- } else if(name.length() > length) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java
deleted file mode 100644
index d3be1d98827..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.NamedElement;
-
-/** test - test if the name of the element is equal to the specified name */
-public class IsNamed implements IJavaModelQuery<NamedElement, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // retrieve the parameter name
- Object value = parameterValues.getValueByParameterName("name");
- if(value == null) {
- throw new ModelQueryExecutionException("The parameter name has no values");
- }
- if(!(value instanceof String)) {
- throw new ModelQueryExecutionException("The parameter name does not have a String value");
- }
-
- if(context == null) {
- throw new ModelQueryExecutionException("The context is null, should be a NamedElement");
- }
-
- return ((String)value).equalsIgnoreCase(context.getName());
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java
deleted file mode 100644
index d48d4257d6e..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-
-/** test - test if an element is strict type of given value */
-public class IsStrictInstanceOf implements IJavaModelQuery<EObject, Boolean> {
-
- /**
- * {@inheritDoc}
- */
- public Boolean evaluate(final EObject context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
-
- String eObjectTypeName = context.eClass().getInstanceTypeName();
- String typeName = parameterValues.getValueByParameterName("typeName").toString();
-
- return eObjectTypeName.equals(typeName);
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java
deleted file mode 100644
index b8a0e48eefe..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.NamedElement;
-
-/** test - list the elements given as parameters that are instanceof Classifiers */
-public class ListElementsInstanceofClassifiers implements IJavaModelQuery<EObject, Collection<Classifier>> {
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public Collection<Classifier> evaluate(final EObject context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // retrieve the list of elements
- List<NamedElement> elements = (List<NamedElement>)parameterValues.getValueByParameterName("elementList");
-
- List<Classifier> classifiers = new ArrayList<Classifier>();
- for(NamedElement element : elements) {
- if(element instanceof Classifier) {
- classifiers.add((Classifier)element);
- }
- }
- return classifiers;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java
deleted file mode 100644
index 9e08001426e..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/** test - return a list of named elements for whicv name contains basic */
-public class ListElementsWithName implements IJavaModelQuery<Package, Collection<NamedElement>> {
-
- /**
- * {@inheritDoc}
- */
- public Collection<NamedElement> evaluate(final Package context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
-
- String containedString = (String)parameterValues.getValueByParameterName("containedString");
-
- Collection<Object> namedElements = EcoreUtil.getObjectsByType(context.allOwnedElements(), UMLPackage.eINSTANCE.getNamedElement());
- List<NamedElement> elements = new ArrayList<NamedElement>();
-
-
- // add the element itself if required
- if(context instanceof NamedElement) {
- String name = ((NamedElement)context).getName();
- if(name != null && name.indexOf(containedString) != -1) {
- elements.add((NamedElement)context);
- }
- }
-
- // check all contained elements
- for(Object namedElement : namedElements) {
- String name = ((NamedElement)namedElement).getName();
- if(name != null && name.indexOf(containedString) != -1) {
- elements.add((NamedElement)namedElement);
- }
- }
- return elements;
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java
deleted file mode 100644
index a9f3a8f6f83..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - string return multiple values - no parameters */
-public class StringMultipleTest_NoParameters implements IJavaModelQuery<Element, Collection<String>> {
-
- /**
- * {@inheritDoc}
- */
- public Collection<String> evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- // TODO Auto-generated method stub
- return Arrays.asList("Test1", "Test2");
- }
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java
deleted file mode 100644
index 60e1dc0be08..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.queries.test.modisco.queries;
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.uml2.uml.Element;
-
-/** test - string return value - no parameters */
-public class StringTest_NoParameters implements IJavaModelQuery<Element, String> {
-
- /**
- * {@inheritDoc}
- */
- public String evaluate(final Element context, final ParameterValueList parameterValues)
- throws ModelQueryExecutionException {
- return "Test";
- }
-}

Back to the top