From fbc3092ca33990f0fc4a47f008786a416c484488 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Sun, 13 Oct 2013 17:34:54 -0500 Subject: [PATCH 1/1] Fixed Sanity Test to only accept bundles being RESOLVED if they are fragments Change-Id: Idfc804a81be493b56ef74fee5e335f656eeba344 Signed-off-by: Ed Warnicke --- opendaylight/distribution/sanitytest/pom.xml | 3 ++- .../controller/sanitytest/internal/Activator.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/opendaylight/distribution/sanitytest/pom.xml b/opendaylight/distribution/sanitytest/pom.xml index 142268cf99..9d5ba5cc95 100644 --- a/opendaylight/distribution/sanitytest/pom.xml +++ b/opendaylight/distribution/sanitytest/pom.xml @@ -43,7 +43,8 @@ org.eclipse.osgi.framework.console, org.osgi.framework, org.eclipse.osgi.baseadaptor, - org.eclipse.osgi.framework.adaptor + org.eclipse.osgi.framework.adaptor, + org.osgi.framework.wiring org.opendaylight.controller.sanitytest.internal.Activator 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 65bc380031..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; @@ -32,6 +35,12 @@ public class Activator implements BundleActivator { 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())); failed = true; -- 2.36.6