Backport mvn archetypes to stable/lithium. 05/24705/3
authorJan-Simon Möller <dl9pf@gmx.de>
Fri, 31 Jul 2015 19:22:46 +0000 (21:22 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 7 Aug 2015 21:04:48 +0000 (21:04 +0000)
Based on commits to master from
Ed Warnicke <hagbard@gmail.com>

v2: imported 24728 - whitespace fixes.

Change-Id: I4da6a343fab5d3072e7dec224da01a9a830e214a
Signed-off-by: Jan-Simon Moeller <dl9pf@gmx.de>
17 files changed:
.gitignore
karaf/karaf-parent/pom.xml
opendaylight/archetypes/opendaylight-startup/src/main/resources/META-INF/maven/archetype-metadata.xml
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/features/pom.xml
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/features/src/main/features/features.xml
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/impl/src/test/java/__packageInPathFormat__/impl/__classPrefix__ProviderTest.java [deleted file]
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/pom.xml [new file with mode: 0644]
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/src/test/java/__packageInPathFormat__/it/__classPrefix__IT.java [new file with mode: 0644]
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/karaf/pom.xml
opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/pom.xml
opendaylight/config/config-it-base/pom.xml [new file with mode: 0644]
opendaylight/config/config-it-base/src/main/java/org/opendaylight/controller/config/it/base/AbstractConfigTestBase.java [new file with mode: 0644]
opendaylight/config/pom.xml
opendaylight/md-sal/mdsal-it-base/pom.xml [new file with mode: 0644]
opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java [new file with mode: 0644]
opendaylight/md-sal/mdsal-it-parent/pom.xml [new file with mode: 0644]
opendaylight/md-sal/pom.xml

index b304ffce87f5f06b1501a33f424225322353f64c..ead1f8ee02fb16b236af6e517987174d3fa63082 100644 (file)
@@ -29,5 +29,4 @@ maven-eclipse.xml
 .metadata
 opendaylight/md-sal/sal-distributed-datastore/journal
 !opendaylight/distribution/opendaylight-karaf-resources/src/main/resources/bin
-
-
+.checkstyle
index 568032f31e9b07584e2ac8072a9d4de00c2c2b53..b3e8e2cb52d44c10f7ba0980f8767adfac5bb719 100644 (file)
@@ -23,6 +23,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <properties>
     <branding.version>1.1.1-SNAPSHOT</branding.version>
     <karaf.resources.version>1.5.1-SNAPSHOT</karaf.resources.version>
+    <odlparent.karaf.plugin.version>1.5.1-SNAPSHOT</odlparent.karaf.plugin.version>
     <karaf.localFeature>standard</karaf.localFeature>
     <!--  Karaf Maven plugin 3.023 reinstalls already installed
           boot features to container, which could be observed
@@ -302,23 +303,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
                 <overWriteSnapshots>true</overWriteSnapshots>
               </configuration>
             </execution>
-            <execution>
-              <id>copy-dependencies</id>
-              <phase>prepare-package</phase>
-              <goals>
-                <goal>copy-dependencies</goal>
-              </goals>
-              <configuration>
-                <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
-                <excludeArtifactIds>distribution.vtn-coordinator</excludeArtifactIds>
-                <overWriteReleases>false</overWriteReleases>
-                <overWriteSnapshots>true</overWriteSnapshots>
-                <overWriteIfNewer>true</overWriteIfNewer>
-                <useRepositoryLayout>true</useRepositoryLayout>
-                <addParentPoms>true</addParentPoms>
-                <copyPom>true</copyPom>
-              </configuration>
-            </execution>
           </executions>
         </plugin>
         <plugin>
@@ -348,6 +332,22 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             </execution>
           </executions>
         </plugin>
+        <plugin>
+          <groupId>org.opendaylight.odlparent</groupId>
+          <artifactId>karaf-plugin</artifactId>
+          <version>${odlparent.karaf.plugin.version}</version>
+          <executions>
+            <execution>
+              <id>populate-local-repo</id>
+              <goals>
+                <goal>populate-local-repo</goal>
+              </goals>
+              <configuration>
+                <localRepo>${project.build.directory}/assembly/system</localRepo>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
       </plugins>
     </pluginManagement>
     <plugins>
@@ -390,6 +390,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-antrun-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>karaf-plugin</artifactId>
+        <version>${odlparent.karaf.plugin.version}</version>
+      </plugin>
     </plugins>
   </build>
 
index 6eab884cc52062f9150e50184729a74022acaff3..7ad629bf83e3f5aa8c71a6fbb080f1c0a66d28bd 100644 (file)
          <include>pom.xml</include>
        </includes>
      </fileSet>
+
+     <!-- it -->
+     <fileSet filtered="true" encoding="UTF-8">
+        <directory>it</directory>
+        <includes>
+            <include>pom.xml</include>
+        </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+        <directory>it/src/test/java</directory>
+        <includes>
+            <include>**/*.java</include>
+         </includes>
+    </fileSet>
   </fileSets>
 </archetype-descriptor>
index 11536d8c5f53084c653854decfc37c3548599e8b..f6cd4151c69582f074ab05b05f472d22dbc2f0a3 100644 (file)
@@ -26,6 +26,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <properties>
     <mdsal.version>1.2.1-SNAPSHOT</mdsal.version>
     <yangtools.version>0.7.1-SNAPSHOT</yangtools.version>
+    <dlux.version>0.2.1-SNAPSHOT</dlux.version>
     <configfile.directory>etc/opendaylight/karaf</configfile.directory>
   </properties>
   <dependencyManagement>
@@ -65,6 +66,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.dlux</groupId>
+      <artifactId>features-dlux</artifactId>
+      <classifier>features</classifier>
+      <version>${dlux.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
     <dependency>
       <groupId>${symbol_dollar}{project.groupId}</groupId>
       <artifactId>${artifactId}-impl</artifactId>
index 1facf4c8aac0aa727c90c165706aa3438ec274f8..1e3115d531ed9b4b8ecf6c97096bfb1522c586d2 100644 (file)
@@ -16,6 +16,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <repository>mvn:org.opendaylight.yangtools/features-yangtools/${symbol_dollar}{yangtools.version}/xml/features</repository>
   <repository>mvn:org.opendaylight.controller/features-mdsal/${symbol_dollar}{mdsal.version}/xml/features</repository>
   <repository>mvn:org.opendaylight.controller/features-restconf/${symbol_dollar}{mdsal.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.dlux/features-dlux/${symbol_dollar}{dlux.version}/xml/features</repository>
   <feature name='odl-${artifactId}-api' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: api'>
     <feature version='${symbol_dollar}{yangtools.version}'>odl-yangtools-models</feature>
     <bundle>mvn:${groupId}/${artifactId}-api/${symbol_dollar}{project.version}</bundle>
@@ -34,6 +35,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <feature version="${symbol_dollar}{project.version}">odl-${artifactId}-rest</feature>
     <feature version="${symbol_dollar}{mdsal.version}">odl-mdsal-apidocs</feature>
     <feature version="${symbol_dollar}{mdsal.version}">odl-mdsal-xsql</feature>
+    <feature version="${symbol_dollar}{dlux.version}">odl-dlux-yangui</feature>
   </feature>
 
 </features>
diff --git a/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/impl/src/test/java/__packageInPathFormat__/impl/__classPrefix__ProviderTest.java b/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/impl/src/test/java/__packageInPathFormat__/impl/__classPrefix__ProviderTest.java
deleted file mode 100644 (file)
index 09b3dc4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-#set( $provider = "${classPrefix}Provider" )
-/*
- * ${copyright} and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package ${package}.impl;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-
-import static org.mockito.Mockito.mock;
-
-public class ${classPrefix}ProviderTest {
-    @Test
-    public void testOnSessionInitiated() {
-        ${provider} provider = new ${provider}();
-
-        // ensure no exceptions
-        // currently this method is empty
-        provider.onSessionInitiated(mock(BindingAwareBroker.ProviderContext.class));
-    }
-
-    @Test
-    public void testClose() throws Exception {
-        ${provider} provider = new ${provider}();
-
-        // ensure no exceptions
-        // currently this method is empty
-        provider.close();
-    }
-}
diff --git a/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/pom.xml b/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/pom.xml
new file mode 100644 (file)
index 0000000..b60b826
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+${copyright} and others.  All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<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">
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>mdsal-it-parent</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}-it</artifactId>
+  <version>${version}</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skipITs>false</skipITs>
+    <karaf.distro.groupId>org.opendaylight.${artifactId}</karaf.distro.groupId>
+    <karaf.distro.artifactId>${artifactId}-karaf</karaf.distro.artifactId>
+    <karaf.distro.version>${version}</karaf.distro.version>
+    <karaf.distro.type>zip</karaf.distro.type>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>${artifactId}-features</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/src/test/java/__packageInPathFormat__/it/__classPrefix__IT.java b/opendaylight/archetypes/opendaylight-startup/src/main/resources/archetype-resources/it/src/test/java/__packageInPathFormat__/it/__classPrefix__IT.java
new file mode 100644 (file)
index 0000000..eda5e73
--- /dev/null
@@ -0,0 +1,73 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * ${copyright} and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package ${package}.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+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.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+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)
+@ExamReactorStrategy(PerClass.class)
+public class ${classPrefix}IT extends AbstractMdsalTestBase {
+    private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}IT.class);
+
+    @Override
+    public String getModuleName() {
+        return "${artifactId}";
+    }
+
+    @Override
+    public String getInstanceName() {
+        return "${artifactId}-default";
+    }
+
+    @Override
+    public MavenUrlReference getFeatureRepo() {
+        return maven()
+                .groupId("${groupId}")
+                .artifactId("${artifactId}-features")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+    }
+
+    @Override
+    public String getFeatureName() {
+        return "odl-${artifactId}-ui";
+    }
+
+    @Override
+    public Option getLoggingOption() {
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                logConfiguration(${classPrefix}IT.class),
+                LogLevel.INFO.name());
+        option = composite(option, super.getLoggingOption());
+        return option;
+    }
+
+    @Test
+    public void test${artifactId}FeatureLoad() {
+        Assert.assertTrue(true);
+    }
+}
index d3ba24b21c8347b4dd2e9a3e7290546f048c4c14..ee1932eba9af82c200ce736dcf001179b1a5430b 100644 (file)
@@ -64,13 +64,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
           <skip>true</skip>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-install-plugin</artifactId>
-        <configuration>
-          <skip>true</skip>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 </project>
index 49f489379c9b3290868affb612cee04af1e4e0bf..cc2352f02694d56446bcfb22ead1e89c2ca2005c 100644 (file)
@@ -28,6 +28,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     <module>karaf</module>
     <module>features</module>
     <module>artifacts</module>
+    <module>it</module>
   </modules>
   <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
   <build>
diff --git a/opendaylight/config/config-it-base/pom.xml b/opendaylight/config/config-it-base/pom.xml
new file mode 100644 (file)
index 0000000..def8cd3
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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">
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>config-it-base</artifactId>
+  <packaging>bundle</packaging>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>config-artifacts</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-util</artifactId>
+    </dependency>
+    <!-- Dependencies for pax exam karaf container -->
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-container-karaf</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-junit4</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.url</groupId>
+        <artifactId>pax-url-aether</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>javax.inject</groupId>
+        <artifactId>javax.inject</artifactId>
+        <version>1</version>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>org.apache.karaf.features.core</artifactId>
+        <version>${karaf.version}</version>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/opendaylight/config/config-it-base/src/main/java/org/opendaylight/controller/config/it/base/AbstractConfigTestBase.java b/opendaylight/config/config-it-base/src/main/java/org/opendaylight/controller/config/it/base/AbstractConfigTestBase.java
new file mode 100644 (file)
index 0000000..e581e50
--- /dev/null
@@ -0,0 +1,173 @@
+package org.opendaylight.controller.config.it.base;
+
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.when;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+
+import com.google.common.base.Stopwatch;
+
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.concurrent.TimeUnit;
+
+import javax.management.ObjectName;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.rules.TestRule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+import org.opendaylight.controller.config.api.ConfigRegistry;
+import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractConfigTestBase {
+
+    private static final String PAX_EXAM_UNPACK_DIRECTORY = "target/exam";
+    private static final String KARAF_DEBUG_PORT = "5005";
+    private static final String KARAF_DEBUG_PROP = "karaf.debug";
+    private static final String KEEP_UNPACK_DIRECTORY_PROP = "karaf.keep.unpack";
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
+    public static final String ORG_OPS4J_PAX_LOGGING_CFG = "etc/org.ops4j.pax.logging.cfg";
+
+    /*
+     * Default values for karaf distro version, type, groupId, and artifactId
+     */
+    private static final String KARAF_DISTRO_VERSION = "3.0.2";
+    private static final String KARAF_DISTRO_TYPE = "zip";
+    private static final String KARAF_DISTRO_ARTIFACTID = "apache-karaf";
+    private static final String KARAF_DISTRO_GROUPID = "org.apache.karaf";
+
+    /*
+     * Property names to override defaults for karaf distro artifactId, groupId, version, and type
+     */
+    private static final String KARAF_DISTRO_VERSION_PROP = "karaf.distro.version";
+    private static final String KARAF_DISTRO_TYPE_PROP = "karaf.distro.type";
+    private static final String KARAF_DISTRO_ARTIFACTID_PROP = "karaf.distro.artifactId";
+    private static final String KARAF_DISTRO_GROUPID_PROP = "karaf.distro.groupId";
+
+    /*
+     * Wait up to 10s for our configured module to come up
+     */
+    private static final int MODULE_TIMEOUT_MILLIS = 60000;
+
+    public abstract String getModuleName();
+
+    public abstract String getInstanceName();
+
+    public abstract MavenUrlReference getFeatureRepo();
+
+    public abstract String getFeatureName();
+
+    public Option getLoggingOption() {
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                        logConfiguration(AbstractConfigTestBase.class),
+                        LogLevel.INFO.name());
+        return option;
+    }
+
+    public String logConfiguration(Class<?> klazz) {
+        return "log4j.logger." + klazz.getPackage().getName();
+    }
+
+    public String getKarafDistro() {
+        String groupId = System.getProperty(KARAF_DISTRO_GROUPID_PROP,KARAF_DISTRO_GROUPID);
+        String artifactId = System.getProperty(KARAF_DISTRO_ARTIFACTID_PROP,KARAF_DISTRO_ARTIFACTID);
+        String version = System.getProperty(KARAF_DISTRO_VERSION_PROP,KARAF_DISTRO_VERSION);
+        String type = System.getProperty(KARAF_DISTRO_TYPE_PROP,KARAF_DISTRO_TYPE);
+        MavenArtifactUrlReference karafUrl = maven()
+                .groupId(groupId)
+                .artifactId(artifactId)
+                .version(version)
+                .type(type);
+        return karafUrl.getURL();
+    }
+
+    @Configuration
+    public Option[] config() {
+        Option[] options = new Option[] {
+                when(Boolean.getBoolean(KARAF_DEBUG_PROP))
+                        .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
+                karafDistributionConfiguration().frameworkUrl(getKarafDistro())
+                        .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY))
+                        .useDeployFolder(false),
+                when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
+                features(getFeatureRepo(), getFeatureName()),
+                getLoggingOption()};
+        return options;
+    }
+
+    @Before
+    public void setup() throws Exception {
+        LOG.info("Module: {} Instance: {} attempting to configure.",
+                getModuleName(),getInstanceName());
+        Stopwatch stopWatch = Stopwatch.createStarted();
+        ObjectName objectName = null;
+        for(int i = 0;i<MODULE_TIMEOUT_MILLIS;i++) {
+            try {
+                ConfigRegistry configRegistryClient = new ConfigRegistryJMXClient(ManagementFactory
+                        .getPlatformMBeanServer());
+                objectName = configRegistryClient.lookupConfigBean(getModuleName(), getInstanceName());
+                LOG.info("Module: {} Instance: {} ObjectName: {}.",
+                        getModuleName(),getInstanceName(),objectName);
+                break;
+            } catch (Exception e) {
+                if(i<MODULE_TIMEOUT_MILLIS) {
+                    Thread.sleep(1);
+                    continue;
+                } else {
+                    throw e;
+                }
+            }
+        }
+        if(objectName != null) {
+            LOG.info("Module: {} Instance: {} configured after {} ms",
+                getModuleName(),getInstanceName(),
+                stopWatch.elapsed(TimeUnit.MILLISECONDS));
+        } else {
+            throw new RuntimeException("NOT FOUND Module: " +getModuleName() + " Instance: " + getInstanceName() +
+                    " configured after " + stopWatch.elapsed(TimeUnit.MILLISECONDS) + " ms");
+        }
+    }
+
+    @Rule
+    public TestRule watcher = new TestWatcher() {
+
+        @Override
+        protected void starting(Description description) {
+            LOG.info("TestWatcher: Starting test: {}", description.getDisplayName());
+        }
+
+        @Override
+        protected void finished(Description description) {
+            LOG.info("TestWatcher: Finished test: {}", description.getDisplayName());
+        }
+
+        @Override
+        protected void succeeded(Description description) {
+            LOG.info("TestWatcher: Test succeeded: {}", description.getDisplayName());
+        }
+
+        @Override
+        protected void failed(Throwable ex, Description description) {
+            LOG.info("TestWatcher: Test failed: {}", description.getDisplayName(), ex);
+        }
+
+        @Override
+        protected void skipped(AssumptionViolatedException ex, Description description) {
+            LOG.info("TestWatcher: Test skipped: {} ", description.getDisplayName(), ex);
+        }
+    };
+
+}
index c0ca7ef33c6fd7594de0702db12be161da903e52..13a287101fe88ab3c9cf8a1285bd08766e93cfa0 100644 (file)
@@ -42,6 +42,7 @@
 
     <module>config-artifacts</module>
     <module>config-parent</module>
