From d78e985bc4ed590407c8c7800ba796d5ea55aa6c Mon Sep 17 00:00:00 2001 From: Moiz Raja Date: Thu, 3 Oct 2013 19:24:14 -0700 Subject: [PATCH] Integrate the Distribution Sanity Test with the build Added the sanity test to the build. The sanity test plugin is built but not added to the distribution. In the package phase the test is executed and if the test fails (that is finds modules that are not active or resolved) then the build fails Change-Id: Iac8831811e6bf004dc0219043d1b8e23ffbfd33e Signed-off-by: Moiz Raja --- .../distribution/opendaylight/pom.xml | 20 +++++++++++++++++++ opendaylight/distribution/opendaylight/run.sh | 8 ++++++++ .../opendaylight/src/assemble/bin.xml | 1 + .../sanitytest/internal/Activator.java | 3 +-- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 opendaylight/distribution/opendaylight/run.sh diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index cdba77ae29..92e91f49e8 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -138,6 +138,9 @@ ../../commons/checkstyle ../../commons/opendaylight ../../commons/parent + + + ../sanitytest @@ -179,6 +182,23 @@ + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + sanity-test + package + + exec + + + + + ./run.sh + + diff --git a/opendaylight/distribution/opendaylight/run.sh b/opendaylight/distribution/opendaylight/run.sh new file mode 100755 index 0000000000..e23552d5f8 --- /dev/null +++ b/opendaylight/distribution/opendaylight/run.sh @@ -0,0 +1,8 @@ +cp ../sanitytest/target/sanitytest-0.4.1-SNAPSHOT.jar ./target/distribution.opendaylight-osgipackage/opendaylight/plugins +pushd ./target/distribution.opendaylight-osgipackage/opendaylight/ +./run.sh +success=`echo $?` +popd +rm ./target/distribution.opendaylight-osgipackage/opendaylight/plugins/sanitytest-0.4.1-SNAPSHOT.jar +exit $success + diff --git a/opendaylight/distribution/opendaylight/src/assemble/bin.xml b/opendaylight/distribution/opendaylight/src/assemble/bin.xml index 92a718bac3..7a2be8f099 100644 --- a/opendaylight/distribution/opendaylight/src/assemble/bin.xml +++ b/opendaylight/distribution/opendaylight/src/assemble/bin.xml @@ -19,6 +19,7 @@ org.opendaylight.controller:hosttracker_new org.opendaylight.controller:hosttracker_new.implementation org.opendaylight.controller:checkstyle + org.opendaylight.controller:sanitytest opendaylight/plugins 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..65bc380031 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 @@ -27,14 +27,13 @@ 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()){ 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; } } -- 2.36.6