aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibault Le Ouay2014-11-28 14:06:02 -0500
committerThibault Le Ouay2014-11-28 14:11:48 -0500
commit1d6cd03072820fd568429c435123b8b164f0715d (patch)
treec8e7c233926f894ca70e0df428e343e187525c6b
parent6ab06a10379b4379c4f2776f29b90176d59330f5 (diff)
downloadeclipse.platform.ui-1d6cd03072820fd568429c435123b8b164f0715d.tar.gz
eclipse.platform.ui-1d6cd03072820fd568429c435123b8b164f0715d.tar.xz
eclipse.platform.ui-1d6cd03072820fd568429c435123b8b164f0715d.zip
Bug 450212 - [Tests] Migrate org.eclipse.e4.emf.xpath.test to JUnit 4
Change-Id: Ibd3258f55e7de4b58662604d91e1ad71c4bf2f67 Signed-off-by: Thibault Le Ouay <thibaultleouay@gmail.com>
-rw-r--r--tests/org.eclipse.e4.emf.xpath.test/E4 EMF Xpath Test Suite.launch40
-rw-r--r--tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF8
-rw-r--r--tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java22
-rw-r--r--tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java35
4 files changed, 87 insertions, 18 deletions
diff --git a/tests/org.eclipse.e4.emf.xpath.test/E4 EMF Xpath Test Suite.launch b/tests/org.eclipse.e4.emf.xpath.test/E4 EMF Xpath Test Suite.launch
new file mode 100644
index 0000000000..4dc6396ab2
--- /dev/null
+++ b/tests/org.eclipse.e4.emf.xpath.test/E4 EMF Xpath Test Suite.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.e4.emf.xpath.test.EMFTestSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.e4.emf.xpath.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF b/tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF
index d597acacc4..3db837b2c8 100644
--- a/tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF
@@ -10,11 +10,11 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.e4.emf.xpath.test.model.xpathtest,
org.eclipse.e4.emf.xpath.test.model.xpathtest.impl,
org.eclipse.e4.emf.xpath.test.model.xpathtest.util
-Require-Bundle: org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1",
+Require-Bundle: org.eclipse.e4.ui.model.workbench,
org.eclipse.e4.emf.xpath,
- org.junit;bundle-version="3.8.2",
- org.apache.commons.jxpath;bundle-version="1.3.0",
- org.eclipse.emf.ecore.xmi;bundle-version="2.7.0",
+ org.junit,
+ org.apache.commons.jxpath,
+ org.eclipse.emf.ecore.xmi,
org.eclipse.core.runtime,
org.eclipse.emf.ecore
Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java b/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java
new file mode 100644
index 0000000000..ee9686eefd
--- /dev/null
+++ b/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/EMFTestSuite.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Thibault Le Ouay and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thibault Le Ouay <thibaultleouay@gmail.com> - Bug 450212
+ ******************************************************************************/
+
+package org.eclipse.e4.emf.xpath.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses(ExampleQueriesTestCase.class)
+public class EMFTestSuite {
+
+}
diff --git a/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java b/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java
index 6e6cdef0f1..f63f7c9c73 100644
--- a/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java
+++ b/tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 BestSolution.at and others.
+ * Copyright (c) 2010, 2014 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,19 +7,22 @@
*
* Contributors:
* Tom Schindl <tom.schindl@bestsolution.at> - adjustment to EObject
+ * Thibault Le Ouay <thibaultleouay@gmail.com> - Bug 450212
******************************************************************************/
package org.eclipse.e4.emf.xpath.test;
-import java.util.Collections;
-import java.util.Iterator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import junit.framework.TestCase;
+import java.util.Iterator;
import org.apache.commons.jxpath.JXPathNotFoundException;
import org.eclipse.e4.emf.xpath.EcoreXPathContextFactory;
import org.eclipse.e4.emf.xpath.XPathContext;
import org.eclipse.e4.emf.xpath.XPathContextFactory;
-import org.eclipse.e4.emf.xpath.test.model.xpathtest.Menu;
import org.eclipse.e4.emf.xpath.test.model.xpathtest.XpathtestPackage;
import org.eclipse.e4.emf.xpath.test.model.xpathtest.impl.ExtendedNodeImpl;
import org.eclipse.e4.emf.xpath.test.model.xpathtest.impl.MenuImpl;
@@ -31,13 +34,18 @@ 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.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class ExampleQueriesTestCase extends TestCase {
+public class ExampleQueriesTestCase {
private ResourceSet resourceSet;
private XPathContext xpathContext;
private Resource resource;
+
+ @Test
public void testSimpleQuery() {
Object application = xpathContext.getValue("/");
@@ -68,6 +76,8 @@ public class ExampleQueriesTestCase extends TestCase {
}
+
+ @Test
public void testMenuQuery() {
Object application = xpathContext.getValue("/");
assertNotNull(application);
@@ -85,9 +95,8 @@ public class ExampleQueriesTestCase extends TestCase {
//assertFalse(i.hasNext());
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() {
resourceSet = new ResourceSetImpl();
resourceSet
.getResourceFactoryRegistry()
@@ -96,7 +105,6 @@ public class ExampleQueriesTestCase extends TestCase {
new XMIResourceFactoryImpl());
// Register the package to ensure it is available during loading.
- //
resourceSet.getPackageRegistry().put(XpathtestPackage.eNS_URI,
XpathtestPackage.eINSTANCE);
URI uri = URI.createPlatformPluginURI(
@@ -106,12 +114,11 @@ public class ExampleQueriesTestCase extends TestCase {
xpathContext = f.newContext(resource.getContents().get(0));
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() {
xpathContext = null;
resource.unload();
resourceSet.getResources().remove(resource);
- super.tearDown();
}
-} \ No newline at end of file
+}