1 package org.opendaylight.controller.sanitytest.internal;
3 import java.util.Timer;
4 import java.util.TimerTask;
6 import org.osgi.framework.Bundle;
7 import org.osgi.framework.BundleActivator;
8 import org.osgi.framework.BundleContext;
9 import org.osgi.framework.wiring.BundleRevision;
11 public class Activator implements BundleActivator {
13 private static final int DELAY = 30000;
16 private String stateToString(int state) {
20 case Bundle.INSTALLED:
24 case Bundle.UNINSTALLED:
27 return "Not CONVERTED";
31 public void start(final BundleContext bundleContext) throws Exception {
32 Timer monitorTimer = new Timer("monitor timer", true);
33 monitorTimer.schedule(new TimerTask() {
36 boolean failed = false;
37 for(Bundle bundle : bundleContext.getBundles()){
39 * A bundle should be ACTIVE, unless it a fragment, in which case it should be RESOLVED
41 if(!(bundle.getState() == Bundle.ACTIVE) ||
42 (bundle.getState() != Bundle.RESOLVED &&
43 (bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0))
44 if(bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.RESOLVED) {
45 System.out.println("------ Failed to activate/resolve bundle = " + bundle.getSymbolicName() + " state = " + stateToString(bundle.getState()));
59 public void stop(BundleContext bundleContext) throws Exception {