This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 1dce9f3 Adding jacoco support + sonarqube instructions (even though
test coverage still does not take ITCase into account)
1dce9f3 is described below
commit 1dce9f3984a2b0c22b168f9dfe77104552adf03f
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Fri Jan 25 16:16:09 2019 +0100
Adding jacoco support + sonarqube instructions (even though test coverage
still does not take ITCase into account)
---
.../apache/syncope/common/lib/PropertyUtils.java | 9 ++++
pom.xml | 56 ++++++++++++++++++++--
src/site/xdoc/building.xml | 10 ++++
3 files changed, 72 insertions(+), 3 deletions(-)
diff --git
a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/PropertyUtils.java
b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/PropertyUtils.java
index 95d0958..e431631 100644
---
a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/PropertyUtils.java
+++
b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/PropertyUtils.java
@@ -32,6 +32,15 @@ public final class PropertyUtils {
private static final Logger LOG =
LoggerFactory.getLogger(PropertyUtils.class);
+ /**
+ * Reads the property file with the given name from the directory assigned
to the given property, or
+ * from the classpath if not found.
+ *
+ * @param clazz calling class, to access classpath
+ * @param propertiesFileName property file name
+ * @param confDirProp property name for the configuration directory
+ * @return properties, either from configuration directory, or from
classpath
+ */
public static Properties read(
final Class<?> clazz, final String propertiesFileName, final
String confDirProp) {
diff --git a/pom.xml b/pom.xml
index 2f717ce..9be7484 100644
--- a/pom.xml
+++ b/pom.xml
@@ -534,6 +534,20 @@ under the License.
<secretKey>1abcdefghilmnopqrstuvz2!</secretKey>
<jwsKey>ZW7pRixehFuNUtnY5Se47IemgMryTzazPPJ9CGX5LTCmsOJpOgHAQEuPQeV9A28f</jwsKey>
+ <!--
+ Surefire plugin argLine can be defined as a Maven property to avoid JVM
errors on startup with no jacaco-maven-plugin
+ https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html
+ -->
+ <argLine>-Xms512m -Xmx1024m -Xss256k</argLine>
+
+ <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+
<sonar.jacoco.utReportPath>${rootpom.basedir}/target/jacoco.ut.exec</sonar.jacoco.utReportPath>
+
<sonar.jacoco.itReportPath>${rootpom.basedir}/target/jacoco.it.exec</sonar.jacoco.itReportPath>
+
<sonar.jacoco.reportPaths>${sonar.jacoco.utReportPath},${sonar.jacoco.itReportPath}</sonar.jacoco.reportPaths>
+
<sonar.junit.reportPaths>${project.build.directory}/surefire-reports,${project.build.directory}/failsafe-reports</sonar.junit.reportPaths>
+ <sonar.language>java</sonar.language>
+ <sonar.java.source>${targetJdk}</sonar.java.source>
+
<targetJdk>11</targetJdk>
<rootpom.basedir>${basedir}</rootpom.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -2045,7 +2059,6 @@ under the License.
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<encoding>utf-8</encoding>
<runOrder>alphabetical</runOrder>
- <argLine>-Xms512m -Xmx1024m -Xss256k</argLine>
</configuration>
</plugin>
<plugin>
@@ -2056,7 +2069,6 @@ under the License.
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<encoding>utf-8</encoding>
<runOrder>alphabetical</runOrder>
- <argLine>-Xms512m -Xmx1024m -Xss256k</argLine>
</configuration>
<executions>
<execution>
@@ -2077,7 +2089,7 @@ under the License.
<targetJdk>${targetJdk}</targetJdk>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
@@ -2196,6 +2208,44 @@ under the License.
</plugin>
<plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.8.3</version>
+ <configuration>
+ <append>true</append>
+ </configuration>
+ <executions>
+ <execution>
+ <id>jacoco-agent-ut</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <destFile>${sonar.jacoco.utReportPath}</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jacoco-agent-it</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent-integration</goal>
+ </goals>
+ <configuration>
+ <destFile>${sonar.jacoco.itReportPath}</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jacoco-site</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>report-aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.2</version>
diff --git a/src/site/xdoc/building.xml b/src/site/xdoc/building.xml
index c24b03c..f28895c 100644
--- a/src/site/xdoc/building.xml
+++ b/src/site/xdoc/building.xml
@@ -69,6 +69,16 @@ under the License.
To build Syncope without running any test nor check, but generating
Docker images, do:
<source>$ mvn -PskipTests,all,docker</source>
</p>
+
+ <subsection name="Code analysis">
+ After build, it is possible to examine code quality by submitting the
generated reports to
+ a <a href="https://www.sonarqube.org/">SonarQube</a> instance.
+ Various installation methods are available, but the quicker seems to be
via Docker:
+ <source>$ docker run -d --name sonarqube -p 9000:9000 -p 9092:9092
sonarqube</source>
+ Once SonarQube is up and runninig, submit the reports as follows:
+ <source>$ mvn sonar:sonar</source>
+ At the end, browse
http://localhost:9000/dashboard?id=org.apache.syncope%3Asyncope to see results.
+ </subsection>
</section>
<section name="Building documentation">