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>
<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>
--- /dev/null
+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
+
<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>
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;
}
}