X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fdistribution%2Fsanitytest%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsanitytest%2Finternal%2FActivator.java;h=c27cd07a7e7673e6dd147d46744cc4665da131e8;hp=262884fa3545ba5e8ac9ee91eb720b86e609c8f7;hb=fbc3092ca33990f0fc4a47f008786a416c484488;hpb=6a5de1746ad68b1fe9464ec414126f1b559737e2 diff --git a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java index 262884fa35..c27cd07a7e 100644 --- a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java +++ b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java @@ -1,10 +1,13 @@ package org.opendaylight.controller.sanitytest.internal; -import org.osgi.framework.*; - import java.util.Timer; import java.util.TimerTask; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.wiring.BundleRevision; + public class Activator implements BundleActivator { //30 Second private static final int DELAY = 30000; @@ -27,14 +30,19 @@ public class Activator implements BundleActivator { public void start(final BundleContext bundleContext) throws Exception { Timer monitorTimer = new Timer("monitor timer", true); - monitorTimer.schedule(new TimerTask() { @Override public void run() { boolean failed = false; for(Bundle bundle : bundleContext.getBundles()){ + /* + * A bundle should be ACTIVE, unless it a fragment, in which case it should be RESOLVED + */ + if(!(bundle.getState() == Bundle.ACTIVE) || + (bundle.getState() != Bundle.RESOLVED && + (bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0)) if(bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.RESOLVED) { - System.out.println("Failed to activate/resolve bundle = " + bundle.getSymbolicName() + " state = " + stateToString(bundle.getState())); + System.out.println("------ Failed to activate/resolve bundle = " + bundle.getSymbolicName() + " state = " + stateToString(bundle.getState())); failed = true; } }