Integrate the Distribution Sanity Test with the build 61/1661/5
authorMoiz Raja <moraja@cisco.com>
Fri, 4 Oct 2013 02:24:14 +0000 (19:24 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 7 Oct 2013 13:15:52 +0000 (13:15 +0000)
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 <moraja@cisco.com>
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/run.sh [new file with mode: 0755]
opendaylight/distribution/opendaylight/src/assemble/bin.xml
opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java

index cdba77a..92e91f4 100644 (file)
     <module>../../commons/checkstyle</module>
     <module>../../commons/opendaylight</module>
     <module>../../commons/parent</module>
+
+
+    <module>../sanitytest</module>
   </modules>
 
   <build>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <executions>
+          <execution>
+            <id>sanity-test</id>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <executable>./run.sh</executable>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/opendaylight/distribution/opendaylight/run.sh b/opendaylight/distribution/opendaylight/run.sh
new file mode 100755 (executable)
index 0000000..e23552d
--- /dev/null
@@ -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
+
index 92a718b..7a2be8f 100644 (file)
@@ -19,6 +19,7 @@
         <exclude>org.opendaylight.controller:hosttracker_new</exclude>
         <exclude>org.opendaylight.controller:hosttracker_new.implementation</exclude>
         <exclude>org.opendaylight.controller:checkstyle</exclude>
+        <exclude>org.opendaylight.controller:sanitytest</exclude>
       </excludes>
       <binaries>
         <outputDirectory>opendaylight/plugins</outputDirectory>
index 262884f..65bc380 100644 (file)
@@ -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;
                     }
                 }