[Esbox-commits] r860 - in trunk/common/org.maemo.esbox.launch.tests: . .settings META-INF src src/org src/org/maemo src/org/maemo/esbox src/org/maemo/esbox/internal src/org/maemo/esbox/internal/launch src/org/maemo/esbox/internal/launch/tests src/org/maemo/esbox/launch src/org/maemo/esbox/launch/tests src/org/maemo/esbox/launch/tests/launch_protocol

lwang at garage.maemo.org lwang at garage.maemo.org
Fri Oct 10 01:30:41 EEST 2008


Author: lwang
Date: 2008-10-10 01:30:41 +0300 (Fri, 10 Oct 2008)
New Revision: 860

Added:
   trunk/common/org.maemo.esbox.launch.tests/.classpath
   trunk/common/org.maemo.esbox.launch.tests/.project
   trunk/common/org.maemo.esbox.launch.tests/.settings/
   trunk/common/org.maemo.esbox.launch.tests/.settings/org.eclipse.jdt.core.prefs
   trunk/common/org.maemo.esbox.launch.tests/META-INF/
   trunk/common/org.maemo.esbox.launch.tests/META-INF/MANIFEST.MF
   trunk/common/org.maemo.esbox.launch.tests/build.properties
   trunk/common/org.maemo.esbox.launch.tests/src/
   trunk/common/org.maemo.esbox.launch.tests/src/org/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/Activator.java
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/
   trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/TestLaunchProtocolExtensions.java
Log:
Unit test. This initial version contains test for LaunchProtocol extensions.

Added: trunk/common/org.maemo.esbox.launch.tests/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/.classpath	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/.classpath	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>


Property changes on: trunk/common/org.maemo.esbox.launch.tests/.classpath
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/.project
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/.project	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/.project	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.maemo.esbox.launch.tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/common/org.maemo.esbox.launch.tests/.project
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/.settings/org.eclipse.jdt.core.prefs	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,7 @@
+#Thu Oct 09 16:56:11 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5


Property changes on: trunk/common/org.maemo.esbox.launch.tests/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/META-INF/MANIFEST.MF	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.launch.tests
+Bundle-Version: 1.0.0
+Bundle-Activator: org.maemo.esbox.internal.launch.tests.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.junit4;bundle-version="4.3.1"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5


Property changes on: trunk/common/org.maemo.esbox.launch.tests/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/build.properties	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/build.properties	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .


Property changes on: trunk/common/org.maemo.esbox.launch.tests/build.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/Activator.java	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/Activator.java	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.launch.tests;
+
+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.maemo.esbox.launch.tests";
+
+	// 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;
+	}
+
+}


Property changes on: trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/internal/launch/tests/Activator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/TestLaunchProtocolExtensions.java
===================================================================
--- trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/TestLaunchProtocolExtensions.java	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/TestLaunchProtocolExtensions.java	2008-10-09 22:30:41 UTC (rev 860)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * 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:
+ *    Ling Wang (Nokia) - initial version. Aug 12, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.tests.launch_protocol;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.maemo.esbox.launch.ILaunchProtocolType;
+import org.maemo.esbox.launch.LaunchProtocolFactory;
+import org.maemo.esbox.launch.ui.ILaunchProtocolPage;
+import org.maemo.esbox.launch.ui.LaunchProtocolPageFactory;
+
+/**
+ * @author LWang
+ *
+ */
+public class TestLaunchProtocolExtensions {
+
+	/**
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	/**
+	 * @throws java.lang.Exception
+	 */
+	@After
+	public void tearDown() throws Exception {
+	}
+
+	@Test
+	public void testGetFactories() {
+		LaunchProtocolFactory lpf = LaunchProtocolFactory.getInstance();
+		assertNotNull("Fail to get LaunchProtocolFactory.", lpf);
+
+		LaunchProtocolPageFactory lppf = LaunchProtocolPageFactory.getInstance();
+		assertNotNull("Fail to get LaunchProtocolPageFactory.", lppf);
+	}
+
+	@Test
+	public void testGetAllProtocolTypes() {
+		// make sure all extensions are loaded correctly.
+		//
+		List<ILaunchProtocolType> types = LaunchProtocolFactory.getInstance().getAllProtocolTypes();
+		
+		assertTrue("Fail to get expected number of LaunchProtocolPage extensions", types.size() >= 2);
+		
+		for (ILaunchProtocolType t : types) {
+			System.out.println("LaunchProtocolType: " + t.getID());
+			System.out.println("\t Display name: " + t.getName());
+			System.out.println("\t Description: " + t.getDescription());
+		}
+	}
+
+	@Test
+	public void testGetAllProtocolPages() {
+		// make sure extensions are loaded without problem.
+		//
+		List<ILaunchProtocolPage> pages = LaunchProtocolPageFactory.getInstance().getAllProtocolPages();
+		
+		assertTrue("Fail to get expected number of LaunchProtocolPage extensions", pages.size() >= 2);
+		
+		for (ILaunchProtocolPage p : pages) {
+			System.out.println("LaunchProtocolPage loaded for " + p.getLaunchProtocolID());
+		}
+	}
+
+	@Test
+	public void testProtocolPagesMatchTypes() {
+		// Make sure there is a page mapped each type.
+		//
+		List<ILaunchProtocolType> types = LaunchProtocolFactory.getInstance().getAllProtocolTypes();
+		List<ILaunchProtocolPage> pages = LaunchProtocolPageFactory.getInstance().getAllProtocolPages();
+		
+		assertEquals("LaunchProtocolPage extension count does not equal that of LaunchProtocolType", 
+					types.size(), pages.size());
+		
+		for (ILaunchProtocolType t : types) {
+			ILaunchProtocolPage page = LaunchProtocolPageFactory.getInstance().getProtocolPage(t.getID());
+			assertNotNull("Fail to get page for protocol type:" + t.getID(), page);
+		}
+	}
+}


Property changes on: trunk/common/org.maemo.esbox.launch.tests/src/org/maemo/esbox/launch/tests/launch_protocol/TestLaunchProtocolExtensions.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the Esbox-commits mailing list