From 391f3f3783c212c0afdf93fa11850bd86042051e Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 4 Jun 2009 17:48:20 +0000 Subject: [PATCH] Improve error reporting git-svn-id: https://svn.argeo.org/slc/trunk@2470 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../test/AbstractOsgiRuntimeTestCase.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/runtime/org.argeo.slc.support.equinox/src/test/java/org/argeo/slc/osgi/test/AbstractOsgiRuntimeTestCase.java b/runtime/org.argeo.slc.support.equinox/src/test/java/org/argeo/slc/osgi/test/AbstractOsgiRuntimeTestCase.java index 0874aae56..88c9f1af5 100644 --- a/runtime/org.argeo.slc.support.equinox/src/test/java/org/argeo/slc/osgi/test/AbstractOsgiRuntimeTestCase.java +++ b/runtime/org.argeo.slc.support.equinox/src/test/java/org/argeo/slc/osgi/test/AbstractOsgiRuntimeTestCase.java @@ -5,6 +5,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.management.BadBinaryOpValueExpException; + import junit.framework.TestCase; import org.apache.commons.logging.Log; @@ -101,7 +103,9 @@ public abstract class AbstractOsgiRuntimeTestCase extends TestCase { long begin = System.currentTimeMillis(); long duration = 0; boolean allBundlesOk = true; + StringBuffer badBundles = null; while (duration < getResolvedTimeout()) { + badBundles = new StringBuffer(); for (Bundle bundle : bundleContext.getBundles()) { if (bundle.getSymbolicName() != null && bundle.getSymbolicName().startsWith( @@ -112,13 +116,23 @@ public abstract class AbstractOsgiRuntimeTestCase extends TestCase { if (bundle.getState() == Bundle.INSTALLED) { allBundlesOk = false; - break;// for + badBundles + .append(OsgiStringUtils + .nullSafeSymbolicName(bundle) + + " [" + + OsgiStringUtils + .bundleStateAsString(bundle) + "]"); } if (bundlesToStart.contains(bundle.getSymbolicName()) && bundle.getState() != Bundle.ACTIVE) { allBundlesOk = false; - break;// for + badBundles + .append(OsgiStringUtils + .nullSafeSymbolicName(bundle) + + " [" + + OsgiStringUtils + .bundleStateAsString(bundle) + "]\n"); } } @@ -132,7 +146,8 @@ public abstract class AbstractOsgiRuntimeTestCase extends TestCase { if (!allBundlesOk) { listInstalledBundles(); - throw new SlcException("Some bundles are in INSTALLED status"); + throw new SlcException( + "Some bundles are not at the proper status:\n" + badBundles); } } -- 2.39.2