</dependency>
<!-- Southbound bundles -->
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>protocol_plugins.openflow</artifactId>
<version>${controller.version}</version>
</dependency>
- <!-- Sanitytest
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sanitytest</artifactId>
- <version>${controller.version}</version>
- </dependency>
-
- -->
-
<!-- Third party depedencies -->
<dependency>
<artifactId>yang-model-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sanitytest</artifactId>
+ <version>${controller.version}</version>
+ </dependency>
</dependencies>
+
<build>
<plugins>
<plugin>
</execution>
</executions>
</plugin>
- <!--
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sanitytest</artifactId>
+ <version>${controller.version}</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </plugin>
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</goals>
</execution>
</executions>
- <configuration>
- <executable>./run.sh</executable>
- </configuration>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-cp</argument>
+ <argument>../sanitytest/target/classes</argument>
+ <argument>org.opendaylight.controller.distribution.Sanity</argument>
+ </arguments>
+ <workingDirectory>${exec.workingdir}/../../sanitytest</workingDirectory>
+ </configuration>
</plugin>
- -->
</plugins>
</build>
</project>
--- /dev/null
+REM This is where the sanity test execution for windows needs to go (see run.sh)
--- /dev/null
+# Inject the sanitytest jar as a controller plugin
+cp ./target/dependency/sanitytest*.jar ./target/distribution.opendaylight-osgipackage/opendaylight/plugins
+
+# Store the current working directory in a variable so that we can get back to it later
+cwd=`pwd`
+
+# Switch to the distribution folder
+cd ./target/distribution.opendaylight-osgipackage/opendaylight/
+
+# Run the controller
+./run.sh
+
+# Store the exit value of the controller in a variable
+success=`echo $?`
+
+# Switch back to the directory from which this script was invoked
+cd $cwd
+
+# Remove the sanitytest jar from the plugins directory
+rm ./target/distribution.opendaylight-osgipackage/opendaylight/plugins/sanitytest*.jar
+
+# Exit using the exit code that we had captured earlier after running the controller
+exit $success
+
--- /dev/null
+package org.opendaylight.controller.distribution;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class Sanity {
+
+ static void copy(InputStream in, OutputStream out) throws IOException {
+ while (true) {
+ int c = in.read();
+ if (c == -1) break;
+ out.write((char)c);
+ }
+ }
+
+ public static void main(String[] args) throws IOException, InterruptedException {
+ String cwd = System.getProperty("user.dir");
+
+ System.out.println("Current working directory = " + cwd);
+
+ // We assume that the program is being run from the sanitytest directory
+ // We need to specify the opendaylight directory as the working directory for the shell/batch scripts
+ File processWorkingDir = new File(cwd, "../opendaylight");
+
+ String os = System.getProperty("os.name").toLowerCase();
+ String script = "./run.sh";
+
+ if(os.contains("windows")){
+ script = "run.bat";
+ }
+
+ ProcessBuilder processBuilder = new ProcessBuilder();
+ processBuilder.directory(processWorkingDir.getCanonicalFile());
+ processBuilder.command(script);
+ Process p = processBuilder.start();
+
+ copy(p.getInputStream(), System.out);
+
+ p.waitFor();
+
+ System.out.println("Test exited with exitValue = " + p.exitValue());
+
+ System.exit(p.exitValue());
+ }
+}
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;
}
}
<module>opendaylight/samples/loadbalancer</module>
<module>opendaylight/samples/northbound/loadbalancer</module>
- <!-- sanity test
<module>opendaylight/distribution/sanitytest/</module>
- -->
+
<!-- Parents -->
<module>opendaylight/commons/concepts</module>
<module>opendaylight/commons/httpclient</module>