[jboss-osgi-commits] JBoss-OSGI SVN: r97490 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: test/java/org/jboss/test/osgi/service and 1 other directory.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Mon Dec 7 04:10:45 EST 2009
Author: alesj
Date: 2009-12-07 04:10:44 -0500 (Mon, 07 Dec 2009)
New Revision: 97490
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
Log:
Add bundle uninstall tests on 2nd non-registering service bundle.
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-07 06:32:02 UTC (rev 97489)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-07 09:10:44 UTC (rev 97490)
@@ -1449,7 +1449,7 @@
*
* @param context the context
*/
- private void unregisterContext(ControllerContext context)
+ private static void unregisterContext(ControllerContext context)
{
if (context instanceof ServiceRegistration)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java 2009-12-07 06:32:02 UTC (rev 97489)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/RegisterServiceUnitTestCase.java 2009-12-07 09:10:44 UTC (rev 97490)
@@ -38,6 +38,7 @@
*
* todo test secutiry
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class RegisterServiceUnitTestCase extends FrameworkTest
@@ -244,4 +245,42 @@
uninstall(bundle);
}
}
+
+ public void testBundleUninstall() throws Exception
+ {
+ Bundle bundle1 = addBundle("/bundles/simple/", "simple-bundle1");
+ try
+ {
+ bundle1.start();
+ BundleContext bundleContext = bundle1.getBundleContext();
+ assertNotNull(bundleContext);
+
+ ServiceRegistration registration = bundleContext.registerService(OBJCLASS, bundleContext, null);
+ ServiceReference reference = registration.getReference();
+ Object actual = bundleContext.getService(reference);
+ assertEquals(bundleContext, actual);
+
+ Bundle bundle2 = addBundle("/bundles/simple/", "simple-bundle2");
+ try
+ {
+ bundle2.start();
+ BundleContext bundleContext2 = bundle2.getBundleContext();
+ assertNotNull(bundleContext2);
+
+ actual = bundleContext2.getService(reference);
+ assertEquals(bundleContext, actual);
+ }
+ finally
+ {
+ uninstall(bundle2);
+ }
+
+ actual = bundleContext.getService(reference);
+ assertEquals(bundleContext, actual);
+ }
+ finally
+ {
+ uninstall(bundle1);
+ }
+ }
}
More information about the jboss-osgi-commits
mailing list