From d62b4992d6ea0547711c2eb1aa18e1fdde182588 Mon Sep 17 00:00:00 2001 From: Denis Knoepfle Date: Mon, 11 Aug 2014 10:30:49 +0200 Subject: [PATCH 1/2] Add plug-in fragment as test plug-in for the UI (#68) Added a fragment that connects to the host which is the UI. Removed the server shutdown at the SpotterServiceClientTest which caused trouble during testing phase. Added first unit test for Eclipse UI. Change-Id: I0d925510e6a75d5293025aab1ad9a84b9b80d6e3 Signed-off-by: Denis Knoepfle --- .../client/SpotterServiceClientTest.java | 17 +--- org.spotter.eclipse.ui.test/.gitignore | 9 ++ .../META-INF/MANIFEST.MF | 9 ++ org.spotter.eclipse.ui.test/build.properties | 19 ++++ org.spotter.eclipse.ui.test/pom.xml | 94 +++++++++++++++++++ .../org/spotter/eclipse/ui/ActivatorTest.java | 76 +++++++++++++++ .../eclipse/ui/model/ExtensionMetaobject.java | 2 - org.spotter.parent/pom.xml | 1 + 8 files changed, 211 insertions(+), 16 deletions(-) create mode 100644 org.spotter.eclipse.ui.test/.gitignore create mode 100644 org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF create mode 100644 org.spotter.eclipse.ui.test/build.properties create mode 100644 org.spotter.eclipse.ui.test/pom.xml create mode 100644 org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java diff --git a/org.spotter.client/test/org/spotter/client/SpotterServiceClientTest.java b/org.spotter.client/test/org/spotter/client/SpotterServiceClientTest.java index e5894af..6214676 100644 --- a/org.spotter.client/test/org/spotter/client/SpotterServiceClientTest.java +++ b/org.spotter.client/test/org/spotter/client/SpotterServiceClientTest.java @@ -78,8 +78,6 @@ public static void cleanUp() throws IOException { if (tempDir.exists()) { LpeFileUtils.removeDir(tempDir.getAbsolutePath()); } - - shutdownServer(); } @Before @@ -92,16 +90,6 @@ private static void startServer() { ServerLauncher.main(argsStartCustomized); } - private static void shutdownServer() { - String[] argsShutdownCustomized = {"shutdown", "port=" + port }; - ServerLauncher.main(argsShutdownCustomized); - try { - Thread.sleep(SHUTDOWN_WAIT_DELAY); - } catch (InterruptedException e) { - LOGGER.warn("interrupted sleep delay after shutdown!"); - } - } - @Test public void testSpotterServiceClient() { ssc.updateUrl(host, ""); @@ -183,9 +171,10 @@ private static void createTempDir() throws IOException { private static void initGlobalConfigs(String baseDir) { Properties properties = new Properties(); - properties.setProperty("org.lpe.common.extension.appRootDir", tempDir.getAbsolutePath()); + properties.setProperty(ExtensionRegistry.APP_ROOT_DIR_PROPERTY_KEY, tempDir.getAbsolutePath()); + properties.setProperty(ExtensionRegistry.PLUGINS_FOLDER_PROPERTY_KEY, "plugins"); properties.setProperty("org.spotter.conf.pluginDirNames", "plugins"); - properties.setProperty(ConfigKeys.RESULT_DIR, baseDir + System.getProperty("file.separator")); + properties.setProperty(ConfigKeys.RESULT_DIR, baseDir + System.getProperty("file.separator") + "results"); properties.setProperty(ConfigKeys.EXPERIMENT_DURATION, "1"); properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_INTERVAL_LENGTH, "1"); properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_NUM_USERS_PER_INTERVAL, "1"); diff --git a/org.spotter.eclipse.ui.test/.gitignore b/org.spotter.eclipse.ui.test/.gitignore new file mode 100644 index 0000000..db23838 --- /dev/null +++ b/org.spotter.eclipse.ui.test/.gitignore @@ -0,0 +1,9 @@ +/bin +/target +/.classpath +/.settings +/.project +.DS_Store +/.prefs +/src/META-INF/MANIFEST.MF +/lib \ No newline at end of file diff --git a/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF b/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF new file mode 100644 index 0000000..49290cd --- /dev/null +++ b/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: DynamicSpotter Eclipse UI Test +Bundle-SymbolicName: org.spotter.eclipse.ui.test +Bundle-Version: 0.0.1.qualifier +Bundle-Vendor: SAP AG +Fragment-Host: org.spotter.eclipse.ui;bundle-version="0.0.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Require-Bundle: org.junit;bundle-version="4.10.0" diff --git a/org.spotter.eclipse.ui.test/build.properties b/org.spotter.eclipse.ui.test/build.properties new file mode 100644 index 0000000..1a60b8a --- /dev/null +++ b/org.spotter.eclipse.ui.test/build.properties @@ -0,0 +1,19 @@ +# +# Copyright 2014 SAP AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +source.. = src/ +bin.includes = META-INF/,\ + . diff --git a/org.spotter.eclipse.ui.test/pom.xml b/org.spotter.eclipse.ui.test/pom.xml new file mode 100644 index 0000000..071d7f3 --- /dev/null +++ b/org.spotter.eclipse.ui.test/pom.xml @@ -0,0 +1,94 @@ + + 4.0.0 + + org.spotter + org.spotter.parent + 0.0.1-SNAPSHOT + ../org.spotter.parent + + + org.spotter.eclipse.ui.test + DynamicSpotter Eclipse UI Test + + eclipse-test-plugin + + + 0.20.0 + UTF-8 + + + + + kepler + p2 + http://download.eclipse.org/releases/kepler + + + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + + org.eclipse.tycho + target-platform-configuration + + consider + + + linux + gtk + x86 + + + linux + gtk + x86_64 + + + win32 + win32 + x86 + + + win32 + win32 + x86_64 + + + macosx + cocoa + x86_64 + + + + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho-version} + + true + true + junit4 + + + + + + + + + org.spotter + org.spotter.eclipse.ui + 0.0.1-SNAPSHOT + + + \ No newline at end of file diff --git a/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java b/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java new file mode 100644 index 0000000..4799f39 --- /dev/null +++ b/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java @@ -0,0 +1,76 @@ +package org.spotter.eclipse.ui; + +//import static org.junit.Assert.*; +import junit.framework.Assert; + +import org.junit.Test; + +public class ActivatorTest { + + @Test + public void testActivator() { + Assert.assertEquals("org.spotter.eclipse.ui", Activator.PLUGIN_ID); + } + + /*@Test + public void testStartBundleContext() { + fail("Not yet implemented"); + } + + @Test + public void testStopBundleContext() { + fail("Not yet implemented"); + }*/ + + @Test + public void testGetDefault() { + Activator activator = Activator.getDefault(); + Assert.assertNotNull(activator); + } + + /*@Test + public void testGetClient() { + fail("Not yet implemented"); + } + + @Test + public void testTestServiceStatus() { + fail("Not yet implemented"); + } + + @Test + public void testGetNavigatorViewer() { + fail("Not yet implemented"); + } + + @Test + public void testSetNavigatorViewer() { + fail("Not yet implemented"); + } + + @Test + public void testGetProjectHistoryElements() { + fail("Not yet implemented"); + } + + @Test + public void testSetProjectHistoryElements() { + fail("Not yet implemented"); + } + + @Test + public void testGetSelectedProjects() { + fail("Not yet implemented"); + } + + @Test + public void testSetSelectedProjects() { + fail("Not yet implemented"); + } + + @Test + public void testGetImage() { + fail("Not yet implemented"); + }*/ + +} diff --git a/org.spotter.eclipse.ui/src/org/spotter/eclipse/ui/model/ExtensionMetaobject.java b/org.spotter.eclipse.ui/src/org/spotter/eclipse/ui/model/ExtensionMetaobject.java index 31ee742..32bc42d 100644 --- a/org.spotter.eclipse.ui/src/org/spotter/eclipse/ui/model/ExtensionMetaobject.java +++ b/org.spotter.eclipse.ui/src/org/spotter/eclipse/ui/model/ExtensionMetaobject.java @@ -42,8 +42,6 @@ public class ExtensionMetaobject { * The project the extension is associated with * @param extensionName * The name of the extension - * @param configParams - * The parameters of the extension */ public ExtensionMetaobject(String projectName, String extensionName) { this.projectName = projectName; diff --git a/org.spotter.parent/pom.xml b/org.spotter.parent/pom.xml index 82df768..ca27d62 100644 --- a/org.spotter.parent/pom.xml +++ b/org.spotter.parent/pom.xml @@ -18,6 +18,7 @@ ../org.spotter.service ../org.spotter.client ../org.spotter.eclipse.ui + ../org.spotter.eclipse.ui.test From fd2a3ca144fdbeeba39be48ecd2dcb73520e1fcc Mon Sep 17 00:00:00 2001 From: Denis Knoepfle Date: Mon, 11 Aug 2014 12:23:07 +0200 Subject: [PATCH 2/2] Disable ui test module in parent pom Change-Id: Id82551bbc7155b746eb594048e65c755455b92c9 Signed-off-by: Denis Knoepfle --- org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF | 3 ++- org.spotter.eclipse.ui.test/pom.xml | 12 ++++++++++++ .../src/org/spotter/eclipse/ui/ActivatorTest.java | 1 - org.spotter.eclipse.ui/META-INF/MANIFEST.MF | 3 ++- org.spotter.parent/pom.xml | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF b/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF index 49290cd..a5484a9 100644 --- a/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF +++ b/org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF @@ -6,4 +6,5 @@ Bundle-Version: 0.0.1.qualifier Bundle-Vendor: SAP AG Fragment-Host: org.spotter.eclipse.ui;bundle-version="0.0.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Require-Bundle: org.junit;bundle-version="4.10.0" +Bundle-ClassPath: ., + ../org.spotter.eclipse.ui diff --git a/org.spotter.eclipse.ui.test/pom.xml b/org.spotter.eclipse.ui.test/pom.xml index 071d7f3..79e2d9d 100644 --- a/org.spotter.eclipse.ui.test/pom.xml +++ b/org.spotter.eclipse.ui.test/pom.xml @@ -78,6 +78,13 @@ true true junit4 + + + junit + junit + 4.10 + + @@ -90,5 +97,10 @@ org.spotter.eclipse.ui 0.0.1-SNAPSHOT + + junit + junit + 4.10 + \ No newline at end of file diff --git a/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java b/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java index 4799f39..91fefc9 100644 --- a/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java +++ b/org.spotter.eclipse.ui.test/src/org/spotter/eclipse/ui/ActivatorTest.java @@ -1,6 +1,5 @@ package org.spotter.eclipse.ui; -//import static org.junit.Assert.*; import junit.framework.Assert; import org.junit.Test; diff --git a/org.spotter.eclipse.ui/META-INF/MANIFEST.MF b/org.spotter.eclipse.ui/META-INF/MANIFEST.MF index eb78287..049096a 100644 --- a/org.spotter.eclipse.ui/META-INF/MANIFEST.MF +++ b/org.spotter.eclipse.ui/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0", org.eclipse.ui.ide;bundle-version="3.9.1", org.eclipse.core.runtime;bundle-version="3.9.0", org.eclipse.ui.navigator;bundle-version="3.5.300", - org.eclipse.ui.navigator.resources;bundle-version="3.4.500" + org.eclipse.ui.navigator.resources;bundle-version="3.4.500", + org.eclipse.equinox.ds;bundle-version="1.4.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ClassPath: ., diff --git a/org.spotter.parent/pom.xml b/org.spotter.parent/pom.xml index ca27d62..05d415a 100644 --- a/org.spotter.parent/pom.xml +++ b/org.spotter.parent/pom.xml @@ -18,7 +18,7 @@ ../org.spotter.service ../org.spotter.client ../org.spotter.eclipse.ui - ../org.spotter.eclipse.ui.test +