[jboss-cvs] JBossAS SVN: r97565 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: test/java/org/jboss/test/osgi/service and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 8 16:27:23 EST 2009
Author: alesj
Date: 2009-12-08 16:27:22 -0500 (Tue, 08 Dec 2009)
New Revision: 97565
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/MANIFEST.MF
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/jboss-beans.xml
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
Log:
Add beans mix, fix few typos/bugz.
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-08 20:34:57 UTC (rev 97564)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-08 21:27:22 UTC (rev 97565)
@@ -355,7 +355,7 @@
ContextTracking ct = (ContextTracking)context;
ct.ungetTarget(this);
}
- return isContextInUse(context);
+ return getUsedByCount(context, this) > 0;
}
public ServiceReference[] getServicesInUse()
@@ -463,17 +463,17 @@
// Check if the service is still in use by this bundle
ControllerContextHandle handle = (ControllerContextHandle)reference;
ControllerContext context = handle.getContext();
- if (isContextInUse(context) == false)
+ if (OSGiBundleManager.isUnregistered(context))
return false;
checkValidBundleContext();
- return getBundleManager().ungetContext(this, context);
+ return ungetContext(context);
}
- boolean ungetContex(ControllerContext state)
+ boolean ungetContext(ControllerContext context)
{
- return getBundleManager().ungetContext(this, state);
+ return getBundleManager().ungetContext(this, context);
}
public void addBundleListener(BundleListener listener)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2009-12-08 20:34:57 UTC (rev 97564)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2009-12-08 21:27:22 UTC (rev 97565)
@@ -75,6 +75,9 @@
public Bundle getBundle()
{
+ if (OSGiBundleManager.isUnregistered(context))
+ return null;
+
return bundleState.getBundleInternal();
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-08 20:34:57 UTC (rev 97564)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-08 21:27:22 UTC (rev 97565)
@@ -676,7 +676,7 @@
int count = ct.getUsedByCount(this, using);
while(count > 0)
{
- using.ungetContex(this); // ungetService will cleanup service cache
+ using.ungetContext(this); // ungetService will cleanup service cache
count--;
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2009-12-08 20:34:57 UTC (rev 97564)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2009-12-08 21:27:22 UTC (rev 97565)
@@ -38,6 +38,7 @@
import org.jboss.test.osgi.service.support.a.A;
import org.jboss.test.osgi.service.support.c.C;
import org.jboss.test.osgi.service.support.d.D;
+import org.jboss.virtual.AssembledDirectory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -425,6 +426,37 @@
}
}
+ public void testBeansMix() throws Throwable
+ {
+ AssembledDirectory mix = createAssembledDirectory("beans1", "");
+ addPath(mix, "/bundles/service/service-beans1", "");
+ addPackage(mix, A.class);
+ Deployment deployment = addDeployment(mix);
+ try
+ {
+ checkComplete();
+
+ Bundle bundle = getBundle(getDeploymentUnit(deployment));
+ bundle.start();
+
+ ServiceReference[] refs = bundle.getRegisteredServices();
+ assertNotNull(refs);
+ assertEquals(1, refs.length);
+ ServiceReference ref = refs[0];
+ assertEquals(bundle, ref.getBundle());
+ Class<?> aClass = bundle.loadClass(A.class.getName());
+ BundleContext bc = bundle.getBundleContext();
+ assertNotNull(bc);
+ Object service = bc.getService(ref);
+ assertInstanceOf(service, aClass, false);
+ assertFalse(bc.ungetService(ref));
+ }
+ finally
+ {
+ undeploy(deployment);
+ }
+ }
+
public void testFiltering() throws Throwable
{
Deployment bean = addBean("beanA", A.class);
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/MANIFEST.MF (from rev 97508, projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle1/META-INF/MANIFEST.MF)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/MANIFEST.MF (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/MANIFEST.MF 2009-12-08 21:27:22 UTC (rev 97565)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: Service1
+Bundle-SymbolicName: org.jboss.test.osgi.service1
+Export-Package: org.jboss.test.osgi.service.support.a
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-beans1/META-INF/jboss-beans.xml 2009-12-08 21:27:22 UTC (rev 97565)
@@ -0,0 +1,5 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="A" class="org.jboss.test.osgi.service.support.a.A" />
+
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list