Merge "Bug 116 - Revisit SanityTest"
[controller.git] / opendaylight / distribution / sanitytest / pom.xml
index 9d5ba5cc9596ee6b9986f905b1064bc9542f0f00..ce710d120e998b81cf3af602a434f4be5dc3f237 100644 (file)
 
   <artifactId>sanitytest</artifactId>
   <version>0.4.1-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <packaging>jar</packaging>
+
+  <properties>
+    <distro.dir>${project.basedir}/../opendaylight/target/distribution.opendaylight-osgipackage/opendaylight</distro.dir>
+    <distro.script>${distro.dir}/run.bat</distro.script>
+    <!-- the address is passed to both the controller & the test to establish the connection -->
+    <sanitytest.bind.address>127.0.0.1</sanitytest.bind.address>
+    <sanitytest.timeout>300</sanitytest.timeout>
+  </properties>
+
+  <profiles>
+    <profile>
+      <id>non-windows</id>
+      <activation>
+        <os>
+          <family>!windows</family>
+        </os>
+      </activation>
+      <properties>
+        <distro.script>${distro.dir}/run.sh</distro.script>
+        <distro.pid>/tmp/opendaylight.PID</distro.pid>
+      </properties>
+    </profile>
+  </profiles>
+
   <dependencies>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
       <scope>provided</scope>
     </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.ow2.chameleon.management</groupId>
+      <artifactId>chameleon-mbeans</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
+
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>${bundle.plugin.version}</version>
-        <extensions>true</extensions>
+        <!-- disable the install plugin -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>${install.plugin.version}</version>
         <configuration>
-          <instructions>
-            <Export-Package>
-              org.opendaylight.controller.sanitytest
-            </Export-Package>
-            <Import-Package>
-              javax.xml.bind.annotation,
-              org.osgi.service.component,
-              org.slf4j,
-              org.eclipse.osgi.framework.console,
-              org.osgi.framework,
-              org.eclipse.osgi.baseadaptor,
-              org.eclipse.osgi.framework.adaptor,
-              org.osgi.framework.wiring
-            </Import-Package>
-            <Bundle-Activator>
-              org.opendaylight.controller.sanitytest.internal.Activator
-            </Bundle-Activator>
-          </instructions>
-          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+          <skip>true</skip>
         </configuration>
+        <executions>
+          <execution>
+            <id>default-install</id>
+            <phase>none</phase>
+          </execution>
+        </executions>
       </plugin>
+
+      <plugin>
+        <!--  ensure that the distro installation is already built -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${enforcer.plugin.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-files-exist</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireFilesExist>
+                  <files>
+                    <file>${distro.script}</file>
+                  </files>
+                </requireFilesExist>
+              </rules>
+              <fail>true</fail>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>controller-maven-plugin</artifactId>
+        <version>0.1.0-SNAPSHOT</version>
+          <configuration>
+              <controllerHome>${distro.dir}</controllerHome>
+              <controllerHost>localhost</controllerHost>
+              <controllerWebPort>8080</controllerWebPort>
+              <controllerUsername>admin</controllerUsername>
+              <controllerPassword>admin</controllerPassword>
+              <controllerStartScriptName>${distro.script}</controllerStartScriptName>
+              <pidFile>${distro.pid}</pidFile>
+          </configuration>
+        <executions>
+          <execution>
+            <!-- ensure controller is started in pre-integration phase -->
+            <id>start-controller</id>
+            <phase>pre-integration-test</phase>
+            <configuration>
+              <startArgs>
+                <param>-start</param>
+                <param>-jmx</param>
+                <param>-Djava.rmi.server.hostname=${sanitytest.bind.address} </param>
+              </startArgs>
+              <warmupTimeSecs> 60 </warmupTimeSecs>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+          <execution>
+            <!-- ensure controller is stopped in post-integration phase -->
+            <id>stop-controller</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <!--  run the test -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>${failsafe.version}</version>
+        <configuration>
+          <systemPropertyVariables>
+            <ctrl.home>${distro.dir}</ctrl.home>
+            <ctrl.host>${sanitytest.bind.address}</ctrl.host>
+            <ctrl.start.timeout>${sanitytest.timeout}</ctrl.start.timeout>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+
     </plugins>
+
+
   </build>
 </project>