You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by jw...@apache.org on 2012/02/08 14:54:44 UTC
svn commit: r1241900 [8/8] - in /aries/trunk/subsystem: ./ subsystem-api/
subsystem-api/src/main/java/org/osgi/service/repository/
subsystem-api/src/main/java/org/osgi/service/resolver/
subsystem-api/src/main/java/org/osgi/service/subsystem/ subsystem-...
Modified: aries/trunk/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/pom.xml?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/pom.xml (original)
+++ aries/trunk/subsystem/subsystem-itests/pom.xml Wed Feb 8 13:54:41 2012
@@ -30,24 +30,21 @@
<dependencies>
<dependency>
<groupId>org.eclipse</groupId>
- <artifactId>osgi</artifactId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <scope>test</scope>
<version>3.8.0-SNAPSHOT</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
- <artifactId>services</artifactId>
- <version>3.3.0-v20110523</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.equinox</groupId>
- <artifactId>org.eclipse.equinox.resolver</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.osgi.services</artifactId>
+ <scope>test</scope>
+ <version>3.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.event</artifactId>
- <version>1.2.100</version>
+ <scope>test</scope>
+ <version>3.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.subsystem</groupId>
@@ -86,27 +83,10 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.apache.aries.subsystem</groupId>
- <artifactId>org.apache.aries.subsystem.executor</artifactId>
- <version>0.1-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <!--
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- -->
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.apache.aries.testsupport</groupId>
<artifactId>org.apache.aries.testsupport.unit</artifactId>
<scope>test</scope>
- <version>0.3</version>
+ <version>0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
@@ -142,7 +122,7 @@
<groupId>org.apache.aries</groupId>
<artifactId>org.apache.aries.util</artifactId>
<scope>test</scope>
- <version>0.4-SNAPSHOT</version>
+ <version>0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
@@ -157,6 +137,16 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<scope>test</scope>
@@ -172,6 +162,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit-extender-impl</artifactId>
<scope>test</scope>
@@ -199,30 +194,13 @@
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
</exclusion>
- <!--
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</exclusion>
- -->
</exclusions>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-service</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-mvn</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.service.obr</artifactId>
<scope>test</scope>
@@ -236,12 +214,10 @@
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
</exclusion>
- <!--
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</exclusion>
- -->
</exclusions>
</dependency>
<dependency>
@@ -278,24 +254,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.aries.subsystem</groupId>
- <artifactId>org.apache.aries.subsystem.example.helloIsolation</artifactId>
- <version>0.1-SNAPSHOT</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <!--
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- -->
- </exclusions>
- </dependency>
</dependencies>
<build>
<plugins>
@@ -395,6 +353,24 @@
</configuration>
<phase>process-test-classes</phase>
</execution>
+ <execution>
+ <id>tb3-feature3</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <archive>
+ <manifestFile>src/test/bundles/tb3/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ <classesDirectory>${project.build.directory}/test-classes</classesDirectory>
+ <includes>
+ <include>org/apache/aries/subsystem/itests/tb3/**</include>
+ </includes>
+ <outputDirectory>src/test/resources/feature3</outputDirectory>
+ <finalName>tb3</finalName>
+ </configuration>
+ <phase>process-test-classes</phase>
+ </execution>
</executions>
</plugin>
<plugin>
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java Wed Feb 8 13:54:41 2012
@@ -21,18 +21,24 @@ package org.apache.aries.subsystem.itest
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.Collection;
+import junit.framework.AssertionFailedError;
+
+import org.apache.aries.subsystem.core.ResourceHelper;
import org.apache.aries.subsystem.itests.util.Utils;
import org.apache.aries.unittest.fixture.ArchiveFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
+import org.osgi.framework.resource.Resource;
import org.osgi.framework.resource.ResourceConstants;
import org.osgi.service.subsystem.Subsystem;
-import org.osgi.service.subsystem.SubsystemConstants;
@RunWith(JUnit4TestRunner.class)
public class FeatureTest extends SubsystemTest {
@@ -68,6 +74,7 @@ public class FeatureTest extends Subsyst
}
createApplication("feature2", new String[]{"tb2.jar", "tb3.jar"});
createApplication("feature1", new String[]{"tb1.jar", "feature2.ssa", "tb3.jar"});
+ createApplication("feature3", new String[]{"tb3.jar"});
createdApplications = true;
}
@@ -82,22 +89,24 @@ public class FeatureTest extends Subsyst
assertConstituents(5, feature1);
assertChildren(1, feature1);
feature2 = feature1.getChildren().iterator().next();
- assertEvent(feature2, Subsystem.State.INSTALLING, SubsystemConstants.EVENT_TYPE.INSTALLING, 5000);
- assertEvent(feature2, Subsystem.State.INSTALLED, SubsystemConstants.EVENT_TYPE.INSTALLED, 5000);
+// assertEvent(feature2, Subsystem.State.INSTALLING, 5000);
+// assertEvent(feature2, Subsystem.State.INSTALLED, 5000);
assertSymbolicName("org.apache.aries.subsystem.feature2", feature2);
assertVersion("1.0.0", feature2);
+ assertConstituent(feature2, "org.apache.aries.subsystem.itests.tb2", Version.parseVersion("2.0.0"), ResourceConstants.IDENTITY_TYPE_BUNDLE);
+ assertConstituent(feature2, "org.apache.aries.subsystem.itests.tb3", Version.parseVersion("1.0.0"), ResourceConstants.IDENTITY_TYPE_BUNDLE);
assertConstituents(2, feature2);
assertChildren(0, feature2);
// TODO Test internal events for installation.
startSubsystem(feature1);
- assertEvent(feature2, Subsystem.State.RESOLVING, SubsystemConstants.EVENT_TYPE.RESOLVING, 5000);
- assertEvent(feature2, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.RESOLVED, 5000);
- assertEvent(feature2, Subsystem.State.STARTING, SubsystemConstants.EVENT_TYPE.STARTING, 5000);
- assertEvent(feature2, Subsystem.State.ACTIVE, SubsystemConstants.EVENT_TYPE.STARTED, 5000);
+// assertEvent(feature2, Subsystem.State.RESOLVING, 5000);
+// assertEvent(feature2, Subsystem.State.RESOLVED, 5000);
+// assertEvent(feature2, Subsystem.State.STARTING, 5000);
+// assertEvent(feature2, Subsystem.State.ACTIVE, 5000);
// TODO Test internal events for starting.
stopSubsystem(feature1);
- assertEvent(feature2, Subsystem.State.STOPPING, SubsystemConstants.EVENT_TYPE.STOPPING, 5000);
- assertEvent(feature2, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.STOPPED, 5000);
+// assertEvent(feature2, Subsystem.State.STOPPING, 5000);
+// assertEvent(feature2, Subsystem.State.RESOLVED, 5000);
// TODO Test internal events for stopping.
}
catch (AssertionError e) {
@@ -108,8 +117,8 @@ public class FeatureTest extends Subsyst
try {
uninstallSubsystem(feature1);
if (feature2 != null) {
- assertEvent(feature2, Subsystem.State.UNINSTALLING, SubsystemConstants.EVENT_TYPE.UNINSTALLING, 5000);
- assertEvent(feature2, Subsystem.State.UNINSTALLED, SubsystemConstants.EVENT_TYPE.UNINSTALLED, 5000);
+// assertEvent(feature2, Subsystem.State.UNINSTALLING, 5000);
+// assertEvent(feature2, Subsystem.State.UNINSTALLED, 5000);
// TODO Test internal events for uninstalling.
assertNotChild(feature1, feature2);
}
@@ -123,7 +132,46 @@ public class FeatureTest extends Subsyst
}
@Test
- public void testSharedFeatureResource() throws Exception {
+ public void testPersistence() throws Exception {
+ Subsystem feature3Before = installSubsystemFromFile("feature3.ssa");
+ Subsystem feature3After = null;
+ AssertionError error = null;
+ try {
+ assertFeature3(feature3Before);
+ // Uninstall then reinstall the subsystem for a more robust test of the subsystem ID persistence.
+ uninstallSubsystem(feature3Before);
+ feature3Before = installSubsystemFromFile("feature3.ssa");
+ assertLastId(2);
+ assertFeature3(feature3Before);
+ Bundle bundle = getSubsystemCoreBundle();
+ bundle.stop();
+ bundle.start();
+ Subsystem root = getRootSubsystem();
+ assertChildren(1, root);
+ feature3After = root.getChildren().iterator().next();
+ assertLastId(2);
+ assertFeature3(feature3After);
+ assertEquals(feature3Before, feature3After);
+ }
+ catch (AssertionError e) {
+ error = e;
+ throw e;
+ }
+ finally {
+ try {
+ if (feature3After != null)
+ uninstallSubsystem(feature3After);
+ }
+ catch (AssertionError e) {
+ if (error == null)
+ throw e;
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Test
+ public void testSharedContent() throws Exception {
Subsystem feature1 = installSubsystemFromFile("feature1.ssa");
AssertionError error = null;
try {
@@ -152,4 +200,93 @@ public class FeatureTest extends Subsyst
}
}
}
+
+ private void assertContainsConstituent(Collection<Resource> constituents, Resource constituent) {
+ for (Resource resource : constituents) {
+ if (ResourceHelper.areEqual(constituent, resource))
+ return;
+ }
+ Assert.fail("Constituent not found");
+ }
+
+ private void assertContainsChild(Collection<Subsystem> children, Subsystem child) {
+ for (Subsystem subsystem : children) {
+ try {
+ assertEquals(child, subsystem);
+ return;
+ }
+ catch (AssertionError e) {}
+ }
+ Assert.fail("Child not found");
+ }
+
+ private void assertEquals(Subsystem subsystem1, Subsystem subsystem2) {
+ assertChildrenEqual(subsystem1.getChildren(), subsystem2.getChildren());
+ assertConstituentsEqual(subsystem1.getConstituents(), subsystem2.getConstituents());
+ Assert.assertEquals("Headers were not equal", subsystem1.getSubsystemHeaders(null), subsystem2.getSubsystemHeaders(null));
+ Assert.assertEquals("Locations were not equal", subsystem1.getLocation(), subsystem2.getLocation());
+ assertParentsEqual(subsystem1.getParents(), subsystem2.getParents());
+ Assert.assertEquals("States were not equal", subsystem1.getState(), subsystem2.getState());
+ Assert.assertEquals("IDs were not equal", subsystem1.getSubsystemId(), subsystem2.getSubsystemId());
+ Assert.assertEquals("Symbolic names were not equal", subsystem1.getSymbolicName(), subsystem2.getSymbolicName());
+ Assert.assertEquals("Versions were not equal", subsystem1.getVersion(), subsystem2.getVersion());
+ }
+
+ private void assertParentsEqual(Subsystem parent1, Subsystem parent2) {
+ if (parent1 == null || parent2 == null) {
+ Assert.assertTrue("Parents were not equal", parent1 == null && parent2 == null);
+ return;
+ }
+ assertConstituentsEqual(parent1.getConstituents(), parent2.getConstituents());
+ Assert.assertEquals("Headers were not equal", parent1.getSubsystemHeaders(null), parent2.getSubsystemHeaders(null));
+ Assert.assertEquals("Locations were not equal", parent1.getLocation(), parent2.getLocation());
+ assertParentsEqual(parent1.getParents(), parent2.getParents());
+ Assert.assertEquals("States were not equal", parent1.getState(), parent2.getState());
+ Assert.assertEquals("IDs were not equal", parent1.getSubsystemId(), parent2.getSubsystemId());
+ Assert.assertEquals("Symbolic names were not equal", parent1.getSymbolicName(), parent2.getSymbolicName());
+ Assert.assertEquals("Versions were not equal", parent1.getVersion(), parent2.getVersion());
+ }
+
+ private void assertParentsEqual(Subsystem parent1, Collection<Subsystem> parents2) {
+ for (Subsystem parent2 : parents2) {
+ try {
+ assertParentsEqual(parent1, parent2);
+ return;
+ }
+ catch (AssertionFailedError e) {}
+ }
+ Assert.fail("Parent not found: " + parent1.getSymbolicName());
+ }
+
+ private void assertParentsEqual(Collection<Subsystem> parents1, Collection<Subsystem> parents2) {
+ Assert.assertEquals("Size not equal", parents1.size(), parents2.size());
+ for (Subsystem parent1 : parents1) {
+ assertParentsEqual(parent1, parents2);
+ }
+ }
+
+ private void assertConstituentsEqual(Collection<Resource> resources1, Collection<Resource> resources2) {
+ Assert.assertEquals("Constituent size does not match", resources1.size(), resources2.size());
+ for (Resource resource : resources1) {
+ assertContainsConstituent(resources2, resource);
+ }
+ }
+
+ private void assertChildrenEqual(Collection<Subsystem> subsystems1, Collection<Subsystem> subsystems2) {
+ Assert.assertEquals("Children size does not match", subsystems1.size(), subsystems2.size());
+ for (Subsystem subsystem : subsystems1) {
+ assertContainsChild(subsystems2, subsystem);
+ }
+ }
+
+ private void assertFeature3(Subsystem subsystem) {
+ assertChildren(0, subsystem);
+ assertConstituents(1, subsystem);
+ assertConstituent(subsystem, "org.apache.aries.subsystem.itests.tb3", Version.parseVersion("1.0.0"), ResourceConstants.IDENTITY_TYPE_BUNDLE);
+// subsystem.getHeaders();
+// subsystem.getHeaders("");
+// subsystem.getState();
+ assertSymbolicName("org.apache.aries.subsystem.feature3", subsystem);
+ assertVersion("0.0.0", subsystem);
+ }
}
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=1241900&r1=1241899&r2=1241900&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 Wed Feb 8 13:54:41 2012
@@ -65,19 +65,14 @@ public class InstallTest extends Subsyst
if (createdApplications) {
return;
}
- createApplication("feature2", new String[]{"tb2.jar", "tb3.jar"});
- createApplication("feature1", new String[]{"tb1.jar", "feature2.ssa", "tb3.jar"});
+ createApplication("feature3", new String[]{"tb3.jar"});
createdApplications = true;
}
@Test
public void testReturnExistingSubsystemWithSameLocation() throws Exception {
- Subsystem subsystem1 = installSubsystemFromFile("feature1.ssa");
+ Subsystem subsystem1 = installSubsystemFromFile("feature3.ssa");
try {
- // Need to wait for the nested feature within feature1 to install. Perhaps use a simpler subsystem for this test?
- // TODO This needs to be better implemented and put into a utility method on the superclass.
- while (!subsystem1.getChildren().iterator().next().getState().equals(Subsystem.State.INSTALLED))
- Thread.sleep(100);
Subsystem subsystem2 = subsystem1.install(subsystem1.getLocation());
assertSame(subsystem1, subsystem2);
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/IntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/IntegrationTest.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/IntegrationTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/IntegrationTest.java Wed Feb 8 13:54:41 2012
@@ -27,8 +27,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Properties;
import org.junit.After;
@@ -50,16 +50,16 @@ public abstract class IntegrationTest {
protected static boolean createdApplications = false;
- private List<ServiceTracker> srs;
+ private Map<String, ServiceTracker> srs;
@Before
public void setUp() {
- srs = new ArrayList<ServiceTracker>();
+ srs = new HashMap<String, ServiceTracker>();
}
@After
public void tearDown() {
- for (ServiceTracker st : srs) {
+ for (ServiceTracker st : srs.values()) {
if (st != null) {
st.close();
}
@@ -78,31 +78,34 @@ public abstract class IntegrationTest {
}
protected <T> T getOsgiService(BundleContext bc, Class<T> type, String filter, long timeout) {
- ServiceTracker tracker = null;
- try {
- String flt;
- if (filter != null) {
- if (filter.startsWith("(")) {
- flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
- } else {
- flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
- }
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ filter = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
} else {
- flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ filter = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
+ }
+ } else {
+ filter = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ ServiceTracker tracker = srs.get(filter);
+ if (tracker == null) {
+ try {
+ Filter osgiFilter = FrameworkUtil.createFilter(filter);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter, null);
+ tracker.open();
+ // add tracker to the list of trackers we close at tear down
+ srs.put(filter, tracker);
+ }
+ catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
}
- Filter osgiFilter = FrameworkUtil.createFilter(flt);
- tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter, null);
- tracker.open();
-
- // add tracker to the list of trackers we close at tear down
- srs.add(tracker);
- Object svc = type.cast(tracker.waitForService(timeout));
+ }
+ try {
+ Object svc = tracker.waitForService(timeout);
if (svc == null) {
- throw new RuntimeException("Gave up waiting for service " + flt);
+ throw new RuntimeException("Gave up waiting for service " + filter);
}
return type.cast(svc);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException("Invalid filter", e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java Wed Feb 8 13:54:41 2012
@@ -16,21 +16,20 @@ package org.apache.aries.subsystem.itest
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.io.File;
import java.io.InputStream;
+import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Dictionary;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -44,21 +43,21 @@ import org.apache.felix.bundlerepository
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
import org.osgi.framework.resource.Resource;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.event.EventHandler;
import org.osgi.service.repository.Repository;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.Subsystem.State;
import org.osgi.service.subsystem.SubsystemConstants;
-import org.osgi.service.subsystem.SubsystemConstants.EVENT_TYPE;
public abstract class SubsystemTest extends IntegrationTest {
- protected static class SubsystemEventHandler implements EventHandler {
- private final Map<Long, List<Event>> subsystemIdToEvents = new HashMap<Long, List<Event>>();
+ protected static class SubsystemEventHandler implements ServiceListener {
+ private final Map<Long, List<ServiceEvent>> subsystemIdToEvents = new HashMap<Long, List<ServiceEvent>>();
public void clear() {
synchronized (subsystemIdToEvents) {
@@ -66,31 +65,16 @@ public abstract class SubsystemTest exte
}
}
- public void handleEvent(Event event) {
- Long subsystemId = (Long)event.getProperty(SubsystemConstants.EVENT_SUBSYSTEM_ID);
- synchronized (subsystemIdToEvents) {
- List <Event> events = subsystemIdToEvents.get(subsystemId);
- if (events == null) {
- events = new ArrayList<Event>();
- subsystemIdToEvents.put(subsystemId, events);
- }
- synchronized (events) {
- events.add(event);
- events.notify();
- }
- }
- }
-
- public Event poll(long subsystemId) throws InterruptedException {
+ public ServiceEvent poll(long subsystemId) throws InterruptedException {
return poll(subsystemId, 0);
}
- public Event poll(long subsystemId, long timeout) throws InterruptedException {
- List<Event> events;
+ public ServiceEvent poll(long subsystemId, long timeout) throws InterruptedException {
+ List<ServiceEvent> events;
synchronized (subsystemIdToEvents) {
events = subsystemIdToEvents.get(subsystemId);
if (events == null) {
- events = new ArrayList<Event>();
+ events = new ArrayList<ServiceEvent>();
subsystemIdToEvents.put(subsystemId, events);
}
}
@@ -105,6 +89,21 @@ public abstract class SubsystemTest exte
}
}
+ public void serviceChanged(ServiceEvent event) {
+ Long subsystemId = (Long)event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_ID_PROPERTY);
+ synchronized (subsystemIdToEvents) {
+ List<ServiceEvent> events = subsystemIdToEvents.get(subsystemId);
+ if (events == null) {
+ events = new ArrayList<ServiceEvent>();
+ subsystemIdToEvents.put(subsystemId, events);
+ }
+ synchronized (events) {
+ events.add(event);
+ events.notify();
+ }
+ }
+ }
+
public int size() {
synchronized (subsystemIdToEvents) {
return subsystemIdToEvents.size();
@@ -115,31 +114,29 @@ public abstract class SubsystemTest exte
@org.ops4j.pax.exam.junit.Configuration
public static Option[] configuration() {
Option[] options = options(
+ // this is how you set the default log level when using pax
+ // logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+ systemProperty("org.osgi.framework.bsnversion").value("multiple"),
// Log
mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
// Felix Config Admin
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+// mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
// Felix mvn url handler
mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
- // this is how you set the default log level when using pax
- // logging (logProfile)
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
- systemProperty("org.osgi.framework.bsnversion").value("multiple"),
// Bundles
- mavenBundle("org.eclipse.osgi", "services").version("3.3.0-v20110523"),
- mavenBundle("org.eclipse.equinox", "region").version("1.0.0.v20110518"),
- mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.resolver").version("1.0.0-SNAPSHOT"),
+ mavenBundle("org.eclipse.osgi", "org.eclipse.osgi.services").version("3.8.0-SNAPSHOT"),
+ mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.region").version("3.8.0-SNAPSHOT"),
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", "org.apache.aries.util").version("0.5-SNAPSHOT"),
mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
- mavenBundle("org.eclipse.equinox", "coordinator"),
- mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.event"),
+ mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.coordinator").version("3.8.0-SNAPSHOT"),
+ mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.event").version("3.8.0-SNAPSHOT"),
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.api"),
mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.core"),
- mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.executor"),
// 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("3.8.0-SNAPSHOT"));
@@ -148,31 +145,27 @@ public abstract class SubsystemTest exte
}
protected final SubsystemEventHandler subsystemEvents = new SubsystemEventHandler();
- protected final SubsystemEventHandler subsystemInternalEvents = new SubsystemEventHandler();
-
- protected Subsystem rootSubsystem;
- private ServiceRegistration<Repository> repositoryReg;
- private ServiceRegistration<EventHandler> subsystemEventsReg;
- private ServiceRegistration<EventHandler> subsystemInternalEventsReg;
+ private Collection<ServiceRegistration<?>> serviceRegistrations = new ArrayList<ServiceRegistration<?>>();
public void setUp() {
super.setUp();
new RepositoryGenerator(bundleContext).generateOBR();
- repositoryReg = bundleContext.registerService(Repository.class, new RepositoryAdminRepository(getOsgiService(RepositoryAdmin.class)), null);
- Dictionary<String, Object> d = new Hashtable<String, Object>();
- d.put(EventConstants.EVENT_TOPIC, new String[]{"org/osgi/service/Subsystem/*"});
- subsystemEventsReg = bundleContext.registerService(EventHandler.class, subsystemEvents, d);
- d.put(EventConstants.EVENT_TOPIC, new String[]{"org/osgi/service/SubsystemInternals/*"});
- subsystemInternalEventsReg = bundleContext.registerService(EventHandler.class, subsystemInternalEvents, d);
- rootSubsystem = getOsgiService(Subsystem.class);
- assertSubsystemNotNull(rootSubsystem);
+ serviceRegistrations.add(bundleContext.registerService(Repository.class, new RepositoryAdminRepository(getOsgiService(RepositoryAdmin.class)), null));
+ try {
+ bundleContext.addServiceListener(subsystemEvents, '(' + Constants.OBJECTCLASS + '=' + Subsystem.class + ')');
+ }
+ catch (InvalidSyntaxException e) {
+ fail("Invalid filter: " + e.getMessage());
+ }
+ assertSubsystemNotNull(getRootSubsystem());
}
public void tearDown() {
- Utils.unregisterQuietly(subsystemInternalEventsReg);
- Utils.unregisterQuietly(subsystemEventsReg);
- Utils.unregisterQuietly(repositoryReg);
+ bundleContext.removeServiceListener(subsystemEvents);
+ for (ServiceRegistration<?> registration : serviceRegistrations)
+ Utils.unregisterQuietly(registration);
+ serviceRegistrations.clear();
super.tearDown();
}
@@ -221,40 +214,22 @@ public abstract class SubsystemTest exte
assertFalse("Subsystem data file exists", file.exists());
}
- protected void assertEvent(Subsystem subsystem, Subsystem.State state, SubsystemConstants.EVENT_TYPE type) throws InterruptedException {
- assertEvent(subsystem, state, type, 0);
- }
-
- protected void assertEvent(Subsystem subsystem, Subsystem.State state, SubsystemConstants.EVENT_TYPE type, long timeout) throws InterruptedException {
- assertEvent(subsystem, state, type, subsystemEvents.poll(subsystem.getSubsystemId(), timeout));
- }
-
- protected void assertEvent(Subsystem subsystem, Subsystem.State state, SubsystemConstants.EVENT_TYPE type, Event event) {
- assertEvent(subsystem, state, type, event, null);
- }
-
- protected void assertEvent(Subsystem subsystem, Subsystem.State state, SubsystemConstants.EVENT_TYPE type, Event event, Throwable throwable) {
- assertNotNull("The event was null", event);
- assertTrue("Wrong topic: " + event.getTopic(), event.getTopic().endsWith(type.name()));
- assertEquals("Wrong ID", subsystem.getSubsystemId(), event.getProperty(SubsystemConstants.EVENT_SUBSYSTEM_ID));
- assertEquals("Wrong location", subsystem.getLocation(), event.getProperty(SubsystemConstants.EVENT_SUBSYSTEM_LOCATION));
- if (!EVENT_TYPE.INSTALLING.equals(type)) {
- assertEquals("Wrong symbolic name", subsystem.getSymbolicName(), event.getProperty(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME));
- assertEquals("Wrong version", String.valueOf(subsystem.getVersion()), event.getProperty(SubsystemConstants.SUBSYSTEM_VERSION));
- }
- assertEquals("Wrong state", String.valueOf(state), event.getProperty("subsystem.state"));
- assertNotNull("Missing timestamp", event.getProperty(EventConstants.TIMESTAMP));
- if (throwable == null) {
- assertNull("Exception not expected", event.getProperty(EventConstants.EXCEPTION));
- assertNull("Exception class not expected", event.getProperty(EventConstants.EXCEPTION_CLASS));
- assertNull("Exception message not expected", event.getProperty(EventConstants.EXCEPTION_MESSAGE));
- }
- else {
- assertTrue("Wrong exception", event.getProperty(EventConstants.EXCEPTION) instanceof Throwable);
- assertEquals("Wrong exception class", throwable.getClass().getName(), event.getProperty(EventConstants.EXCEPTION_CLASS));
- assertTrue("Wrong message", ((String)event.getProperty(EventConstants.EXCEPTION_MESSAGE)).indexOf(throwable.getMessage()) != -1);
- }
- }
+// protected void assertEvent(Subsystem subsystem, Subsystem.State state) throws InterruptedException {
+// assertEvent(subsystem, state, 0);
+// }
+//
+// protected void assertEvent(Subsystem subsystem, Subsystem.State state, long timeout) throws InterruptedException {
+// assertEvent(subsystem, state, subsystemEvents.poll(subsystem.getSubsystemId(), timeout));
+// }
+//
+// protected void assertEvent(Subsystem subsystem, Subsystem.State state, ServiceEvent event) {
+// // TODO Could accept a ServiceRegistration as an argument and verify it against the one in the event.
+// assertEquals("Wrong ID", subsystem.getSubsystemId(), event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_ID_PROPERTY));
+// assertEquals("Wrong symbolic name", subsystem.getSymbolicName(), event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME_PROPERTY));
+// assertEquals("Wrong version", String.valueOf(subsystem.getVersion()), event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_VERSION_PROPERTY));
+// assertEquals("Wrong type", subsystem.getType(), event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_TYPE_PROPERTY));
+// assertEquals("Wrong state", String.valueOf(state), event.getServiceReference().getProperty(SubsystemConstants.SUBSYSTEM_STATE_PROPERTY));
+// }
protected void assertId(Subsystem subsystem) {
assertId(subsystem.getSubsystemId());
@@ -264,6 +239,13 @@ public abstract class SubsystemTest exte
assertTrue("Subsystem ID was not a positive integer: " + id, id > 0);
}
+ protected void assertLastId(long id) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
+ Subsystem root = getRootSubsystem();
+ Field lastId = root.getClass().getDeclaredField("lastId");
+ lastId.setAccessible(true);
+ assertEquals("Incorrect value for lastId", id, lastId.getLong(root));
+ }
+
protected void assertLocation(String expected, String actual) {
assertTrue("Wrong location: " + actual, actual.indexOf(expected) != -1);
}
@@ -277,7 +259,12 @@ public abstract class SubsystemTest exte
}
protected void assertParent(Subsystem expected, Subsystem subsystem) {
- assertEquals("Wrong parent", expected, subsystem.getParent());
+ for (Subsystem parent : subsystem.getParents()) {
+ if (parent.equals(expected))
+ return;
+
+ }
+ fail("Parent did not exist: " + expected.getSymbolicName());
}
protected void assertState(State expected, State actual) {
@@ -302,24 +289,24 @@ public abstract class SubsystemTest exte
Subsystem subsystem = rootSubsystem.install(file.toURI().toURL().toExternalForm());
assertNotNull("The subsystem was null", subsystem);
assertState(EnumSet.of(State.INSTALLING, State.INSTALLED), subsystem.getState());
- assertEvent(subsystem, Subsystem.State.INSTALLING, SubsystemConstants.EVENT_TYPE.INSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.INSTALLED, SubsystemConstants.EVENT_TYPE.INSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.INSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.INSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertChild(rootSubsystem, subsystem);
subsystem.start();
assertState(EnumSet.of(State.RESOLVING, State.RESOLVED, State.STARTING, State.ACTIVE), subsystem.getState());
- assertEvent(subsystem, Subsystem.State.RESOLVING, SubsystemConstants.EVENT_TYPE.RESOLVING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.STARTING, SubsystemConstants.EVENT_TYPE.STARTING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.ACTIVE, SubsystemConstants.EVENT_TYPE.STARTED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.STARTING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.ACTIVE, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
subsystem.stop();
assertState(EnumSet.of(State.STOPPING, State.RESOLVED), subsystem.getState());
- assertEvent(subsystem, Subsystem.State.STOPPING, SubsystemConstants.EVENT_TYPE.STOPPING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.STOPPED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.STOPPING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
// TODO Add update.
subsystem.uninstall();
assertState(EnumSet.of(State.UNINSTALLING, State.UNINSTALLED), subsystem.getState());
- assertEvent(subsystem, Subsystem.State.UNINSTALLING, SubsystemConstants.EVENT_TYPE.UNINSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.UNINSTALLED, SubsystemConstants.EVENT_TYPE.UNINSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.UNINSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.UNINSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertNotChild(rootSubsystem, subsystem);
return subsystem;
}
@@ -344,6 +331,10 @@ public abstract class SubsystemTest exte
assertEquals("Wrong version", expected, actual);
}
+ protected Subsystem getRootSubsystem() {
+ return getOsgiService(Subsystem.class);
+ }
+
protected Bundle getSubsystemCoreBundle() {
return findBundleBySymbolicName("org.apache.aries.subsystem.core");
}
@@ -361,15 +352,15 @@ public abstract class SubsystemTest exte
}
protected Subsystem installSubsystemFromFile(File file) throws Exception {
- return installSubsystem(rootSubsystem, file.toURI().toURL().toExternalForm());
+ return installSubsystem(getRootSubsystem(), file.toURI().toURL().toExternalForm());
}
protected Subsystem installSubsystem(String location) throws Exception {
- return installSubsystem(rootSubsystem, location);
+ return installSubsystem(getRootSubsystem(), location);
}
protected Subsystem installSubsystem(String location, InputStream content) throws Exception {
- return installSubsystem(rootSubsystem, location, content);
+ return installSubsystem(getRootSubsystem(), location, content);
}
protected Subsystem installSubsystem(Subsystem parent, String location) throws Exception {
@@ -378,10 +369,10 @@ public abstract class SubsystemTest exte
protected Subsystem installSubsystem(Subsystem parent, String location, InputStream content) throws Exception {
subsystemEvents.clear();
- Subsystem subsystem = rootSubsystem.install(location, content);
+ Subsystem subsystem = getRootSubsystem().install(location, content);
assertSubsystemNotNull(subsystem);
- assertEvent(subsystem, Subsystem.State.INSTALLING, SubsystemConstants.EVENT_TYPE.INSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.INSTALLED, SubsystemConstants.EVENT_TYPE.INSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.INSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.INSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertChild(parent, subsystem);
assertLocation(location, subsystem);
assertParent(parent, subsystem);
@@ -398,10 +389,10 @@ public abstract class SubsystemTest exte
subsystemEvents.clear();
subsystem.start();
assertState(EnumSet.of(State.RESOLVING, State.RESOLVED, State.STARTING, State.ACTIVE), subsystem);
- assertEvent(subsystem, Subsystem.State.RESOLVING, SubsystemConstants.EVENT_TYPE.RESOLVING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.STARTING, SubsystemConstants.EVENT_TYPE.STARTING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.ACTIVE, SubsystemConstants.EVENT_TYPE.STARTED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.STARTING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.ACTIVE, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertState(State.ACTIVE, subsystem);
}
@@ -410,22 +401,23 @@ public abstract class SubsystemTest exte
subsystemEvents.clear();
subsystem.stop();
assertState(EnumSet.of(State.STOPPING, State.RESOLVED), subsystem);
- assertEvent(subsystem, Subsystem.State.STOPPING, SubsystemConstants.EVENT_TYPE.STOPPING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.RESOLVED, SubsystemConstants.EVENT_TYPE.STOPPED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.STOPPING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.RESOLVED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertState(State.RESOLVED, subsystem);
}
protected void uninstallSubsystem(Subsystem subsystem) throws Exception {
assertState(EnumSet.of(State.INSTALLED, State.RESOLVED), subsystem);
subsystemEvents.clear();
- Subsystem parent = subsystem.getParent();
+ Collection<Subsystem> parents = subsystem.getParents();
subsystem.uninstall();
assertState(EnumSet.of(State.UNINSTALLED, State.UNINSTALLING), subsystem);
- assertEvent(subsystem, Subsystem.State.UNINSTALLING, SubsystemConstants.EVENT_TYPE.UNINSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
- assertEvent(subsystem, Subsystem.State.UNINSTALLED, SubsystemConstants.EVENT_TYPE.UNINSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.UNINSTALLING, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
+// assertEvent(subsystem, Subsystem.State.UNINSTALLED, subsystemEvents.poll(subsystem.getSubsystemId(), 5000));
assertState(State.UNINSTALLED, subsystem);
assertConstituents(0, subsystem);
- assertNotChild(parent, subsystem);
+ for (Subsystem parent : parents)
+ assertNotChild(parent, subsystem);
assertNotDirectory(subsystem);
}
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java Wed Feb 8 13:54:41 2012
@@ -44,7 +44,7 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
import org.osgi.framework.resource.Resource;
-import org.osgi.service.subsystem.SubsystemConstants;
+import org.osgi.framework.resource.ResourceConstants;
import org.osgi.service.subsystem.SubsystemException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -192,7 +192,7 @@ public class RepositoryGenerator {
Map props = res.getProperties();
- Object type = props.get(SubsystemConstants.IDENTITY_TYPE_ATTRIBUTE);
+ Object type = props.get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
return new FelixResourceAdapter(res);
}
@@ -232,7 +232,7 @@ public class RepositoryGenerator {
Map props = resource.getProperties();
- Object type = props.get(SubsystemConstants.IDENTITY_TYPE_ATTRIBUTE);
+ Object type = props.get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
return new FelixResourceAdapter(resource);
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.8.0-SNAPSHOT.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.8.0-SNAPSHOT.xml?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.8.0-SNAPSHOT.xml (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.8.0-SNAPSHOT.xml Wed Feb 8 13:54:41 2012
@@ -1,7 +1,7 @@
<platform>
<name>Equinox 3.8.0</name>
- <system>mvn:org.eclipse/osgi/3.8.0-SNAPSHOT</system>
+ <system>mvn:org.eclipse/org.eclipse.osgi/3.8.0-SNAPSHOT</system>
<profile name="minimal" default="true"/>
Added: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF?rev=1241900&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF (added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF Wed Feb 8 13:54:41 2012
@@ -0,0 +1,3 @@
+Subsystem-SymbolicName: org.apache.aries.subsystem.feature3
+Subsystem-Type: osgi.feature
+Subsystem-Content: org.apache.aries.subsystem.itests.tb3
\ No newline at end of file
Added: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/tb3.jar
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/tb3.jar?rev=1241900&view=auto
==============================================================================
Binary file - no diff available.
Propchange: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/tb3.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream