You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by li...@apache.org on 2010/11/30 19:34:12 UTC
svn commit: r1040681 - in /incubator/aries/trunk/subsystem/subsystem-itests:
./ src/test/java/org/apache/aries/subsystem/itests/
src/test/java/org/ops4j/pax/runner/platform/equinox/internal/
src/test/resources/ src/test/resources/META-INF/platform-equi...
Author: linsun
Date: Tue Nov 30 18:34:11 2010
New Revision: 1040681
URL: http://svn.apache.org/viewvc?rev=1040681&view=rev
Log:
(ARIES-498) Sybsystem: subsystem-core updated to use scope instead of composite bundle
Added:
incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml (with props)
Modified:
incubator/aries/trunk/subsystem/subsystem-itests/pom.xml
incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdmin2Test.java
incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java
incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java
incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties
Modified: incubator/aries/trunk/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/pom.xml?rev=1040681&r1=1040680&r2=1040681&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/pom.xml (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/pom.xml Tue Nov 30 18:34:11 2010
@@ -38,13 +38,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
+ <version>3.7.0.v20100910</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -55,15 +51,23 @@
<dependency>
<groupId>org.apache.aries.subsystem</groupId>
<artifactId>org.apache.aries.subsystem.core</artifactId>
+ <version>${version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.subsystem</groupId>
- <artifactId>org.apache.aries.subsystem.executor</artifactId>
- <scope>test</scope>
- <version>0.3-incubating-SNAPSHOT</version>
+ <artifactId>org.apache.aries.subsystem.scope.api</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.aries.subsystem</groupId>
+ <artifactId>org.apache.aries.subsystem.scope.impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.subsystem</groupId>
+ <artifactId>org.apache.aries.subsystem.executor</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries.testsupport</groupId>
<artifactId>org.apache.aries.testsupport.unit</artifactId>
<scope>test</scope>
@@ -137,6 +141,12 @@
<artifactId>org.apache.aries.application.utils</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.aries.subsystem.example</groupId>
+ <artifactId>org.apache.aries.subsystem.example.helloIsolation</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdmin2Test.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdmin2Test.java?rev=1040681&r1=1040680&r2=1040681&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdmin2Test.java (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdmin2Test.java Tue Nov 30 18:34:11 2010
@@ -20,7 +20,6 @@ package org.apache.aries.subsystem.itest
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -30,7 +29,6 @@ import static org.ops4j.pax.exam.CoreOpt
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URL;
import java.text.SimpleDateFormat;
@@ -39,8 +37,6 @@ import java.util.Currency;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
import org.junit.Before;
@@ -49,8 +45,8 @@ import org.junit.runner.RunWith;
import org.apache.aries.subsystem.Subsystem;
import org.apache.aries.subsystem.SubsystemAdmin;
+import org.apache.aries.subsystem.scope.ScopeAdmin;
import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.JarFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
import org.ops4j.pax.exam.Option;
@@ -60,8 +56,6 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.composite.CompositeAdmin;
@RunWith(JUnit4TestRunner.class)
@@ -70,171 +64,47 @@ public class SubsystemAdmin2Test extends
/* Use @Before not @BeforeClass so as to ensure that these resources
* are created in the paxweb temp directory, and not in the svn tree
*/
- static boolean createdSubsystems = false;
- static boolean createdBundles = false;
- static CompositeAdmin ca = null;
- static SubsystemAdmin sa = null;
-
+ static boolean createdApplications = false;
@Before
- public void createSubsystems() throws Exception {
- if (createdSubsystems) {
+ public static void createApplications() throws Exception {
+ if (createdApplications) {
return;
}
- createSubsystem("subsystem2/META-INF/MANIFEST.MF", "subsystem2.eba");
- createSubsystem("subsystem3/META-INF/MANIFEST.MF", "subsystem3.eba");
+ ZipFixture testEba = ArchiveFixture.newZip();
- createdSubsystems = true;
- }
-
- private Future<Subsystem> installSubsystem(String filename) throws Exception {
-
- // make sure we are using a framework that provides composite admin service
- ca = getOsgiService(CompositeAdmin.class);
- assertNotNull("Unable to get CompositeAdmin Service", ca);
- System.out.println("Able to get composite admin service");
-
- // obtain subsystem admin service
- sa = getOsgiService(SubsystemAdmin.class);
- assertNotNull("Unable to get SubsystemAdmin Service", sa);
- System.out.println("Able to get subsytem admin service");
-
- File f = new File(filename);
- return sa.install(f.toURI().toURL().toExternalForm());
- }
-
- private Future<Subsystem> updateSubsystem(Subsystem subsystem, String filename) throws Exception {
-
- // make sure we are using a framework that provides composite admin service
- ca = getOsgiService(CompositeAdmin.class);
- assertNotNull("Unable to get CompositeAdmin Service", ca);
- System.out.println("Able to get composite admin service");
-
- // obtain subsystem admin service
- sa = getOsgiService(SubsystemAdmin.class);
- assertNotNull("Unable to get SubsystemAdmin Service", sa);
- System.out.println("Able to get subsytem admin service");
-
- File f = new File(filename);
- return sa.update(subsystem, new FileInputStream(f));
- }
-
- private void createSubsystem(String manifest, String filename) throws Exception {
- ZipFixture testEba = ArchiveFixture.newZip();
-
- testEba = testEba.binary("META-INF/MANIFEST.MF",
- SubsystemAdminTest.class.getClassLoader().getResourceAsStream(manifest))
- .end();
- FileOutputStream fout = new FileOutputStream(filename);
- testEba.writeOut(fout);
- fout.close();
+ testEba = testEba.binary("META-INF/MANIFEST.MF",
+ SubsystemAdminTest.class.getClassLoader().getResourceAsStream("subsystem2/META-INF/MANIFEST.MF"))
+ .end();
+ FileOutputStream fout = new FileOutputStream("test.eba");
+ testEba.writeOut(fout);
+ fout.close();
+ createdApplications = true;
}
@Test
- public void testInstall() throws Exception {
-
- Future<Subsystem> subsystemFuture = installSubsystem("subsystem2.eba");
-
-
- // TODO: when based on ScopeAdmin we can remove this sleep. Currently
- // install of the contents is async wrt Subsystem creation so the
- // contents are note installed when we test for them unless we wait.
- Thread.sleep(10000);
-
- // Give the Future up to 10 seconds to do its thing.
- Subsystem subsystem = subsystemFuture.get(10, TimeUnit.SECONDS);
-
- assertNotNull("Subsystem should not be null", subsystem);
+ public void test() throws Exception {
+ // make sure we are using a framework that provides scope admin service
+ ScopeAdmin scopeA = getOsgiService(ScopeAdmin.class);
+ assertNotNull("scope admin should not be null", scopeA);
+ System.out.println("able to get scope admin service");
- assertTrue("Subsystem should have a unique id", subsystem.getSubsystemId() > 0);
- assertTrue(subsystem.getLocation().indexOf("subsystem2.eba") != -1);
- assertEquals("felix-file-install2", subsystem.getSymbolicName());
+ // obtain subsystem admin service
+ SubsystemAdmin sa = getOsgiService(SubsystemAdmin.class);
+ assertNotNull("subsystem admin should not be null", sa);
+ System.out.println("able to get subsytem admin service");
+
+ File f = new File("test.eba");
+ Subsystem subsystem = sa.install(f.toURI().toURL().toExternalForm());
+ assertNotNull("subsystem should not be null", subsystem);
+
+ assertTrue("subsystem should have a unique id", subsystem.getSubsystemId() > 0);
+ assertTrue(subsystem.getLocation().indexOf("test.eba") != -1);
+ assertTrue(subsystem.getSymbolicName().indexOf("felix-file-install2") != -1);
assertEquals("2.0.8", subsystem.getVersion().toString());
- Collection<Bundle> constituents = subsystem.getConstituents();
- assertEquals("check constituents' size", 1, constituents.size());
+ Collection<Bundle> bundles = subsystem.getBundles();
+ assertEquals("check bundles' size", 1, bundles.size());
-
- }
-
- @Test
- public void testUninstall() throws Exception {
-
- // Note, if the subsystem is already installed, then this is a no-op
- Future<Subsystem> subsystemFuture = installSubsystem("subsystem2.eba");
-
- // TODO: when based on ScopeAdmin we can remove this sleep. Currently
- // install of the contents is async wrt Subsystem creation so the
- // contents are note installed when we test for them unless we wait.
- Thread.sleep(10000);
-
- // Give the Future up to 10 seconds to do its thing.
- Subsystem subsystem = subsystemFuture.get(10, TimeUnit.SECONDS);
-
- assertNotNull("Subsystem should not be null", subsystem);
-
- String name = subsystem.getSymbolicName();
- Version version = subsystem.getVersion();
-
- sa.uninstall(subsystem);
-
- assertEquals("Check state is UNINSTALLED", Subsystem.State.UNINSTALLED, subsystem.getState());
-
- subsystem = sa.getSubsystem(name, version);
-
- assertNull("Returned Subsystem should be null", subsystem);
- }
-
- @Test
- public void testUpdate() throws Exception {
-
- // Note, if the subsystem is already installed, then this is a no-op
- Future<Subsystem> installFuture = installSubsystem("subsystem2.eba");
-
- // TODO: when based on ScopeAdmin we can remove this sleep. Currently
- // install of the contents is async wrt Subsystem creation so the
- // contents are note installed when we test for them unless we wait.
- Thread.sleep(10000);
-
- // Give the Future up to 10 seconds to do its thing.
- Subsystem subsystem = installFuture.get(10, TimeUnit.SECONDS);
-
- assertNotNull("Subsystem should not be null", subsystem);
-
- /*
- * Test an update that adds another bundle to the content
- */
-
- // Update the subsystem
- Future<Subsystem> updateFuture = updateSubsystem(subsystem, "subsystem3.eba");
-
- // TODO: when based on ScopeAdmin we can remove this sleep. Currently
- // install of the contents is async wrt Subsystem creation so the
- // contents are note installed when we test for them unless we wait.
- Thread.sleep(10000);
-
- // Give the Future up to 10 seconds to do its thing.
- subsystem = updateFuture.get(10, TimeUnit.SECONDS);
-
- Collection<Bundle> constituents = subsystem.getConstituents();
- assertEquals("Check constituents' size", 2, constituents.size());
-
- /*
- * Test an update that removes a bundle to the content
- */
-
- // Update the subsystem
- updateFuture = updateSubsystem(subsystem, "subsystem2.eba");
-
- // TODO: when based on ScopeAdmin we can remove this sleep. Currently
- // install of the contents is async wrt Subsystem creation so the
- // contents are note installed when we test for them unless we wait.
- Thread.sleep(10000);
-
- // Give the Future up to 10 seconds to do its thing.
- subsystem = updateFuture.get(10, TimeUnit.SECONDS);
-
- constituents = subsystem.getConstituents();
- assertEquals("Check constituents' size", 1, constituents.size());
}
@org.ops4j.pax.exam.junit.Configuration
@@ -253,20 +123,22 @@ public class SubsystemAdmin2Test extends
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
// Bundles
- mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.executor"),
+ mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.scope.api"),
+ mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.scope.impl"),
mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
mavenBundle("org.apache.aries", "org.apache.aries.util"),
mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.api"),
+
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.core"),
//org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties"),
- equinox().version("v43prototype-3.6.0.201003231329")
+ equinox().version("3.7.0.v20100910")
);
options = updateOptions(options);
return options;
Modified: incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java?rev=1040681&r1=1040680&r2=1040681&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java Tue Nov 30 18:34:11 2010
@@ -47,6 +47,7 @@ import org.junit.runner.RunWith;
import org.apache.aries.subsystem.Subsystem;
import org.apache.aries.subsystem.SubsystemAdmin;
+import org.apache.aries.subsystem.scope.ScopeAdmin;
import org.apache.aries.unittest.fixture.ArchiveFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
@@ -57,7 +58,6 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.composite.CompositeAdmin;
@RunWith(JUnit4TestRunner.class)
@@ -90,8 +90,8 @@ public class SubsystemAdminTest extends
//@Test
public void test() throws Exception {
// make sure we are using a framework that provides composite admin service
- CompositeAdmin ca = getOsgiService(CompositeAdmin.class);
- assertNotNull("composite admin should not be null", ca);
+ ScopeAdmin scopeA = getOsgiService(ScopeAdmin.class);
+ assertNotNull("composite admin should not be null", scopeA);
System.out.println("able to get composite admin service");
// obtain subsystem admin service
@@ -102,16 +102,15 @@ public class SubsystemAdminTest extends
File f = new File("test.eba");
// capture initial bundle size
int init = bundleContext.getBundles().length;
- Future<Subsystem> subsystemFuture = sa.install(f.toURI().toURL().toExternalForm());
- Subsystem subsystem = subsystemFuture.get(5, TimeUnit.SECONDS);
+ Subsystem subsystem = sa.install(f.toURI().toURL().toExternalForm());
assertNotNull("subsystem should not be null", subsystem);
assertTrue("subsystem should have a unique id", subsystem.getSubsystemId() > 0);
assertTrue(subsystem.getLocation().indexOf("test.eba") != -1);
assertEquals("felix-file-install", subsystem.getSymbolicName());
assertEquals("2.0.8", subsystem.getVersion().toString());
- Collection<Bundle> constituents = subsystem.getConstituents();
- assertEquals("check constituents' size", 1, constituents.size());
+ Collection<Bundle> bundles = subsystem.getBundles();
+ assertEquals("check constituents' size", 1, bundles.size());
// recapture bundle size
int later = bundleContext.getBundles().length;
// we expect the number would increase 4, one is composite bundle, three are the required resources of the subsystem content
@@ -141,13 +140,15 @@ public class SubsystemAdminTest extends
mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.api"),
+ mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.scope.api"),
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.core"),
+ mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.scope.impl"),
//org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties"),
- equinox().version("v43prototype-3.6.0.201003231329")
+ equinox().version("3.7.0.v20100910")
);
options = updateOptions(options);
return options;
Modified: incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java?rev=1040681&r1=1040680&r2=1040681&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java Tue Nov 30 18:34:11 2010
@@ -25,6 +25,7 @@ public class SsActivator extends Abstrac
new EquinoxPlatformBuilder( bundleContext, "3.5.1" ),
new EquinoxPlatformBuilder( bundleContext, "3.6.0" ),
new EquinoxPlatformBuilder( bundleContext, "V43PROTOTYPE-3.6.0.201003231329" ),
+ new EquinoxPlatformBuilder( bundleContext, "3.7.0.V20100910" ),
new EquinoxPlatformBuilderSnapshot( bundleContext )
};
}
Added: incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml?rev=1040681&view=auto
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml (added)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml Tue Nov 30 18:34:11 2010
@@ -0,0 +1,8 @@
+<platform>
+
+ <name>Equinox 3.7.0</name>
+ <system>mvn:org.eclipse/osgi/3.7.0.v20100910</system>
+
+ <profile name="minimal" default="true"/>
+
+</platform>
\ No newline at end of file
Propchange: incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.7.0.V20100910.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties?rev=1040681&r1=1040680&r2=1040681&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties Tue Nov 30 18:34:11 2010
@@ -64,6 +64,7 @@ platform.equinox.3.5.1=org.ops4j.pax.run
platform.equinox.3.6.0=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
platform.equinox.SNAPSHOT=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
platform.equinox.V43PROTOTYPE-3.6.0.201003231329=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
+platform.equinox.3.7.0.V20100910=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
# Felix
platform.felix.1.0.0=org.ops4j.pax.runner.platform.felix.internal.Activator
platform.felix.1.0.1=org.ops4j.pax.runner.platform.felix.internal.Activator