diff options
Diffstat (limited to 'cmso-sonar/src/test')
-rw-r--r-- | cmso-sonar/src/test/java/org/onap/optf/cmso/it/IT_FullIntegrationTest.java | 22 | ||||
-rw-r--r-- | cmso-sonar/src/test/resources/integration.properties | 6 |
2 files changed, 26 insertions, 2 deletions
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 |