Skip to content

Commit

Permalink
Add plug-in fragment as test plug-in for the UI (#68)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
DenisKnoepfle committed Aug 11, 2014
1 parent 1000cac commit d62b499
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public static void cleanUp() throws IOException {
if (tempDir.exists()) {
LpeFileUtils.removeDir(tempDir.getAbsolutePath());
}

shutdownServer();
}

@Before
Expand All @@ -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, "");
Expand Down Expand Up @@ -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");
Expand Down
9 changes: 9 additions & 0 deletions org.spotter.eclipse.ui.test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/bin
/target
/.classpath
/.settings
/.project
.DS_Store
/.prefs
/src/META-INF/MANIFEST.MF
/lib
9 changes: 9 additions & 0 deletions org.spotter.eclipse.ui.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -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"
19 changes: 19 additions & 0 deletions org.spotter.eclipse.ui.test/build.properties
Original file line number Diff line number Diff line change
@@ -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/,\
.
94 changes: 94 additions & 0 deletions org.spotter.eclipse.ui.test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.spotter</groupId>
<artifactId>org.spotter.parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../org.spotter.parent</relativePath>
</parent>

<artifactId>org.spotter.eclipse.ui.test</artifactId>
<name>DynamicSpotter Eclipse UI Test</name>

<packaging>eclipse-test-plugin</packaging>

<properties>
<tycho-version>0.20.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>kepler</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/kepler</url>
</repository>
</repositories>


<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<providerHint>junit4</providerHint>
</configuration>
</plugin>
</plugins>

</build>

<dependencies>
<dependency>
<groupId>org.spotter</groupId>
<artifactId>org.spotter.eclipse.ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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");
}*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions org.spotter.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<module>../org.spotter.service</module>
<module>../org.spotter.client</module>
<module>../org.spotter.eclipse.ui</module>
<module>../org.spotter.eclipse.ui.test</module>


</modules>
Expand Down

0 comments on commit d62b499

Please sign in to comment.