aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-sonar
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-sonar')
-rw-r--r--cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties2
-rw-r--r--cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties2
-rw-r--r--cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh2
-rw-r--r--cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties8
-rw-r--r--cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties2
-rw-r--r--cmso-sonar/docker/integration/docker-compose.yml8
-rwxr-xr-xcmso-sonar/docker/integration/ete_test.sh16
-rw-r--r--cmso-sonar/pom.xml31
-rw-r--r--cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java22
-rw-r--r--cmso-sonar/src/test/resources/integration.properties6
10 files changed, 78 insertions, 21 deletions
diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties
index fcda8bd..d2f3cb9 100644
--- a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties
+++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/liquibase.properties
@@ -28,7 +28,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###
-spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:3306/optimizer?createDatabaseIfNotExist=true
+spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:${DB_PORT}/optimizer?createDatabaseIfNotExist=true
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=beer
diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
index babc736..9ff8213 100644
--- a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
+++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
@@ -19,7 +19,7 @@
###
### MySQL DB.
-spring.datasource.url=jdbc:mariadb://${DB_HOST}:3306/optimizer
+spring.datasource.url=jdbc:mariadb://${DB_HOST}:${DB_PORT}/optimizer
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=beer
diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh b/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh
index 0db6f1f..b8b8d3b 100644
--- a/cmso-sonar/docker/integration/cmso-optimizer/etc/startJacocoService.sh
+++ b/cmso-sonar/docker/integration/cmso-optimizer/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/optimizer.jacoco.exec,dumponexit=true,jmx=true,append=true,output=file,includes=org.onap.*"
echo "VM_ARGS=${VM_ARGS}"
diff --git a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
index 3602577..ff3dab5 100644
--- a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
+++ b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
-# Copyright 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright 2018 IBM.
+# Copyright ? 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright ? 2018 IBM.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
#
#
# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?);
+# under the Creative Commons License, Attribution 4.0 Intl. (the ???License???);
# you may not use this documentation except in compliance with the License.
# You may obtain a copy of the License at
#
@@ -32,7 +32,7 @@
###
### MySQL DB.
-spring.datasource.url=jdbc:mariadb://${DB_HOST}:3306/cmso
+spring.datasource.url=jdbc:mariadb://${DB_HOST}:${DB_PORT}/cmso
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=beer
diff --git a/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties b/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties
index b8c850e..05baa58 100644
--- a/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties
+++ b/cmso-sonar/docker/integration/cmso-service/etc/config/liquibase.properties
@@ -28,7 +28,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###
-spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:3306/cmso?createDatabaseIfNotExist=true
+spring.datasource.jdbcUrl=jdbc:mariadb://${DB_HOST}:${DB_PORT}/cmso?createDatabaseIfNotExist=true
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=beer
diff --git a/cmso-sonar/docker/integration/docker-compose.yml b/cmso-sonar/docker/integration/docker-compose.yml
index 5c2f173..e0c81f9 100644
--- a/cmso-sonar/docker/integration/docker-compose.yml
+++ b/cmso-sonar/docker/integration/docker-compose.yml
@@ -5,7 +5,7 @@ services:
image: mariadb:10.1.11
volumes:
- "/var/lib/mysql"
- - "../mariadb/conf1:/etc/mysql/conf.d:ro"
+ - "./mariadb/conf1:/etc/mysql/conf.d:ro"
environment:
- MYSQL_ROOT_PASSWORD=beer
ports:
@@ -20,6 +20,7 @@ services:
- mariadb
environment:
- DB_HOST=mariadb
+ - DB_PORT=3306
entrypoint: "bash -x /share/etc/startDbinitService.sh"
db-init-opt:
@@ -31,6 +32,7 @@ services:
- mariadb
environment:
- DB_HOST=mariadb
+ - DB_PORT=3306
entrypoint: "bash -x /share/etc/startDbinitService.sh"
@@ -47,6 +49,7 @@ services:
- "8080:8080"
environment:
- DB_HOST=mariadb
+ - DB_PORT=3306
- OPTIMIZER_URL=http://cmso-optimizer:7997/optimizer/v1/optimize/schedule
- OPTIMIZER_HEALTH_URL=http://cmso-optimizer:7997/optimizer/v1/health?checkInterfaces=true
@@ -83,6 +86,7 @@ services:
- "7997:7997"
environment:
- DB_HOST=mariadb
+ - DB_PORT=3306
- TOPOLOGY_HOST=cmso-topology
- TICKETMGT_HOST=cmso-ticketmgt
@@ -96,7 +100,7 @@ services:
environment:
- GLOBAL_SCHEDULER_URL=http://cmso-service:8080
- GLOBAL_OPTIMIZER_URL=http://cmso-optimizer:7997
- - CMSO_STARTUP_WAIT_TIME=600s
+ - CMSO_STARTUP_WAIT_TIME=20m
- TAGS=-i ete
- OUTPUT=-d /share
working_dir: /opt/cmso-robot
diff --git a/cmso-sonar/docker/integration/ete_test.sh b/cmso-sonar/docker/integration/ete_test.sh
index 0d86fef..5c38fa2 100755
--- a/cmso-sonar/docker/integration/ete_test.sh
+++ b/cmso-sonar/docker/integration/ete_test.sh
@@ -3,28 +3,28 @@ docker-compose up >up.txt 2>&1 &
### Wait for robot to finish
sleep 240
-docker exec cmso-service_cmso-robot_1 ls
+docker exec integration_cmso-robot_1 ls
while [ $? -ne 1 ]; do
sleep 60
- docker exec cmso-service_cmso-robot_1 ls
+ docker exec integration_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
+docker exec integration_cmso-service_1 pkill java
+docker exec integration_cmso-optimizer_1 pkill java
sleep 10
### wait for cmso containers to exit and jacoco files written
-docker exec cmso-service_cmso-service_1 ls
+docker exec integration_cmso-service_1 ls
while [ $? -ne 1 ]; do
sleep 60
- docker exec cmso-service_cmso-service_1 ls
+ docker exec integration_cmso-service_1 ls
done
-docker exec cmso-service_cmso-optimizer_1 ls
+docker exec integration_cmso-optimizer_1 ls
while [ $? -ne 1 ]; do
sleep 60
- docker exec cmso-service_cmso-optimizer_1 ls
+ docker exec integration_cmso-optimizer_1 ls
done
cat up.txt
diff --git a/cmso-sonar/pom.xml b/cmso-sonar/pom.xml
index a46add5..5811df7 100644
--- a/cmso-sonar/pom.xml
+++ b/cmso-sonar/pom.xml
@@ -55,7 +55,7 @@
<docker.skip.push>false</docker.skip.push>
<docker.skip.tag>false</docker.skip.tag>
<skip.staging.artifacts>false</skip.staging.artifacts>
-
+ <skipIntegrationTests>true</skipIntegrationTests>
</properties>
<dependencies>
<dependency>
@@ -88,6 +88,13 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <skipITs>${skipIntegrationTests}</skipITs>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
@@ -98,6 +105,7 @@
<goal>report</goal>
</goals>
<configuration>
+ <skip>${skipIntegrationTests}</skip>
<dataFile>${project.basedir}/target/code-coverage/service.jacoco.exec</dataFile>
<outputDirectory>${project.basedir}/target/site/service-it</outputDirectory>
<includes>
@@ -111,6 +119,27 @@
</excludes>
</configuration>
</execution>
+ <execution>
+ <id>post-integration-test2</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <skip>${skipIntegrationTests}</skip>
+ <dataFile>${project.basedir}/target/code-coverage/optimizer.jacoco.exec</dataFile>
+ <outputDirectory>${project.basedir}/target/site/optimizer-it</outputDirectory>
+ <includes>
+ <include>optimizer/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/gen/**</exclude>
+ <exclude>**/generated-sources/**</exclude>
+ <exclude>**/yang-gen/**</exclude>
+ <exclude>**/pax/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
diff --git a/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java b/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java
index d90d85d..063a9b4 100644
--- a/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java
+++ b/cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java
@@ -48,6 +48,7 @@ public class IT_FullIntegrationTest {
System.out.println("stderr=" + stderr);
copyJacocoFiles();
copyClassFiles();
+ copyForSonar();
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -57,6 +58,27 @@ public class IT_FullIntegrationTest {
}
}
+ private void copyForSonar() throws IOException {
+ String[] jacocoFiles = env.getProperty("copy.jacoco.for.sonar").split(",");
+ for (String jacocoFile : jacocoFiles) {
+ String[] parts = jacocoFile.split("\\|");
+ if (parts.length == 2) {
+ File source = new File(parts[0]);
+ File dest = new File(parts[1]);
+ if (source.exists() && source.isFile() && dest.getParentFile().isDirectory()) {
+ Path srcFile = Paths.get(source.getAbsolutePath());
+ Path dstFile = Paths.get(dest.getAbsolutePath());
+ Files.copy(srcFile, dstFile, StandardCopyOption.REPLACE_EXISTING);
+ } else {
+ System.out.println("Skipping " + jacocoFile);
+ }
+ } else {
+ System.out.println("Skipping " + jacocoFile);
+ }
+
+ }
+ }
+
private void copyClassFiles() throws IOException {
File dest = new File(env.getProperty("jacoco.exec.classes"));
dest.mkdirs();
diff --git a/cmso-sonar/src/test/resources/integration.properties b/cmso-sonar/src/test/resources/integration.properties
index 7d2f84c..48957a0 100644
--- a/cmso-sonar/src/test/resources/integration.properties
+++ b/cmso-sonar/src/test/resources/integration.properties
@@ -1,5 +1,7 @@
base.path=./
jacoco.exec.dest=target/code-coverage
jacoco.exec.classes=target/classes
-source.classes.folders=service|../cmso-service/target/classes,optimizer
-jacoco.exec.source.files=docker/integration/cmso-service/logs/service.jacoco.exec,docker/integration/cmso-service/logs/optimizer.jacoco.exec \ No newline at end of file
+source.classes.folders=service|../cmso-service/target/classes,optimizer|../cmso-optimizer/target/classes
+jacoco.exec.source.files=docker/integration/cmso-service/logs/service.jacoco.exec,docker/integration/cmso-optimizer/logs/optimizer.jacoco.exec
+
+copy.jacoco.for.sonar=docker/integration/cmso-service/logs/service.jacoco.exec|../cmso-service/target/jacoco-it.exec,docker/integration/cmso-optimizer/logs/optimizer.jacoco.exec|../cmso-optimizer/target/jacoco-it.exec \ No newline at end of file