summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Varma <vv8305@att.com>2019-04-15 12:51:07 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-15 12:51:07 +0000
commit669a2966bc75af74e5bb1879fe12d7a4df5001a3 (patch)
tree5fd5b4b8886fba7b9be2fafb5bfd3753ce83b3ec
parenteb2a20678582c568346b0f3e75254b511d0379c3 (diff)
parenta3da541f9914a13e644f638f02b4f44b64028332 (diff)
Merge "Add robot integration test"
-rw-r--r--cmso-optimizer/pom.xml39
-rw-r--r--cmso-robot/docker/cmso-service/cmso-service/etc/startJacocoService.sh2
-rwxr-xr-xcmso-robot/docker/cmso-service/ete_test.sh18
-rw-r--r--cmso-robot/pom.xml34
-rw-r--r--cmso-robot/robot/testsuites/AAAwait_for_server.robot2
-rw-r--r--cmso-robot/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java131
-rw-r--r--cmso-robot/src/test/resources/integration.properties5
-rw-r--r--cmso-service/pom.xml35
-rw-r--r--cmso-ticketmgt/pom.xml37
-rw-r--r--cmso-topology/pom.xml39
10 files changed, 182 insertions, 160 deletions
diff --git a/cmso-optimizer/pom.xml b/cmso-optimizer/pom.xml
index fa27b8e..80a7805 100644
--- a/cmso-optimizer/pom.xml
+++ b/cmso-optimizer/pom.xml
@@ -42,7 +42,6 @@
<java.version>1.8</java.version>
<eelf.version>1.0.0</eelf.version>
- <pact.version>3.3.9</pact.version>
<spring.version>5.0.10.RELEASE</spring.version>
<spring.boot.version>2.1.3.RELEASE</spring.boot.version>
<swagger.core.version>2.0.0</swagger.core.version>
@@ -160,10 +159,6 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
@@ -284,36 +279,6 @@
<finalName>cmso-optimizer</finalName>
<plugins>
<plugin>
- <groupId>au.com.dius</groupId>
- <artifactId>pact-jvm-provider-maven_2.11</artifactId>
- <version>${pact.version}</version>
- <configuration>
- <!--pactBrokerUrl,user name,password and project version required only
- for consumer -->
- <pactBrokerUrl>${BROKER_URL}</pactBrokerUrl>
- <pactBrokerUsername>pactadmin</pactBrokerUsername>
- <pactBrokerPassword>pactadmin</pactBrokerPassword>
- <projectVersion>1.0.0</projectVersion>
- <!-- service provider required only for producer -->
- <serviceProviders>
- <serviceProvider>
- <name>core</name>
- <protocol>http</protocol>
- <host>${APP_URL}</host>
- <port>${APP_PORT}</port>
- <path>/</path>
- <pactBroker>
- <url>${BROKER_URL}</url>
- <authentication>
- <username>pactadmin</username>
- <password>pactadmin</password>
- </authentication>
- </pactBroker>
- </serviceProvider>
- </serviceProviders>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -361,10 +326,6 @@
</executions>
</plugin>
<plugin>
- <artifactId>exec-maven-plugin</artifactId>
- <groupId>org.codehaus.mojo</groupId>
- </plugin>
- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
diff --git a/cmso-robot/docker/cmso-service/cmso-service/etc/startJacocoService.sh b/cmso-robot/docker/cmso-service/cmso-service/etc/startJacocoService.sh
index 0db6f1f..5d65a7f 100644
--- a/cmso-robot/docker/cmso-service/cmso-service/etc/startJacocoService.sh
+++ b/cmso-robot/docker/cmso-service/cmso-service/etc/startJacocoService.sh
@@ -7,7 +7,7 @@ unzip org.jacoco.agent-0.8.2.jar
cp org.jacoco.agent-0.8.2/jacocoagent.jar .
ls -l
-VM_ARGS="${VM_ARGS} -javaagent:./jacocoagent.jar=destfile=/share/logs/jacoco.exec,dumponexit=true,jmx=true,append=true,output=file,includes=org.onap.optf.cmso.*"
+VM_ARGS="${VM_ARGS} -javaagent:./jacocoagent.jar=destfile=/share/logs/service.jacoco.exec,dumponexit=true,jmx=true,append=true,output=file,includes=org.onap.*"
echo "VM_ARGS=${VM_ARGS}"
diff --git a/cmso-robot/docker/cmso-service/ete_test.sh b/cmso-robot/docker/cmso-service/ete_test.sh
index cd77ba5..fce07eb 100755
--- a/cmso-robot/docker/cmso-service/ete_test.sh
+++ b/cmso-robot/docker/cmso-service/ete_test.sh
@@ -3,23 +3,31 @@ docker-compose up >up.txt 2>&1 &
### Wait for robot to finish
sleep 60
-docker exec -it cmso-service_cmso-robot_1 ls
+docker exec cmso-service_cmso-robot_1 ls
while [ $? -ne 1 ]; do
sleep 60
- docker exec -it cmso-service_cmso-robot_1 ls
+ docker exec cmso-service_cmso-robot_1 ls
done
### Shut down java with to give time to write the jacoco_exec file
docker exec cmso-service_cmso-service_1 pkill java
+docker exec cmso-service_cmso-optimizer_1 pkill java
sleep 10
-### wait for cmso-service container to exit
-docker exec -it cmso-service_cmso-service_1 ls
+### wait for cmso containers to exit and jacoco files written
+docker exec cmso-service_cmso-service_1 ls
while [ $? -ne 1 ]; do
sleep 60
- docker exec -it cmso-service_cmso-service_1 ls
+ docker exec cmso-service_cmso-service_1 ls
done
+docker exec cmso-service_cmso-optimizer_1 ls
+while [ $? -ne 1 ]; do
+ sleep 60
+ docker exec cmso-service_cmso-optimizer_1 ls
+done
+
+
docker ps -a
docker-compose down
docker ps -a
diff --git a/cmso-robot/pom.xml b/cmso-robot/pom.xml
index 37ae95b..89c6019 100644
--- a/cmso-robot/pom.xml
+++ b/cmso-robot/pom.xml
@@ -57,7 +57,18 @@
<skip.staging.artifacts>false</skip.staging.artifacts>
</properties>
-
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
@@ -130,12 +141,27 @@
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
- <id>disable</id>
- <phase>none</phase>
+ <id>post-integration-test</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <dataFile>${project.basedir}/target/code-coverage/service.jacoco.exec</dataFile>
+ <outputDirectory>${project.basedir}/target/site/jacoco-it</outputDirectory>
+ <includes>
+ <include>service/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/gen/**</exclude>
+ <exclude>**/generated-sources/**</exclude>
+ <exclude>**/yang-gen/**</exclude>
+ <exclude>**/pax/**</exclude>
+ </excludes>
+ </configuration>
</execution>
</executions>
</plugin>
-
</plugins>
<finalName>optf-cmso-robot</finalName>
</build>
diff --git a/cmso-robot/robot/testsuites/AAAwait_for_server.robot b/cmso-robot/robot/testsuites/AAAwait_for_server.robot
index 7794602..537035a 100644
--- a/cmso-robot/robot/testsuites/AAAwait_for_server.robot
+++ b/cmso-robot/robot/testsuites/AAAwait_for_server.robot
@@ -9,7 +9,7 @@ Resource ../resources/scheduler_common.robot
*** Test Cases ***
Wait For Healthy CMSO
- [Tags] ete
+ [Tags] ete opt_validation
Wait Until Keyword Succeeds ${CMSO_STARTUP_WAIT_TIME} 30s CMSO Health Check
*** Keywords ***
diff --git a/cmso-robot/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java b/cmso-robot/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java
new file mode 100644
index 0000000..53aa8d6
--- /dev/null
+++ b/cmso-robot/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java
@@ -0,0 +1,131 @@
+/*
+ * ============LICENSE_START============================================== Copyright (c) 2019 AT&T
+ * Intellectual Property. =======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License. ============LICENSE_END=================================================
+ */
+
+package org.onap.optf.cmso.it;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+
+public class IT_FullIntegrationTest {
+
+ private Properties env = new Properties();
+
+ @Test
+ public void runTest() throws IOException {
+ InputStream is = new FileInputStream(new File("src/test/resources/integration.properties"));
+ env.load(is);
+ Process process = null;
+ try {
+ ProcessBuilder processBuilder = buildCommand();
+ process = processBuilder.start();
+ // debug.debug("engine command=" + commandString);
+ String stdout = IOUtils.toString(process.getInputStream(), "UTF-8");
+ String stderr = IOUtils.toString(process.getErrorStream(), "UTF-8");
+ System.out.println("stdout=" + stdout);
+ System.out.println("stderr=" + stderr);
+ copyJacocoFiles();
+ copyClassFiles();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (process.isAlive()) {
+ process.destroyForcibly();
+ }
+ }
+ }
+
+ private void copyClassFiles() throws IOException {
+ File dest = new File(env.getProperty("jacoco.exec.classes"));
+ dest.mkdirs();
+ if (dest.isDirectory()) {
+
+ String[] sourceFolders = env.getProperty("source.classes.folders").split(",");
+ for (String source : sourceFolders) {
+ String[] parts = source.split("\\|");
+ if (parts.length == 2) {
+ Path destPath = Paths.get(dest.getAbsolutePath(), parts[0]);
+ destPath.toFile().mkdirs();
+ File sourceFolder = new File(parts[1]);
+ if (sourceFolder.exists() && sourceFolder.isDirectory()) {
+ Path srcPath = Paths.get(sourceFolder.getAbsolutePath());
+ copyFolder(srcPath, destPath);
+ }
+ }
+ }
+ }
+ }
+
+ private void copyJacocoFiles() throws IOException {
+ File dest = new File(env.getProperty("jacoco.exec.dest"));
+ dest.mkdirs();
+ if (dest.isDirectory()) {
+
+ String[] sourceFiles = env.getProperty("jacoco.exec.source.files").split(",");
+ for (String source : sourceFiles) {
+ File sourceFile = new File(source);
+ if (sourceFile.exists()) {
+ Path destPath = Paths.get(dest.getAbsolutePath(), sourceFile.getName());
+ Path srcPath = Paths.get(sourceFile.getAbsolutePath());
+ Files.copy(srcPath, destPath, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+ }
+ }
+
+ private static void copyFolder(Path src, Path dest) {
+ try {
+ Files.walk(src).forEach(s -> {
+ try {
+ Path d = dest.resolve(src.relativize(s));
+ if (Files.isDirectory(s)) {
+ if (!Files.exists(d))
+ Files.createDirectory(d);
+ return;
+ }
+ Files.copy(s, d);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private ProcessBuilder buildCommand() {
+ ProcessBuilder processBuilder = new ProcessBuilder();
+ List<String> command = new ArrayList<>();
+ String basepath = env.getProperty("base.path", "./");
+ File workdir = new File(basepath + "docker/cmso-service");
+ command.add("/bin/bash");
+ command.add("-x");
+ command.add(basepath + "ete_test.sh");
+ Map<String, String> environment = processBuilder.environment();
+ processBuilder.directory(workdir);
+ processBuilder.command(command);
+ return processBuilder;
+ }
+}
diff --git a/cmso-robot/src/test/resources/integration.properties b/cmso-robot/src/test/resources/integration.properties
new file mode 100644
index 0000000..8fcc7b5
--- /dev/null
+++ b/cmso-robot/src/test/resources/integration.properties
@@ -0,0 +1,5 @@
+base.path=./
+jacoco.exec.dest=target/code-coverage
+jacoco.exec.classes=target/classes
+source.classes.folders=service|../cmso-service/target/classes
+jacoco.exec.source.files=docker/cmso-service/cmso-service/logs/service.jacoco.exec \ No newline at end of file
diff --git a/cmso-service/pom.xml b/cmso-service/pom.xml
index 4081cc3..f4539af 100644
--- a/cmso-service/pom.xml
+++ b/cmso-service/pom.xml
@@ -53,7 +53,6 @@
<java.version>1.8</java.version>
<eelf.version>1.0.0</eelf.version>
- <pact.version>3.3.9</pact.version>
<spring.version>5.0.10.RELEASE</spring.version>
<spring.boot.version>2.1.3.RELEASE</spring.boot.version>
<swagger.core.version>2.0.0</swagger.core.version>
@@ -289,36 +288,6 @@
<finalName>cmso-service</finalName>
<plugins>
<plugin>
- <groupId>au.com.dius</groupId>
- <artifactId>pact-jvm-provider-maven_2.11</artifactId>
- <version>${pact.version}</version>
- <configuration>
- <!--pactBrokerUrl,user name,password and project version required only
- for consumer -->
- <pactBrokerUrl>${BROKER_URL}</pactBrokerUrl>
- <pactBrokerUsername>pactadmin</pactBrokerUsername>
- <pactBrokerPassword>pactadmin</pactBrokerPassword>
- <projectVersion>1.0.0</projectVersion>
- <!-- service provider required only for producer -->
- <serviceProviders>
- <serviceProvider>
- <name>core</name>
- <protocol>http</protocol>
- <host>${APP_URL}</host>
- <port>${APP_PORT}</port>
- <path>/</path>
- <pactBroker>
- <url>${BROKER_URL}</url>
- <authentication>
- <username>pactadmin</username>
- <password>pactadmin</password>
- </authentication>
- </pactBroker>
- </serviceProvider>
- </serviceProviders>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -366,10 +335,6 @@
</executions>
</plugin>
<plugin>
- <artifactId>exec-maven-plugin</artifactId>
- <groupId>org.codehaus.mojo</groupId>
- </plugin>
- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
diff --git a/cmso-ticketmgt/pom.xml b/cmso-ticketmgt/pom.xml
index 1274360..44b75fc 100644
--- a/cmso-ticketmgt/pom.xml
+++ b/cmso-ticketmgt/pom.xml
@@ -22,7 +22,7 @@
<version>1.0.1-SNAPSHOT</version>
</parent>
- <groupId>org.onap.optf.cmso.tcketmgt</groupId>
+ <groupId>org.onap.optf.cmso.ticketmgt</groupId>
<artifactId>cmso-ticketmgt</artifactId>
<packaging>jar</packaging>
@@ -42,7 +42,6 @@
<java.version>1.8</java.version>
<eelf.version>1.0.0</eelf.version>
- <pact.version>3.3.9</pact.version>
<spring.version>5.0.10.RELEASE</spring.version>
<spring.boot.version>2.1.0.RELEASE</spring.boot.version>
<swagger.core.version>2.0.0</swagger.core.version>
@@ -273,36 +272,6 @@
<finalName>cmso-ticketmgt</finalName>
<plugins>
<plugin>
- <groupId>au.com.dius</groupId>
- <artifactId>pact-jvm-provider-maven_2.11</artifactId>
- <version>${pact.version}</version>
- <configuration>
- <!--pactBrokerUrl,user name,password and project version required only
- for consumer -->
- <pactBrokerUrl>${BROKER_URL}</pactBrokerUrl>
- <pactBrokerUsername>pactadmin</pactBrokerUsername>
- <pactBrokerPassword>pactadmin</pactBrokerPassword>
- <projectVersion>1.0.0</projectVersion>
- <!-- service provider required only for producer -->
- <serviceProviders>
- <serviceProvider>
- <name>core</name>
- <protocol>http</protocol>
- <host>${APP_URL}</host>
- <port>${APP_PORT}</port>
- <path>/</path>
- <pactBroker>
- <url>${BROKER_URL}</url>
- <authentication>
- <username>pactadmin</username>
- <password>pactadmin</password>
- </authentication>
- </pactBroker>
- </serviceProvider>
- </serviceProviders>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -350,10 +319,6 @@
</executions>
</plugin>
<plugin>
- <artifactId>exec-maven-plugin</artifactId>
- <groupId>org.codehaus.mojo</groupId>
- </plugin>
- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
diff --git a/cmso-topology/pom.xml b/cmso-topology/pom.xml
index 553fe91..388016d 100644
--- a/cmso-topology/pom.xml
+++ b/cmso-topology/pom.xml
@@ -42,7 +42,6 @@
<java.version>1.8</java.version>
<eelf.version>1.0.0</eelf.version>
- <pact.version>3.3.9</pact.version>
<spring.version>5.0.10.RELEASE</spring.version>
<spring.boot.version>2.1.3.RELEASE</spring.boot.version>
<swagger.core.version>2.0.0</swagger.core.version>
@@ -151,10 +150,6 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
@@ -269,36 +264,6 @@
<finalName>cmso-topology</finalName>
<plugins>
<plugin>
- <groupId>au.com.dius</groupId>
- <artifactId>pact-jvm-provider-maven_2.11</artifactId>
- <version>${pact.version}</version>
- <configuration>
- <!--pactBrokerUrl,user name,password and project version required only
- for consumer -->
- <pactBrokerUrl>${BROKER_URL}</pactBrokerUrl>
- <pactBrokerUsername>pactadmin</pactBrokerUsername>
- <pactBrokerPassword>pactadmin</pactBrokerPassword>
- <projectVersion>1.0.0</projectVersion>
- <!-- service provider required only for producer -->
- <serviceProviders>
- <serviceProvider>
- <name>core</name>
- <protocol>http</protocol>
- <host>${APP_URL}</host>
- <port>${APP_PORT}</port>
- <path>/</path>
- <pactBroker>
- <url>${BROKER_URL}</url>
- <authentication>
- <username>pactadmin</username>
- <password>pactadmin</password>
- </authentication>
- </pactBroker>
- </serviceProvider>
- </serviceProviders>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -346,10 +311,6 @@
</executions>
</plugin>
<plugin>
- <artifactId>exec-maven-plugin</artifactId>
- <groupId>org.codehaus.mojo</groupId>
- </plugin>
- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>