Messing around with sonarqube
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 31 Jul 2016 20:28:39 +0000 (22:28 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 31 Jul 2016 20:28:39 +0000 (22:28 +0200)
SpringJava/JPA/README
SpringJava/JPA/spring-jpa-bom/pom.xml
SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java [new file with mode: 0644]
SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/persistence/example/domain/AdTest.java [deleted file]

index a9991b4..06583a7 100644 (file)
@@ -1,8 +1,10 @@
 mvn clean install
 mvn clean install -Dmaven.test.skip=true
-mvn clean install -Pintegration 
+mvn clean install -Pintegration
+mvn clean install site -Pintegration
 mvn dependency:sources
 mvn dependency:resolve -Dclassifier=javadoc
+mvn sonar:sonar -Dsonar.host.url=http://172.17.0.3:9091/sonarqube
 
 
 POST /spring-jpa-resources-1.0-SNAPSHOT/ads/ HTTP/1.1
index 140e290..42bc366 100644 (file)
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <spring.version>4.3.0.RELEASE</spring.version>
         <querydsl.version>4.1.3</querydsl.version>
+
+        <!-- Be careful these two paths must match the ones configured in SONARQUBE JaCoCo plugin -->
         <jacoco.it.execution.data.file>${project.basedir}/target/jacoco-it.exec</jacoco.it.execution.data.file>
         <jacoco.ut.execution.data.file>${project.basedir}/target/jacoco.exec</jacoco.ut.execution.data.file>
+
         <skip.unit.tests>false</skip.unit.tests>
         <skip.integration.tests>true</skip.integration.tests>
        </properties>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.4</version>
+                <reportSets>
+                    <reportSet>
+                        <id>html</id>
+                        <configuration>
+                            <!-- default value is http://localhost:9000 -->
+                            <doctitle>API for ${project.name} ${project.version}</doctitle>
+                            <windowtitle>API for ${project.name} ${project.version}</windowtitle>
+                        </configuration>
+                        <reports>
+                            <report>javadoc</report>
+                            <report>aggregate</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-report-plugin</artifactId>
                 <version>2.19.1</version>
                 <reportSets>
diff --git a/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java b/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java
new file mode 100644 (file)
index 0000000..eae39d3
--- /dev/null
@@ -0,0 +1,62 @@
+package de.spring.example.persitence.domain;
+
+import static org.junit.Assert.assertEquals;
+
+import java.time.OffsetDateTime;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+import de.spring.example.persistence.domain.Ad;
+import de.spring.example.persistence.domain.AdDescription;
+
+public class AdTest {
+       // Ad
+       public static final Long AD_ID = 66L;
+       public static final Long COMPANY_ID = 2L;
+       public static final Long COMPANY_CATEG_ID = 3L;
+       public static final String AD_MOBILE_IMAGE = "slippers.jpg";
+       public static final OffsetDateTime CREATED_AT = OffsetDateTime.now().minusDays(1);
+       public static final OffsetDateTime UPDATED_AT = OffsetDateTime.now();
+
+       // AdDescription
+       public static final Long AD_DESCRIPTION_ID = 99L;
+       public static final Long LANGUAGE_ID = 3L;
+       public static final String AD_NAME = "Slippers";
+       public static final String AD_DESCRIPTION = "Slippers";
+       public static final String AD_MOBILE_TEXT = "Buy it now!";
+       public static final String AD_LINK = "http://gumartinm.name";
+       public static final Set<AdDescription> AD_DESCRIPTIONS = createAdDescriptions();
+       
+
+       @Test
+       public void whenCallingConstructorWithParametersThenCreateObject() {
+               Ad ad = createAd();
+               
+               assertEquals(ad.getAdDescriptions(), AD_DESCRIPTIONS);
+               assertEquals(ad.getAdMobileImage(), AD_MOBILE_IMAGE);
+               assertEquals(ad.getCompanyCategId(), COMPANY_CATEG_ID);
+               assertEquals(ad.getCreatedAt(), CREATED_AT);
+               assertEquals(ad.getUpdatedAt(), UPDATED_AT);
+               assertEquals(ad.getId(), AD_ID);
+       }
+       
+       private static final Ad createAd() {    
+               return new Ad(AD_ID, AD_DESCRIPTIONS, COMPANY_ID, COMPANY_CATEG_ID, AD_MOBILE_IMAGE,
+                               CREATED_AT, UPDATED_AT);
+       }
+       
+       private static final AdDescription createAdDescription() {
+               return new AdDescription(AD_DESCRIPTION_ID, null, LANGUAGE_ID, AD_NAME, AD_DESCRIPTION,
+                               AD_MOBILE_TEXT, AD_LINK);
+       }
+       
+       private static final Set<AdDescription> createAdDescriptions() {
+               AdDescription adDescription = createAdDescription();
+               Set<AdDescription> adDescriptions = new HashSet<>();
+               adDescriptions.add(adDescription);
+               
+               return adDescriptions;
+       }
+}
diff --git a/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/persistence/example/domain/AdTest.java b/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/persistence/example/domain/AdTest.java
deleted file mode 100644 (file)
index 7fb4c57..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package de.spring.persistence.example.domain;
-
-public class AdTest {
-
-}