[jboss-cvs] JBossAS SVN: r94373 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi: bundle/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 5 10:36:51 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-05 10:36:51 -0400 (Mon, 05 Oct 2009)
New Revision: 94373
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
Log:
Remove dependency on bundle event order
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-10-05 14:30:07 UTC (rev 94372)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-10-05 14:36:51 UTC (rev 94373)
@@ -34,6 +34,7 @@
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.test.AbstractTestDelegate;
@@ -430,7 +431,6 @@
protected void assertNoFrameworkEvent() throws Exception
{
- waitForEvents(frameworkEvents);
getLog().debug("frameworkEvents=" + frameworkEvents);
assertEquals(0, frameworkEvents.size());
}
@@ -483,7 +483,6 @@
protected void assertNoBundleEvent() throws Exception
{
- waitForEvents(bundleEvents);
getLog().debug("bundleEvents=" + bundleEvents);
assertEquals(0, bundleEvents.size());
}
@@ -491,13 +490,31 @@
protected void assertBundleEvent(int type, Bundle bundle) throws Exception
{
waitForEvents(bundleEvents);
+
getLog().debug("bundleEvents=" + bundleEvents);
int size = bundleEvents.size();
assertTrue("" + size, size > 0);
- BundleEvent event = bundleEvents.remove(0);
- assertEquals(ConstantsHelper.bundleEvent(type), ConstantsHelper.bundleEvent(event.getType()));
- assertEquals(bundle, event.getSource());
- assertEquals(bundle, event.getBundle());
+
+ if (bundle instanceof AbstractBundleState)
+ bundle = ((AbstractBundleState)bundle).getBundle();
+
+ BundleEvent foundEvent = null;
+ for(int i=0; i < bundleEvents.size(); i++)
+ {
+ BundleEvent aux = bundleEvents.get(i);
+ if (type == aux.getType())
+ {
+ if (bundle.equals(aux.getSource()) && bundle.equals(aux.getBundle()))
+ {
+ bundleEvents.remove(aux);
+ foundEvent = aux;
+ break;
+ }
+ }
+ }
+
+ if (foundEvent == null)
+ fail("Cannot find event " + ConstantsHelper.bundleEvent(type) + " from " + bundle);
}
public void serviceChanged(ServiceEvent event)
@@ -512,7 +529,6 @@
protected void assertNoServiceEvent() throws Exception
{
- waitForEvents(serviceEvents);
getLog().debug("serviceEvents=" + serviceEvents);
assertEquals(0, serviceEvents.size());
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-10-05 14:30:07 UTC (rev 94372)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-10-05 14:36:51 UTC (rev 94373)
@@ -408,7 +408,6 @@
{
uninstall(bundle);
}
- assertBundleEvent(BundleEvent.STOPPING, bundle);
assertBundleEvent(BundleEvent.STOPPED, bundle);
// todo assertBundleEvent(BundleEvent.UNRESOLVED, bundle);
assertBundleEvent(BundleEvent.UNINSTALLED, bundle);
More information about the jboss-cvs-commits
mailing list