[jboss-cvs] JBossAS SVN: r92822 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: test/java/org/jboss/test/osgi/integration/simple and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 26 06:02:04 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-08-26 06:02:04 -0400 (Wed, 26 Aug 2009)
New Revision: 92822
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java
Log:
[JBOSGI-139] Implement system BundleContext.loadClass()
getServiceReference on the system context ignores isAssignable
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-26 09:48:25 UTC (rev 92821)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-26 10:02:04 UTC (rev 92822)
@@ -673,9 +673,13 @@
*/
ServiceReference getServiceReference(OSGiBundleState bundleState, String clazz)
{
- Collection<OSGiServiceState> services = getServices(bundleState, clazz, null, true);
+ // Ignore isAssignable for the system context
+ boolean checkAssignable = (bundleState.getBundleId() != 0);
+
+ Collection<OSGiServiceState> services = getServices(bundleState, clazz, null, checkAssignable);
if (services == null || services.isEmpty())
return null;
+
OSGiServiceState service = services.iterator().next();
return service.getReferenceInternal();
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java 2009-08-26 09:48:25 UTC (rev 92821)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java 2009-08-26 10:02:04 UTC (rev 92822)
@@ -67,12 +67,13 @@
BundleContext bndContext = bundle.getBundleContext();
assertNotNull("BundleContext not null", bndContext);
+ // getServiceReference from bundle context
ServiceReference sref = bndContext.getServiceReference(SimpleService.class.getName());
assertNotNull("ServiceReference not null", sref);
- // [TODO] getServiceReference from system context
- //sref = sysContext.getServiceReference(SimpleService.class.getName());
- //assertNotNull("ServiceReference not null", sref);
+ // getServiceReference from system context
+ sref = sysContext.getServiceReference(SimpleService.class.getName());
+ assertNotNull("ServiceReference not null", sref);
bundle.uninstall();
assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
More information about the jboss-cvs-commits
mailing list