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 cdba77ae29be27b369548f16a0a4282df364c7ea..92e91f49e88ab21c955dc5b805dcec536603bfec 100644 (file)
     <module>../../commons/checkstyle</module>
     <module>../../commons/opendaylight</module>
     <module>../../commons/parent</module>
     <module>../../commons/checkstyle</module>
     <module>../../commons/opendaylight</module>
     <module>../../commons/parent</module>
+
+
+    <module>../sanitytest</module>
   </modules>
 
   <build>
   </modules>
 
   <build>
           </execution>
         </executions>
       </plugin>
           </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>
     </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 92a718bac3e386c94b099ab3fdb35590ab851b81..7a2be8f099e7db3ec33e223caeebff50c542a4a1 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: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>
       </excludes>
       <binaries>
         <outputDirectory>opendaylight/plugins</outputDirectory>
index 262884fa3545ba5e8ac9ee91eb720b86e609c8f7..65bc3800311c97ff5cc170e0a8d2ec2498adf99b 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);
 
     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) {
         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;
                     }
                 }
                         failed = true;
                     }
                 }