| commit | fd6573dcbd7a71d5286eb1027eb27683472be21c | [log] [tgz] |
|---|---|---|
| author | Hristo Iliev <hsiliev@gmail.com> | Tue Oct 18 14:48:54 2011 +0300 |
| committer | Hristo Iliev <hsiliev@gmail.com> | Tue Oct 18 14:48:54 2011 +0300 |
| tree | ba56866d1f8cb4745076875b8fafa89ffa67cccc | |
| parent | 926aedf632a16494ee9c9d436da8afea3311e95b [diff] |
Bug 361249 - BundleContext Stub does not remove services
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java index 78da1cd..8dbc1ce 100644 --- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java +++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java
@@ -437,9 +437,11 @@ public StubBundleContext removeRegisteredService(ServiceRegistration<?>... serviceRegistrations) { synchronized (this.servicesMonitor) { this.serviceRegistrations.removeAll(Arrays.asList(serviceRegistrations)); + for (ServiceRegistration registration: serviceRegistrations) { + this.services.remove(registration.getReference()); + } return this; } - } /**
diff --git a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java index 6b69aa2..320f35c 100644 --- a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java +++ b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java
@@ -186,6 +186,7 @@ ServiceReference<Object> reference = serviceRegistration.getReference(); serviceRegistration.unregister(); assertNull(this.bundleContext.getService(reference)); + assertNull(this.bundleContext.getServiceReference(Object.class.getName())); } @Test