Skip to content

Commit 9e0ab1a

Browse files
committed
Added jacoco coverage plugin and set minimum coverage of 50% for build to succeed, beginning to address #160
1 parent 1e00371 commit 9e0ab1a

File tree

5 files changed

+177
-1
lines changed
  • aws-serverless-java-container-jersey
  • aws-serverless-java-container-spark
  • aws-serverless-java-container-spring
  • aws-serverless-java-container-struts2

5 files changed

+177
-1
lines changed

aws-serverless-java-container-jersey/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,50 @@
9292

9393
<build>
9494
<plugins>
95+
<plugin>
96+
<groupId>org.jacoco</groupId>
97+
<artifactId>jacoco-maven-plugin</artifactId>
98+
<version>0.8.1</version>
99+
<configuration>
100+
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
101+
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
102+
</configuration>
103+
<executions>
104+
<execution>
105+
<id>default-prepare-agent</id>
106+
<goals>
107+
<goal>prepare-agent</goal>
108+
</goals>
109+
</execution>
110+
<execution>
111+
<id>jacoco-site</id>
112+
<phase>package</phase>
113+
<goals>
114+
<goal>report</goal>
115+
</goals>
116+
</execution>
117+
<execution>
118+
<id>jacoco-check</id>
119+
<phase>test</phase>
120+
<goals>
121+
<goal>check</goal>
122+
</goals>
123+
<configuration>
124+
<haltOnFailure>true</haltOnFailure>
125+
<rules><rule>
126+
<element>BUNDLE</element>
127+
<limits>
128+
<limit>
129+
<counter>INSTRUCTION</counter>
130+
<value>COVEREDRATIO</value>
131+
<minimum>${jacoco.minCoverage}</minimum>
132+
</limit>
133+
</limits>
134+
</rule></rules>
135+
</configuration>
136+
</execution>
137+
</executions>
138+
</plugin>
95139
<!-- fork JVM before each spring test to make sure we have a clean context -->
96140
<plugin>
97141
<groupId>org.apache.maven.plugins</groupId>

aws-serverless-java-container-spark/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,50 @@
4444

4545
<build>
4646
<plugins>
47+
<plugin>
48+
<groupId>org.jacoco</groupId>
49+
<artifactId>jacoco-maven-plugin</artifactId>
50+
<version>0.8.1</version>
51+
<configuration>
52+
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
53+
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
54+
</configuration>
55+
<executions>
56+
<execution>
57+
<id>default-prepare-agent</id>
58+
<goals>
59+
<goal>prepare-agent</goal>
60+
</goals>
61+
</execution>
62+
<execution>
63+
<id>jacoco-site</id>
64+
<phase>package</phase>
65+
<goals>
66+
<goal>report</goal>
67+
</goals>
68+
</execution>
69+
<execution>
70+
<id>jacoco-check</id>
71+
<phase>test</phase>
72+
<goals>
73+
<goal>check</goal>
74+
</goals>
75+
<configuration>
76+
<haltOnFailure>true</haltOnFailure>
77+
<rules><rule>
78+
<element>BUNDLE</element>
79+
<limits>
80+
<limit>
81+
<counter>INSTRUCTION</counter>
82+
<value>COVEREDRATIO</value>
83+
<minimum>${jacoco.minCoverage}</minimum>
84+
</limit>
85+
</limits>
86+
</rule></rules>
87+
</configuration>
88+
</execution>
89+
</executions>
90+
</plugin>
4791
<!-- fork JVM before each spring test to make sure we have a clean context -->
4892
<plugin>
4993
<groupId>org.apache.maven.plugins</groupId>

aws-serverless-java-container-spring/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,50 @@
160160

161161
<build>
162162
<plugins>
163+
<plugin>
164+
<groupId>org.jacoco</groupId>
165+
<artifactId>jacoco-maven-plugin</artifactId>
166+
<version>0.8.1</version>
167+
<configuration>
168+
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
169+
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
170+
</configuration>
171+
<executions>
172+
<execution>
173+
<id>default-prepare-agent</id>
174+
<goals>
175+
<goal>prepare-agent</goal>
176+
</goals>
177+
</execution>
178+
<execution>
179+
<id>jacoco-site</id>
180+
<phase>package</phase>
181+
<goals>
182+
<goal>report</goal>
183+
</goals>
184+
</execution>
185+
<execution>
186+
<id>jacoco-check</id>
187+
<phase>test</phase>
188+
<goals>
189+
<goal>check</goal>
190+
</goals>
191+
<configuration>
192+
<haltOnFailure>true</haltOnFailure>
193+
<rules><rule>
194+
<element>BUNDLE</element>
195+
<limits>
196+
<limit>
197+
<counter>INSTRUCTION</counter>
198+
<value>COVEREDRATIO</value>
199+
<minimum>${jacoco.minCoverage}</minimum>
200+
</limit>
201+
</limits>
202+
</rule></rules>
203+
</configuration>
204+
</execution>
205+
</executions>
206+
</plugin>
163207
<!-- fork JVM before each spring test to make sure we have a clean context -->
164208
<plugin>
165209
<groupId>org.apache.maven.plugins</groupId>

aws-serverless-java-container-struts2/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,50 @@
9898

9999
<build>
100100
<plugins>
101+
<plugin>
102+
<groupId>org.jacoco</groupId>
103+
<artifactId>jacoco-maven-plugin</artifactId>
104+
<version>0.8.1</version>
105+
<configuration>
106+
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
107+
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
108+
</configuration>
109+
<executions>
110+
<execution>
111+
<id>default-prepare-agent</id>
112+
<goals>
113+
<goal>prepare-agent</goal>
114+
</goals>
115+
</execution>
116+
<execution>
117+
<id>jacoco-site</id>
118+
<phase>package</phase>
119+
<goals>
120+
<goal>report</goal>
121+
</goals>
122+
</execution>
123+
<execution>
124+
<id>jacoco-check</id>
125+
<phase>test</phase>
126+
<goals>
127+
<goal>check</goal>
128+
</goals>
129+
<configuration>
130+
<haltOnFailure>true</haltOnFailure>
131+
<rules><rule>
132+
<element>BUNDLE</element>
133+
<limits>
134+
<limit>
135+
<counter>INSTRUCTION</counter>
136+
<value>COVEREDRATIO</value>
137+
<minimum>${jacoco.minCoverage}</minimum>
138+
</limit>
139+
</limits>
140+
</rule></rules>
141+
</configuration>
142+
</execution>
143+
</executions>
144+
</plugin>
101145
<!-- fork JVM before each struts2 test to make sure we have a clean context -->
102146
<plugin>
103147
<groupId>org.apache.maven.plugins</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</licenses>
4343

4444
<properties>
45-
<jacoco.minCoverage>0.1</jacoco.minCoverage>
45+
<jacoco.minCoverage>0.5</jacoco.minCoverage>
4646
</properties>
4747

4848
<dependencies>

0 commit comments

Comments
 (0)