aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1355360 - in /aries/trunk/subsystem/subsystem-itests/src/test: bundles/helloImpl/ bundles/helloImpl/META-INF/ bundles/helloImpl/org/ bundles/helloImpl/org/apache/ bundles/helloImpl/org/apache/aries/ bundles/helloImpl/org/apache/aries/subsy...
Date Fri, 29 Jun 2012 13:26:10 GMT
Author: mnuttall
Date: Fri Jun 29 13:26:07 2012
New Revision: 1355360

URL: http://svn.apache.org/viewvc?rev=1355360&view=rev
Log:
Aries-865: New 'hello world' subsytem itest.

Added:
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/MANIFEST.MF
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/Activator.java
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/HelloImpl.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/
    aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/
    aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/SUBSYSTEM.MF
    aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/helloImpl.jar   (with
props)
Modified:
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java

Added: aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/MANIFEST.MF?rev=1355360&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/MANIFEST.MF
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/META-INF/MANIFEST.MF
Fri Jun 29 13:26:07 2012
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: helloWorld api
+Bundle-SymbolicName: org.apache.aries.subsystem.itests.hello.impl
+Bundle-Version: 1.0.0
+Import-Package: org.apache.aries.subsystem.itests.hello.api, org.osgi.framework
+Bundle-Activator: org.apache.aries.subsystem.itests.hello.impl.Activator
+Provide-Capability: osgi.ee;osgi.ee=JavaSE;version=1.5
+

Added: aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/Activator.java?rev=1355360&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/Activator.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/Activator.java
Fri Jun 29 13:26:07 2012
@@ -0,0 +1,27 @@
+package org.apache.aries.subsystem.itests.hello.impl;
+
+import org.apache.aries.subsystem.itests.hello.api.Hello;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+
+	ServiceRegistration _sr = null;
+	
+	@Override
+	public void start(BundleContext bc) throws Exception 
+	{
+		Hello helloService = new HelloImpl();
+		_sr = bc.registerService(Hello.class, helloService, null);
+	}
+
+	@Override
+	public void stop(BundleContext bc) throws Exception 
+	{
+		if (_sr != null) { 
+			_sr.unregister();
+		}
+	}
+
+}

Added: aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/HelloImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/HelloImpl.java?rev=1355360&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/HelloImpl.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/bundles/helloImpl/org/apache/aries/subsystem/itests/hello/impl/HelloImpl.java
Fri Jun 29 13:26:07 2012
@@ -0,0 +1,12 @@
+package org.apache.aries.subsystem.itests.hello.impl;
+
+import org.apache.aries.subsystem.itests.hello.api.Hello;
+
+public class HelloImpl implements Hello {
+
+	@Override
+	public String saySomething() {
+		return "something";
+	}
+
+}

Added: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java?rev=1355360&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
Fri Jun 29 13:26:07 2012
@@ -0,0 +1,50 @@
+package org.apache.aries.subsystem.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+
+import org.apache.aries.subsystem.itests.hello.api.Hello;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.subsystem.Subsystem;
+
+@RunWith(JUnit4TestRunner.class)
+public class HelloWorldTest extends InstallTest {
+	
+	@Before
+	public void installTestApp() throws Exception 
+	{
+		createApplication("hello", new String[]{"helloImpl.jar"});
+	}
+
+	@Test
+	public void testHello() throws Exception 
+	{
+		Subsystem subsystem = installSubsystemFromFile("hello.esa");
+		try {
+			subsystem.start();
+			BundleContext bc = subsystem.getBundleContext();
+			Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+			String message = h.saySomething();
+			assertEquals ("Wrong message back", "something", message);
+			subsystem.stop();
+		}
+		finally {
+			uninstallSubsystemSilently(subsystem);
+		}
+	} 
+	
+	protected static Option[] updateOptions(Option[] options) 
+	{
+		Option[] helloOptions = options(
+				mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.itest.interfaces")
+//				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+		);
+		return combine(helloOptions, options);
+	}
+}

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java?rev=1355360&r1=1355359&r2=1355360&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
Fri Jun 29 13:26:07 2012
@@ -35,7 +35,7 @@ import org.osgi.service.subsystem.Subsys
 
 @RunWith(JUnit4TestRunner.class)
 public class InstallTest extends SubsystemTest {
-	private static void createApplication(String name, String[] content) throws Exception {
+	static void createApplication(String name, String[] content) throws Exception {
 		ZipFixture feature = ArchiveFixture
 				.newZip()
 				.binary("OSGI-INF/SUBSYSTEM.MF",

Added: aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/SUBSYSTEM.MF?rev=1355360&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/SUBSYSTEM.MF
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/OSGI-INF/SUBSYSTEM.MF
Fri Jun 29 13:26:07 2012
@@ -0,0 +1,3 @@
+Subsystem-SymbolicName: org.apache.aries.subsystem.itests.hello
+Subsystem-Type: osgi.subsystem.application
+Subsystem-Content: org.apache.aries.subsystem.itests.hello.impl

Added: aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/helloImpl.jar
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/helloImpl.jar?rev=1355360&view=auto
==============================================================================
Binary file - no diff available.

Propchange: aries/trunk/subsystem/subsystem-itests/src/test/resources/hello/helloImpl.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message