Integration Test migrate to Karaf4 28/55128/26
authorIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 14 Jun 2017 17:01:01 +0000 (10:01 -0700)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 14 Jun 2017 17:03:36 +0000 (10:03 -0700)
Fix integration test to make it work on Karaf4
and enable integration test which was disabled by
https://git.opendaylight.org/gerrit/#/c/58869/

Change-Id: I7e16ecd09895f1f599eb447805ce7083fb700435
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
16 files changed:
features/production/odl-neutron-hostconfig-ovs/pom.xml
features/production/odl-neutron-hostconfig-vpp/pom.xml
features/production/odl-neutron-logger/pom.xml
features/production/odl-neutron-northbound-api/pom.xml
features/production/odl-neutron-service/pom.xml
features/production/odl-neutron-spi/pom.xml
features/production/odl-neutron-transcriber/pom.xml
features/test/features4-neutron-test/pom.xml
features/test/odl-neutron-logger-test/pom.xml
integration/test/pom.xml
integration/test/src/main/features/features.xml
integration/test/src/main/features4/pom.xml [deleted file]
integration/test/src/test/java/org/opendaylight/neutron/e2etest/ITNeutronE2E.java
karaf4/pom.xml
neutron-logger/pom.xml
pom.xml

index 0d9c5681192c34f669bb51cc1ed57db5c80d0c08..377429bec43cade64e0d0abc150944584932f091 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Hostconfig :: OVS</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
index 36ba18a491def71363ca91e0192e96183eb16201..1b2b77f2d92d13d923e29daf57a8d4025f9a9a72 100644 (file)
@@ -20,6 +20,7 @@
 
     <properties>
         <netconf.version>1.3.0-SNAPSHOT</netconf.version>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
     </properties>
 
     <dependencyManagement>
index 5f1554e8c4e69c5f0f230a3a8532bdf136ca02b2..ef8eaf4721201003a0e12a940a5cdc2f5f5d282d 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Logger</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
index 8ba7cc01425237733f0e5ebe55c8cb3faa009b83..d7a8d6d0592393c57b146c356dd98b2437957ee9 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Northbound</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.aaa</groupId>
index d87cfee727c73ac9040f40c89ceca2c45ad202cb..5636f2b8118171d809857ea090ab8fe9261528ae 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Service</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 21e53fe86be052062a6889f0c0031149220f6a63..e70670593260da1c19d7aee4b8480461352ac7ed 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: API</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
index 25dd8111dd888beede279714b66f67153ec2b0ca..8f2b17cbbb1ccbedbf5d72b713593f3341cf2783 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Implementation</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
index 706f822fad00cd63f6ca51cc812ad18fa3ed8e78..d4f2497429784776083f6798bb3ae7c06d05ce78 100644 (file)
     <version>0.9.0-SNAPSHOT</version>
     <packaging>feature</packaging>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 07afd247a2f7846787304276be80876f1a9e2dea..4c26b8bd91b2f8ebbe18d2315facf204eaec06ce 100644 (file)
     <packaging>feature</packaging>
     <name>OpenDaylight :: Neutron :: Logger :: Test</name>
 
+    <properties>
+        <explicitFeatureDependencies>true</explicitFeatureDependencies>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
index b5161b40da5cf096a06e117ae97ad3551c7ca3ef..e6defb324ab2ede200f3d086fc27c59f605baa3f 100644 (file)
@@ -2,27 +2,26 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>features-parent</artifactId>
-    <version>1.9.0</version>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>mdsal-it-parent</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
     <relativePath/>
   </parent>
 
   <groupId>org.opendaylight.neutron</groupId>
   <artifactId>integration-test</artifactId>
   <version>0.9.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
-
-  <!--<modules>-->
-    <!--<module>features4-odl-neutron-test</module>-->
-  <!--</modules>-->
-
-  <!--TODO:to run integration test with karaf4: odlparent/features4-test is missing or can we just use odlparent/features-test?-->
+  <packaging>bundle</packaging>
 
   <!-- <name> formatting is used by autorelease to parse and notify projects on
        build failure. Please do not modify this unless you have a good reason. -->
   <name>ODL :: neutron :: ${project.artifactId}</name>
   <properties>
+    <skipITs>false</skipITs>
+    <karaf.distro.groupId>org.opendaylight.neutron</karaf.distro.groupId>
+    <karaf.distro.artifactId>neutron4-karaf</karaf.distro.artifactId>
+    <karaf.distro.version>${project.version}</karaf.distro.version>
+    <karaf.distro.type>zip</karaf.distro.type>
     <checkstyle.location>${project.parent.basedir}/src/main/resources</checkstyle.location>
     <sonar.jacoco.itReportPath>target/jacoco-it.exec</sonar.jacoco.itReportPath>
     <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>features-neutron</artifactId>
