aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-03-23 16:42:35 (EDT)
committerGlyn Normington2011-03-23 16:42:35 (EDT)
commitd9203b6ce1b49bf37b4881023183bde9ef01b8a2 (patch)
tree897880a19730e764c12d9979b4c13b27ee3310fc
parentcdfb3b9a659adce3fbcce72a387b4c049b09b943 (diff)
downloadorg.eclipse.virgo.kernel-d9203b6ce1b49bf37b4881023183bde9ef01b8a2.zip
org.eclipse.virgo.kernel-d9203b6ce1b49bf37b4881023183bde9ef01b8a2.tar.gz
org.eclipse.virgo.kernel-d9203b6ce1b49bf37b4881023183bde9ef01b8a2.tar.bz2
Stop registering the digraph twice.region-digraph-ready-for-move-to-equinox
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java7
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java15
2 files changed, 9 insertions, 13 deletions
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
index 82a896d..4b67d19 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
@@ -65,7 +65,7 @@ final class RegionManager {
RegionDigraph regionDigraph = new StandardRegionDigraph(this.bundleContext, this.threadLocal);
registerDigraphMbean(regionDigraph);
createKernelRegion(regionDigraph);
- registerRegionDigraph(regionDigraph, this.bundleContext);
+ registerRegionDigraph(regionDigraph);
return regionDigraph;
}
@@ -103,11 +103,8 @@ final class RegionManager {
registerServiceEventHook(new RegionServiceEventHook(serviceFindHook));
}
- private void registerRegionDigraph(RegionDigraph regionDigraph, BundleContext userRegionBundleContext) {
+ private void registerRegionDigraph(RegionDigraph regionDigraph) {
this.tracker.track(this.bundleContext.registerService(RegionDigraph.class, regionDigraph, null));
- if (userRegionBundleContext != null) {
- this.tracker.track(userRegionBundleContext.registerService(RegionDigraph.class, regionDigraph, null));
- }
}
private void registerServiceFindHook(org.osgi.framework.hooks.service.FindHook serviceFindHook) {
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
index 79bb0ae..955b493 100644
--- a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
@@ -26,21 +26,20 @@ public class RegionManagerTests {
@Test
public void testStartAndStop() throws Exception {
StubBundleContext bundleContext = new StubBundleContext();
-
+
StubBundle stubUserRegionFactoryBundle = new StubBundle("org.eclipse.virgo.kernel.userregionfactory", new Version("2.2.0"));
bundleContext.addInstalledBundle(stubUserRegionFactoryBundle);
-
+
StubBundle stubSystemBundle = new StubBundle(0L, "org.osgi.framework", new Version("0"), "");
bundleContext.addInstalledBundle(stubSystemBundle);
-
-
+
RegionManager manager = new RegionManager(bundleContext, "test.domain");
manager.start();
-
+
List<StubServiceRegistration<Object>> serviceRegistrations = bundleContext.getServiceRegistrations();
- assertEquals("Region services not registered", 9, serviceRegistrations.size());
-
+ assertEquals("Region services not registered", 8, serviceRegistrations.size());
+
manager.stop();
-
+
}
}