Changes to startup archetype to incorporate IT testing 59/24559/7
authorEd Warnicke <hagbard@gmail.com>
Sat, 25 Jul 2015 21:42:37 +0000 (14:42 -0700)
committerEd Warnicke <hagbard@gmail.com>
Wed, 29 Jul 2015 17:51:02 +0000 (10:51 -0700)
Note: The onSessionInitiated unit test can't every really work in a
realistic system because of the absence of an MD-SAL to work with,
thus its deleted so people can build real MD-SAL based Providers.

Change-Id: Ie635752b6e2eec8ce1c65b737871be8c0b6bd870
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
opendaylight/archetypes/opendaylight-startup/src/main/resources/META-INF/maven/archetype-metadata.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

index 6eab884..7ad629b 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>
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..43ccdb8
--- /dev/null
@@ -0,0 +1,74 @@
+#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.opendaylight.hello.HelloIT;
+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);
+    }
+}
\ No newline at end of file
index 96a66e0..7cf4270 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 7d57dfb..1d8a63b 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>