From 72949f939e958e49292af892f1556117209d4904 Mon Sep 17 00:00:00 2001 From: Eugene Platonov Date: Mon, 18 Dec 2023 21:52:01 -0500 Subject: [PATCH] Add `aggregate` and `aggregateOnly` tests --- src/it/test_aggregate/invoker.properties | 1 + src/it/test_aggregate/module01/pom.xml | 16 +++++ .../src/main/scala/pkg01/HelloService1.scala | 12 ++++ .../test/scala/pkg01/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate/module02/pom.xml | 16 +++++ .../src/main/scala/pkg02/HelloService2.scala | 12 ++++ .../test/scala/pkg02/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate/module03/pom.xml | 16 +++++ .../src/main/scala/pkg03/HelloService3.scala | 12 ++++ .../test/scala/pkg03/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate/pom.xml | 66 +++++++++++++++++++ src/it/test_aggregate/validate.groovy | 32 +++++++++ src/it/test_aggregate_only/invoker.properties | 1 + src/it/test_aggregate_only/module01/pom.xml | 16 +++++ .../src/main/scala/pkg01/HelloService1.scala | 12 ++++ .../test/scala/pkg01/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate_only/module02/pom.xml | 16 +++++ .../src/main/scala/pkg02/HelloService2.scala | 12 ++++ .../test/scala/pkg02/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate_only/module03/pom.xml | 16 +++++ .../src/main/scala/pkg03/HelloService3.scala | 12 ++++ .../test/scala/pkg03/HelloServiceTest.scala | 14 ++++ src/it/test_aggregate_only/pom.xml | 66 +++++++++++++++++++ src/it/test_aggregate_only/validate.groovy | 32 +++++++++ 24 files changed, 450 insertions(+) create mode 100644 src/it/test_aggregate/invoker.properties create mode 100644 src/it/test_aggregate/module01/pom.xml create mode 100644 src/it/test_aggregate/module01/src/main/scala/pkg01/HelloService1.scala create mode 100644 src/it/test_aggregate/module01/src/test/scala/pkg01/HelloServiceTest.scala create mode 100644 src/it/test_aggregate/module02/pom.xml create mode 100644 src/it/test_aggregate/module02/src/main/scala/pkg02/HelloService2.scala create mode 100644 src/it/test_aggregate/module02/src/test/scala/pkg02/HelloServiceTest.scala create mode 100644 src/it/test_aggregate/module03/pom.xml create mode 100644 src/it/test_aggregate/module03/src/main/scala/pkg03/HelloService3.scala create mode 100644 src/it/test_aggregate/module03/src/test/scala/pkg03/HelloServiceTest.scala create mode 100644 src/it/test_aggregate/pom.xml create mode 100644 src/it/test_aggregate/validate.groovy create mode 100644 src/it/test_aggregate_only/invoker.properties create mode 100644 src/it/test_aggregate_only/module01/pom.xml create mode 100644 src/it/test_aggregate_only/module01/src/main/scala/pkg01/HelloService1.scala create mode 100644 src/it/test_aggregate_only/module01/src/test/scala/pkg01/HelloServiceTest.scala create mode 100644 src/it/test_aggregate_only/module02/pom.xml create mode 100644 src/it/test_aggregate_only/module02/src/main/scala/pkg02/HelloService2.scala create mode 100644 src/it/test_aggregate_only/module02/src/test/scala/pkg02/HelloServiceTest.scala create mode 100644 src/it/test_aggregate_only/module03/pom.xml create mode 100644 src/it/test_aggregate_only/module03/src/main/scala/pkg03/HelloService3.scala create mode 100644 src/it/test_aggregate_only/module03/src/test/scala/pkg03/HelloServiceTest.scala create mode 100644 src/it/test_aggregate_only/pom.xml create mode 100644 src/it/test_aggregate_only/validate.groovy diff --git a/src/it/test_aggregate/invoker.properties b/src/it/test_aggregate/invoker.properties new file mode 100644 index 00000000..3e51a5a6 --- /dev/null +++ b/src/it/test_aggregate/invoker.properties @@ -0,0 +1 @@ +invoker.goals=clean verify site -e -ntp \ No newline at end of file diff --git a/src/it/test_aggregate/module01/pom.xml b/src/it/test_aggregate/module01/pom.xml new file mode 100644 index 00000000..c499a21b --- /dev/null +++ b/src/it/test_aggregate/module01/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module01 + Test SCoverage Aggregation : Module 1 + + \ No newline at end of file diff --git a/src/it/test_aggregate/module01/src/main/scala/pkg01/HelloService1.scala b/src/it/test_aggregate/module01/src/main/scala/pkg01/HelloService1.scala new file mode 100644 index 00000000..9d7c7380 --- /dev/null +++ b/src/it/test_aggregate/module01/src/main/scala/pkg01/HelloService1.scala @@ -0,0 +1,12 @@ +package pkg01 + +class HelloService1 +{ + def hello = + { + "Hello from module 1" + } + +} + +object HelloService1 extends HelloService1 diff --git a/src/it/test_aggregate/module01/src/test/scala/pkg01/HelloServiceTest.scala b/src/it/test_aggregate/module01/src/test/scala/pkg01/HelloServiceTest.scala new file mode 100644 index 00000000..9cac7025 --- /dev/null +++ b/src/it/test_aggregate/module01/src/test/scala/pkg01/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg01 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test1() + { + assertEquals("Hello from module 1", HelloService1.hello) + } + +} diff --git a/src/it/test_aggregate/module02/pom.xml b/src/it/test_aggregate/module02/pom.xml new file mode 100644 index 00000000..3b246a81 --- /dev/null +++ b/src/it/test_aggregate/module02/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module02 + Test SCoverage Aggregation : Module 2 + + \ No newline at end of file diff --git a/src/it/test_aggregate/module02/src/main/scala/pkg02/HelloService2.scala b/src/it/test_aggregate/module02/src/main/scala/pkg02/HelloService2.scala new file mode 100644 index 00000000..d1da6062 --- /dev/null +++ b/src/it/test_aggregate/module02/src/main/scala/pkg02/HelloService2.scala @@ -0,0 +1,12 @@ +package pkg02 + +class HelloService2 +{ + def hello = + { + "Hello from module 2" + } + +} + +object HelloService2 extends HelloService2 diff --git a/src/it/test_aggregate/module02/src/test/scala/pkg02/HelloServiceTest.scala b/src/it/test_aggregate/module02/src/test/scala/pkg02/HelloServiceTest.scala new file mode 100644 index 00000000..f57c4d37 --- /dev/null +++ b/src/it/test_aggregate/module02/src/test/scala/pkg02/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg02 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test2() + { + assertEquals("Hello from module 2", HelloService2.hello) + } + +} diff --git a/src/it/test_aggregate/module03/pom.xml b/src/it/test_aggregate/module03/pom.xml new file mode 100644 index 00000000..469ee89f --- /dev/null +++ b/src/it/test_aggregate/module03/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module03 + Test SCoverage Aggregation : Module 3 + + \ No newline at end of file diff --git a/src/it/test_aggregate/module03/src/main/scala/pkg03/HelloService3.scala b/src/it/test_aggregate/module03/src/main/scala/pkg03/HelloService3.scala new file mode 100644 index 00000000..c727afce --- /dev/null +++ b/src/it/test_aggregate/module03/src/main/scala/pkg03/HelloService3.scala @@ -0,0 +1,12 @@ +package pkg03 + +class HelloService3 +{ + def hello = + { + "Hello from module 3" + } + +} + +object HelloService3 extends HelloService3 diff --git a/src/it/test_aggregate/module03/src/test/scala/pkg03/HelloServiceTest.scala b/src/it/test_aggregate/module03/src/test/scala/pkg03/HelloServiceTest.scala new file mode 100644 index 00000000..e949c1aa --- /dev/null +++ b/src/it/test_aggregate/module03/src/test/scala/pkg03/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg03 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test3() + { + assertEquals("Hello from module 3", HelloService3.hello) + } + +} diff --git a/src/it/test_aggregate/pom.xml b/src/it/test_aggregate/pom.xml new file mode 100644 index 00000000..e03b6539 --- /dev/null +++ b/src/it/test_aggregate/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + + it.scoverage-maven-plugin + integration_tests_parent + 1.0-SNAPSHOT + ../integration_tests_parent/pom.xml + + + test_aggregate + 1.0-SNAPSHOT + pom + Test Scoverage aggregation + Test Scoverage aggregation + + + 2.13 + 12 + + + + module01 + module02 + module03 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + net.alchim31.maven + scala-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + @project.groupId@ + @project.artifactId@ + + true + + + + + + + + + @project.groupId@ + @project.artifactId@ + + true + + + + + diff --git a/src/it/test_aggregate/validate.groovy b/src/it/test_aggregate/validate.groovy new file mode 100644 index 00000000..8e15511d --- /dev/null +++ b/src/it/test_aggregate/validate.groovy @@ -0,0 +1,32 @@ +try { + + def module1ScoverageFile = new File(basedir, "module01/target/scoverage.xml") + assert module1ScoverageFile.exists() + + def module1ReportFile = new File(basedir, "module01/target/site/scoverage/index.html") + assert module1ReportFile.exists() + + def module2ScoverageFile = new File(basedir, "module02/target/scoverage.xml") + assert module2ScoverageFile.exists() + + def module2ReportFile = new File(basedir, "module02/target/site/scoverage/index.html") + assert module2ReportFile.exists() + + def module3ScoverageFile = new File(basedir, "module03/target/scoverage.xml") + assert module3ScoverageFile.exists() + + def module3ReportFile = new File(basedir, "module03/target/site/scoverage/index.html") + assert module3ReportFile.exists() + + def aggregatedScoverageFile = new File(basedir, "target/scoverage.xml") + assert aggregatedScoverageFile.exists() + + def aggregatedReportFile = new File(basedir, "target/site/scoverage/index.html") + assert aggregatedReportFile.exists() + + return true + +} catch (Throwable e) { + e.printStackTrace() + return false +} diff --git a/src/it/test_aggregate_only/invoker.properties b/src/it/test_aggregate_only/invoker.properties new file mode 100644 index 00000000..3e51a5a6 --- /dev/null +++ b/src/it/test_aggregate_only/invoker.properties @@ -0,0 +1 @@ +invoker.goals=clean verify site -e -ntp \ No newline at end of file diff --git a/src/it/test_aggregate_only/module01/pom.xml b/src/it/test_aggregate_only/module01/pom.xml new file mode 100644 index 00000000..17eeb429 --- /dev/null +++ b/src/it/test_aggregate_only/module01/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate_only + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module01 + Test SCoverage Only Aggregation : Module 1 + + \ No newline at end of file diff --git a/src/it/test_aggregate_only/module01/src/main/scala/pkg01/HelloService1.scala b/src/it/test_aggregate_only/module01/src/main/scala/pkg01/HelloService1.scala new file mode 100644 index 00000000..9d7c7380 --- /dev/null +++ b/src/it/test_aggregate_only/module01/src/main/scala/pkg01/HelloService1.scala @@ -0,0 +1,12 @@ +package pkg01 + +class HelloService1 +{ + def hello = + { + "Hello from module 1" + } + +} + +object HelloService1 extends HelloService1 diff --git a/src/it/test_aggregate_only/module01/src/test/scala/pkg01/HelloServiceTest.scala b/src/it/test_aggregate_only/module01/src/test/scala/pkg01/HelloServiceTest.scala new file mode 100644 index 00000000..9cac7025 --- /dev/null +++ b/src/it/test_aggregate_only/module01/src/test/scala/pkg01/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg01 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test1() + { + assertEquals("Hello from module 1", HelloService1.hello) + } + +} diff --git a/src/it/test_aggregate_only/module02/pom.xml b/src/it/test_aggregate_only/module02/pom.xml new file mode 100644 index 00000000..7b83aa56 --- /dev/null +++ b/src/it/test_aggregate_only/module02/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate_only + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module02 + Test SCoverage Only Aggregation : Module 2 + + \ No newline at end of file diff --git a/src/it/test_aggregate_only/module02/src/main/scala/pkg02/HelloService2.scala b/src/it/test_aggregate_only/module02/src/main/scala/pkg02/HelloService2.scala new file mode 100644 index 00000000..d1da6062 --- /dev/null +++ b/src/it/test_aggregate_only/module02/src/main/scala/pkg02/HelloService2.scala @@ -0,0 +1,12 @@ +package pkg02 + +class HelloService2 +{ + def hello = + { + "Hello from module 2" + } + +} + +object HelloService2 extends HelloService2 diff --git a/src/it/test_aggregate_only/module02/src/test/scala/pkg02/HelloServiceTest.scala b/src/it/test_aggregate_only/module02/src/test/scala/pkg02/HelloServiceTest.scala new file mode 100644 index 00000000..f57c4d37 --- /dev/null +++ b/src/it/test_aggregate_only/module02/src/test/scala/pkg02/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg02 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test2() + { + assertEquals("Hello from module 2", HelloService2.hello) + } + +} diff --git a/src/it/test_aggregate_only/module03/pom.xml b/src/it/test_aggregate_only/module03/pom.xml new file mode 100644 index 00000000..ea83a546 --- /dev/null +++ b/src/it/test_aggregate_only/module03/pom.xml @@ -0,0 +1,16 @@ + + + + + + it.scoverage-maven-plugin + test_aggregate_only + 1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + module03 + Test SCoverage Only Aggregation : Module 3 + + \ No newline at end of file diff --git a/src/it/test_aggregate_only/module03/src/main/scala/pkg03/HelloService3.scala b/src/it/test_aggregate_only/module03/src/main/scala/pkg03/HelloService3.scala new file mode 100644 index 00000000..c727afce --- /dev/null +++ b/src/it/test_aggregate_only/module03/src/main/scala/pkg03/HelloService3.scala @@ -0,0 +1,12 @@ +package pkg03 + +class HelloService3 +{ + def hello = + { + "Hello from module 3" + } + +} + +object HelloService3 extends HelloService3 diff --git a/src/it/test_aggregate_only/module03/src/test/scala/pkg03/HelloServiceTest.scala b/src/it/test_aggregate_only/module03/src/test/scala/pkg03/HelloServiceTest.scala new file mode 100644 index 00000000..e949c1aa --- /dev/null +++ b/src/it/test_aggregate_only/module03/src/test/scala/pkg03/HelloServiceTest.scala @@ -0,0 +1,14 @@ +package pkg03 + +import org.junit.Test; +import org.junit.Assert.assertEquals + +class HelloServiceTest +{ + @Test + def test3() + { + assertEquals("Hello from module 3", HelloService3.hello) + } + +} diff --git a/src/it/test_aggregate_only/pom.xml b/src/it/test_aggregate_only/pom.xml new file mode 100644 index 00000000..c4e038fd --- /dev/null +++ b/src/it/test_aggregate_only/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + + it.scoverage-maven-plugin + integration_tests_parent + 1.0-SNAPSHOT + ../integration_tests_parent/pom.xml + + + test_aggregate_only + 1.0-SNAPSHOT + pom + Test Scoverage only aggregation + Test Scoverage only aggregation + + + 2.13 + 12 + + + + module01 + module02 + module03 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + net.alchim31.maven + scala-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + @project.groupId@ + @project.artifactId@ + + true + + + + + + + + + @project.groupId@ + @project.artifactId@ + + true + + + + + diff --git a/src/it/test_aggregate_only/validate.groovy b/src/it/test_aggregate_only/validate.groovy new file mode 100644 index 00000000..7342801d --- /dev/null +++ b/src/it/test_aggregate_only/validate.groovy @@ -0,0 +1,32 @@ +try { + + def module1ScoverageFile = new File(basedir, "module01/target/scoverage.xml") + assert !module1ScoverageFile.exists() + + def module1ReportFile = new File(basedir, "module01/target/site/scoverage/index.html") + assert !module1ReportFile.exists() + + def module2ScoverageFile = new File(basedir, "module02/target/scoverage.xml") + assert !module2ScoverageFile.exists() + + def module2ReportFile = new File(basedir, "module02/target/site/scoverage/index.html") + assert !module2ReportFile.exists() + + def module3ScoverageFile = new File(basedir, "module03/target/scoverage.xml") + assert !module3ScoverageFile.exists() + + def module3ReportFile = new File(basedir, "module03/target/site/scoverage/index.html") + assert !module3ReportFile.exists() + + def aggregatedScoverageFile = new File(basedir, "target/scoverage.xml") + assert aggregatedScoverageFile.exists() + + def aggregatedReportFile = new File(basedir, "target/site/scoverage/index.html") + assert aggregatedReportFile.exists() + + return true + +} catch (Throwable e) { + e.printStackTrace() + return false +}