-      <version>${project.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>neutron-logger</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>odl-neutron-service</artifactId>
-      <version>${project.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>odl-neutron-logger</artifactId>
-      <version>${project.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>neutron-karaf</artifactId>
+      <artifactId>neutron4-karaf</artifactId>
       <version>${project.version}</version>
       <type>zip</type>
     </dependency>
       </plugins>
     </pluginManagement>
     <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>unpack-classes</id>
-            <goals>
-              <goal>unpack</goal>
-            </goals>
-            <configuration>
-              <artifactItems>
-                <artifactItem>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>neutron-logger</artifactId>
-                  <version>${project.version}</version>
-                </artifactItem>
-                <artifactItem>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>neutron-spi</artifactId>
-                  <version>${project.version}</version>
-                </artifactItem>
-                <artifactItem>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>northbound-api</artifactId>
-                  <version>${project.version}</version>
-                </artifactItem>
-                <artifactItem>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>transcriber</artifactId>
-                  <version>${project.version}</version>
-                </artifactItem>
-              </artifactItems>
-              <outputDirectory>target/classes</outputDirectory>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <groupId>org.ops4j.pax.exam</groupId>
         <artifactId>maven-paxexam-plugin</artifactId>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <artifactId>maven-failsafe-plugin</artifactId>
-        <version>${failsafe.version}</version>
-        <executions>
-          <execution>
-            <id>integration-tests</id>
-            <phase>integration-test</phase>
-            <goals>
-              <goal>integration-test</goal>
-              <goal>verify</goal>
-            </goals>
-            <configuration>
-              <argLine>${failsafeArgLine}</argLine>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <executions>
index e1b2a44c6ef241083308dcb7740d7594b17a0b4a..8628ec674c30f87a952dce261467e2c40161e5b6 100644 (file)
@@ -1,11 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<features name="odl-neutron-test-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
-   <repository>mvn:org.opendaylight.neutron/features-neutron/{{VERSION}}/xml/features</repository>
-   <feature name='odl-neutron-neutron-logger-test' version='${project.version}' description="OpenDaylight :: Neutron :: Neutron Logger Test">
-    <feature version='${project.version}'>odl-neutron-service</feature>
-    <bundle>mvn:org.opendaylight.neutron/neutron-logger/{{VERSION}}</bundle>
-  </feature>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="features4-neutron-test">
+    <repository>mvn:org.opendaylight.neutron/odl-neutron-logger-test/0.9.0-SNAPSHOT/xml/features</repository>
+    <feature name="features4-neutron-test" description="features4-neutron-test" version="0.9.0.SNAPSHOT">
+        <feature version="0.9.0.SNAPSHOT" prerequisite="false" dependency="true">odl-neutron-logger-test</feature>
+    </feature>
 </features>
diff --git a/integration/test/src/main/features4/pom.xml b/integration/test/src/main/features4/pom.xml
deleted file mode 100644 (file)
index 262bf70..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>feature-repo-parent</artifactId>
-        <version>1.9.0</version>
-    </parent>
-
-    <groupId>org.opendaylight.neutron</groupId>
-    <artifactId>features4-odl-neutron-test</artifactId>
-    <version>0.9.0-SNAPSHOT</version>
-    <packaging>feature</packaging>
-
-    <dependencies>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>features4-neutron-test</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
-    </dependencies>
-
-</project>
index 910ea8218ba8fcd7f351f6ba81bcc9e463cf32da..dbd6dcd0b4f26625fbaa7a1dbd8e75e6f124573a 100644 (file)
@@ -12,7 +12,6 @@ import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
 import static org.ops4j.pax.exam.CoreOptions.when;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
@@ -21,7 +20,6 @@ import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import java.io.BufferedReader;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
@@ -30,59 +28,76 @@ import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Map;
 import java.util.Set;
-import javax.inject.Inject;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationAdmin;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 @RunWith(PaxExam.class)
-public class ITNeutronE2E {
+@ExamReactorStrategy(PerClass.class)
+public class ITNeutronE2E  extends AbstractMdsalTestBase {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ITNeutronE2E.class);
     private static final String KARAF_DEBUG_PORT = "5005";
     private static final String KARAF_DEBUG_PROP = "karaf.debug";
 
-    @Inject
-    private BundleContext bundleContext;
+    final String base = "http://127.0.0.1:8181/controller/nb/v2/neutron";
 
-    @Inject
-    private ConfigurationAdmin configurationAdmin;
+    @Override
+    public String getKarafDistro() {
+        return maven()
+            .groupId("org.opendaylight.neutron")
+            .artifactId("neutron4-karaf")
+            .versionAsInProject()
+            .type("zip")
+            .getURL();
+    }
+
+    @Override
+    public MavenUrlReference getFeatureRepo() {
+        return maven()
+            .groupId("org.opendaylight.neutron")
+            .artifactId("features4-neutron-test")
+            .classifier("features")
+            .type("xml")
+            .versionAsInProject();
+    }
+
+    @Override
+    public String getFeatureName() {
+        return "odl-neutron-logger-test";
+    }
 
     @Configuration
     public Option[] config() {
-        return new Option[] {
-                // Provision and launch a container based on a distribution of Karaf (Apache ServiceMix).
-                // FIXME: need to *NOT* hardcode the version here - it breaks on
-                // version bumps
-                karafDistributionConfiguration()
-                        .frameworkUrl(maven().groupId("org.opendaylight.neutron").artifactId("neutron-karaf")
-                                .type("zip").versionAsInProject())
-                        .karafVersion("3.0.3").name("Neutron").unpackDirectory(new File("target/pax"))
-                        .useDeployFolder(false),
-                // It is really nice if the container sticks around after the test so you can check the contents
-                // of the data directory when things go wrong.
-                vmOption("-javaagent:../jars/org.jacoco.agent.jar=destfile=jacoco-it.exec"), keepRuntimeFolder(),
-                // Don't bother with local console output as it just ends up cluttering the logs
-                configureConsole().ignoreLocalConsole(),
-                // Force the log level to INFO so we have more details during the test.  It defaults to WARN.
-                logLevel(LogLevel.INFO),
-                // provision the needed features for this test
-                //    features("mvn:org.opendaylight.neutron/features-test/0.5.0-SNAPSHOT/xml/features",
-                //        "features-neutron-test"),
-                // Remember that the test executes in another process.  If you want to debug it, you need
-                // to tell Pax Exam to launch that process with debugging enabled.  Launching the test class itself with
-                // debugging enabled (for example in Eclipse) will not get you the desired results.
-                when(Boolean.getBoolean(KARAF_DEBUG_PROP))
-                        .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)), };
+        Option[] options = super.config();
+        Option[] otherOptions = getOtherOptions();
+        Option[] combinedOptions = new Option[options.length + otherOptions.length];
+        System.arraycopy(options, 0, combinedOptions, 0, options.length);
+        System.arraycopy(otherOptions, 0, combinedOptions, options.length,
+            otherOptions.length);
+        return combinedOptions;
     }
 
-    final String base = "http://127.0.0.1:8080/controller/nb/v2/neutron";
+    private Option[] getOtherOptions() {
+        return new Option[] {
+            vmOption("-javaagent:../../pax/jars/org.jacoco.agent.jar=destfile=../../jacoco-it.exec"),
+            keepRuntimeFolder(), configureConsole().ignoreLocalConsole(),
+            logLevel(LogLevel.INFO),
+            when(Boolean.getBoolean(KARAF_DEBUG_PROP)).useOptions(
+                KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),};
+    }
 
     @Test
     public void test() throws IOException, InterruptedException {
index 8b48b9f15f1cb677e9e054428e3aeb0899d90856..d03288e53ea887fb934a849914892bef01691f6f 100644 (file)
@@ -36,14 +36,12 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
         <dependency>
             <groupId>org.apache.karaf.features</groupId>
             <artifactId>framework</artifactId>
-            <version>${karaf4.version}</version>
             <type>kar</type>
         </dependency>
 
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>features4-neutron-test</artifactId>
-            <version>${project.version}</version>
             <classifier>features</classifier>
             <type>xml</type>
             <scope>runtime</scope>
index 544313755c6633dcc897f98ea80c76a45571c173..f5e1fe72c597e4e09bf0fb6d420c80f4ccd3e07e 100644 (file)
     </dependencies>
   </dependencyManagement>
   <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.neutron</groupId>
-      <artifactId>neutron-spi</artifactId>
-      <version>${project.version}</version>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.neutron</groupId>
       <artifactId>model</artifactId>
diff --git a/pom.xml b/pom.xml
index 83757dd1c57632c673d926ee337ea0982de45a83..56da3ae2010749abc2fd82942776892669d5eaf8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -99,7 +99,7 @@
     <module>features/test</module>
     <module>karaf</module>
     <module>karaf4</module>
-    <!-- <module>integration/test</module> -->
+    <module>integration/test</module>
     <module>model</module>
     <module>neutron-hostconfig</module>
   </modules>