+    <module>config-it-base</module>
   </modules>
 
   <dependencies>
diff --git a/opendaylight/md-sal/mdsal-it-base/pom.xml b/opendaylight/md-sal/mdsal-it-base/pom.xml
new file mode 100644 (file)
index 0000000..50d054f
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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">
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>mdsal-it-base</artifactId>
+  <version>1.3.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <properties>
+    <config.version>0.4.0-SNAPSHOT</config.version>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>config-it-base</artifactId>
+      <version>${config.version}</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>sal-binding-api</artifactId>
+    </dependency>
+        <!-- Dependencies for pax exam karaf container -->
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-container-karaf</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-junit4</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.url</groupId>
+        <artifactId>pax-url-aether</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>javax.inject</groupId>
+        <artifactId>javax.inject</artifactId>
+        <version>1</version>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>org.apache.karaf.features.core</artifactId>
+        <version>${karaf.version}</version>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java b/opendaylight/md-sal/mdsal-it-base/src/main/java/org/opendaylight/controller/mdsal/it/base/AbstractMdsalTestBase.java
new file mode 100644 (file)
index 0000000..34728a9
--- /dev/null
@@ -0,0 +1,75 @@
+package org.opendaylight.controller.mdsal.it.base;
+
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+
+import java.util.Calendar;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.opendaylight.controller.config.it.base.AbstractConfigTestBase;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.util.Filter;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase implements BindingAwareProvider {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractMdsalTestBase.class);
+    private static final int REGISTRATION_TIMEOUT = 70000;
+    @Inject @Filter(timeout=60000)
+    private BundleContext context;
+    private ProviderContext session = null;
+
+    public ProviderContext getSession() {
+        return session;
+    }
+
+    @Override
+    public void onSessionInitiated(ProviderContext session) {
+        LOG.info("Session Initiated: {}",session);
+        this.session = session;
+    }
+
+    @Override
+    @Before
+    public void setup() throws Exception {
+        super.setup();
+        Calendar start = Calendar.getInstance();
+        ServiceReference<BindingAwareBroker> serviceReference = context.getServiceReference(BindingAwareBroker.class);
+        if(serviceReference == null) {
+            throw new RuntimeException("BindingAwareBroker not found");
+        }
+        BindingAwareBroker broker = context.getService(serviceReference);
+        broker.registerProvider(this);
+        for(int i=0;i<REGISTRATION_TIMEOUT;i++) {
+            if(session !=null) {
+                Calendar stop = Calendar.getInstance();
+                LOG.info("Registered session {} with the MD-SAL after {} ms",
+                        session,
+                        stop.getTimeInMillis() - start.getTimeInMillis());
+                return;
+            } else {
+                Thread.sleep(1);
+            }
+        }
+        throw new RuntimeException("Session not initiated after " + REGISTRATION_TIMEOUT + " ms");
+    }
+
+    @Override
+    public Option getLoggingOption() {
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                        logConfiguration(AbstractMdsalTestBase.class),
+                        LogLevel.INFO.name());
+        option = composite(option, super.getLoggingOption());
+        return option;
+    }
+
+}
diff --git a/opendaylight/md-sal/mdsal-it-parent/pom.xml b/opendaylight/md-sal/mdsal-it-parent/pom.xml
new file mode 100644 (file)
index 0000000..1273077
--- /dev/null
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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">
+
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>mdsal-it-parent</artifactId>
+  <version>1.3.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <properties>
+    <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+    <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+    <karaf.distro.version>1.6.0-SNAPSHOT</karaf.distro.version>
+    <karaf.distro.type>zip</karaf.distro.type>
+    <karaf.keep.unpack>false</karaf.keep.unpack>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>${mdsal.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>mdsal-it-base</artifactId>
+      <version>${mdsal.version}</version>
+    </dependency>
+
+    <!-- Dependencies for pax exam karaf container -->
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-container-karaf</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam-junit4</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>pax-exam</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.ops4j.pax.url</groupId>
+        <artifactId>pax-url-aether</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>javax.inject</groupId>
+        <artifactId>javax.inject</artifactId>
+        <version>1</version>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>org.apache.karaf.features.core</artifactId>
+        <version>${karaf.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+    </dependency>
+
+    <!-- Testing Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+            <configuration>
+              <systemProperties>
+                <property>
+                 <name>karaf.distro.groupId</name>
+                 <value>${karaf.distro.groupId}</value>
+                </property>
+                <property>
+                 <name>karaf.distro.artifactId</name>
+                 <value>${karaf.distro.artifactId}</value>
+                </property>
+                <property>
+                 <name>karaf.distro.version</name>
+                 <value>${karaf.distro.version}</value>
+                </property>
+                <property>
+                 <name>karaf.distro.type</name>
+                 <value>${karaf.distro.type}</value>
+                </property>
+                <property>
+                 <name>karaf.keep.unpack</name>
+                 <value>${karaf.keep.unpack}</value>
+                </property>
+              </systemProperties>
+              <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Needed if you use versionAsInProject() -->
+      <plugin>
+          <groupId>org.apache.servicemix.tooling</groupId>
+          <artifactId>depends-maven-plugin</artifactId>
+          <executions>
+              <execution>
+                  <id>generate-depends-file</id>
+                  <goals>
+                      <goal>generate-depends-file</goal>
+                  </goals>
+              </execution>
+          </executions>
+      </plugin>
+
+      <!-- Copy the Base Test classes into test-classes so they can become available in the karaf container -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+           <id>unpack-karaf-resources</id>
+           <goals>
+            <goal>unpack-dependencies</goal>
+           </goals>
+           <phase>process-test-resources</phase>
+           <configuration>
+            <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
+            <groupId>org.opendaylight.controller</groupId>
+            <includeArtifactIds>config-it-base,mdsal-it-base</includeArtifactIds>
+            <excludes>META-INF\/**</excludes>
+            <ignorePermissions>false</ignorePermissions>
+           </configuration>
+          </execution>
+         </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
index 5cd8df2c1133d09ee6040ac935c1723859704fc4..23676b76817ba08dabf54a5ca59e997deca52074 100644 (file)
     <module>messagebus-spi</module>
     <module>messagebus-impl</module>
     <module>messagebus-config</module>
+
+    <!-- PAX EXAM ITs -->
+    <module>sal-binding-it</module>
+    <module>sal-binding-dom-it</module>
+
+    <!-- IT Base and Parent -->
+    <module>mdsal-it-base</module>
+    <module>mdsal-it-parent</module>
+
   </modules>
 
   <build>