From 47de9fc47fdc2ad8a9ebcecb8602420d413f03b9 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 31 Jul 2016 22:28:39 +0200 Subject: [PATCH] Messing around with sonarqube --- SpringJava/JPA/README | 4 +- SpringJava/JPA/spring-jpa-bom/pom.xml | 22 ++++++++ .../spring/example/persitence/domain/AdTest.java | 62 ++++++++++++++++++++++ .../spring/persistence/example/domain/AdTest.java | 5 -- 4 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java delete mode 100644 SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/persistence/example/domain/AdTest.java diff --git a/SpringJava/JPA/README b/SpringJava/JPA/README index a9991b4..06583a7 100644 --- a/SpringJava/JPA/README +++ b/SpringJava/JPA/README @@ -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 diff --git a/SpringJava/JPA/spring-jpa-bom/pom.xml b/SpringJava/JPA/spring-jpa-bom/pom.xml index 140e290..42bc366 100644 --- a/SpringJava/JPA/spring-jpa-bom/pom.xml +++ b/SpringJava/JPA/spring-jpa-bom/pom.xml @@ -30,8 +30,11 @@ UTF-8 4.3.0.RELEASE 4.1.3 + + ${project.basedir}/target/jacoco-it.exec ${project.basedir}/target/jacoco.exec + false true @@ -560,6 +563,25 @@ org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + html + + + API for ${project.name} ${project.version} + API for ${project.name} ${project.version} + + + javadoc + aggregate + + + + + + org.apache.maven.plugins maven-surefire-report-plugin 2.19.1 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 index 0000000..eae39d3 --- /dev/null +++ b/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java @@ -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 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 createAdDescriptions() { + AdDescription adDescription = createAdDescription(); + Set 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 index 7fb4c57..0000000 --- a/SpringJava/JPA/spring-jpa-persistence/src/test/java/de/spring/persistence/example/domain/AdTest.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.spring.persistence.example.domain; - -public class AdTest { - -} -- 2.1.4