Upgrade of maven plugins (#951)

* Upgrade maven plugins

* Upgrade maven plugins

Some general code cleanup was necessary due to upgrade of PMD and checkstyle.

Also needed to add Junit 4 as a dependency due to Mockito.timout issue found here:
https://github.com/mockito/mockito/issues/152
This commit is contained in:
Per Wramdemark 2019-10-05 13:23:20 +02:00 committed by Ilkka Seppälä
parent 05d0f0babf
commit 218ba44dbf
19 changed files with 63 additions and 84 deletions

View File

@ -43,5 +43,10 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -29,7 +29,7 @@ public enum Instruction {
LITERAL(1),
SET_HEALTH(2),
SET_WISDOM (3),
SET_WISDOM(3),
SET_AGILITY(4),
PLAY_SOUND(5),
SPAWN_PARTICLES(6),
@ -37,7 +37,7 @@ public enum Instruction {
GET_AGILITY(8),
GET_WISDOM(9),
ADD(10),
DIVIDE (11);
DIVIDE(11);
private int value;

View File

@ -65,7 +65,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
</configuration>

View File

@ -32,7 +32,7 @@ public enum CachingPolicy {
private String policy;
private CachingPolicy(String policy) {
CachingPolicy(String policy) {
this.policy = policy;
}

View File

@ -239,12 +239,12 @@ public class Commander {
//since payment time is lesser than queuetime it would have already failed..additional check not needed
LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed..");
return;
} else if ((qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying))
|| (qt.taskType.equals(TaskType.Messaging) && ((qt.messageType == 1
&& !qt.order.messageSent.equals(MessageSent.NoneSent))
} else if (qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying)
|| qt.taskType.equals(TaskType.Messaging) && (qt.messageType == 1
&& !qt.order.messageSent.equals(MessageSent.NoneSent)
|| qt.order.messageSent.equals(MessageSent.PaymentFail)
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful)))
|| (qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle)) {
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful))
|| qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle) {
LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done..");
return;
}
@ -576,8 +576,8 @@ public class Commander {
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) {
tryDequeue();
LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue..");
} else if ((qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent)
|| !qt.order.paid.equals(PaymentStatus.Trying)))) {
} else if (qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent)
|| !qt.order.paid.equals(PaymentStatus.Trying))) {
tryDequeue();
LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue..");
} else if (qt.messageType == 0) {
@ -607,7 +607,6 @@ public class Commander {
Thread.sleep(queueTaskTime / 3);
tryDoingTasksInQueue();
}
return;
}
}

View File

@ -83,7 +83,7 @@ public class Queue<T> {
Node temp = front;
front = front.next;
size = size - 1;
return ((T) temp.value);
return (T) temp.value;
}
}
@ -91,7 +91,7 @@ public class Queue<T> {
if (isEmpty()) {
throw new IsEmptyException();
} else {
return ((T)front.value);
return (T)front.value;
}
}
}

View File

@ -55,7 +55,9 @@ public class App {
ExecutorService executorService = Executors.newFixedThreadPool(3);
for (int i = 0; i < 3; i++) {
executorService.execute(() -> {
while (inventory.addItem(new Item())) {};
while (inventory.addItem(new Item())) {
LOGGER.info("Adding another item");
}
});
}

View File

@ -97,7 +97,7 @@ public class Event implements IEvent, Runnable {
this.eventListener = null;
}
private final void completed() {
private void completed() {
if (eventListener != null) {
eventListener.completedEventHandler(eventId);
}

View File

@ -24,3 +24,4 @@
com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField
com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt
com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt
domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter

View File

@ -34,7 +34,7 @@ public enum Content {
private String title;
private Content(String title) {
Content(String title) {
this.title = title;
}

View File

@ -43,5 +43,10 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -48,7 +48,7 @@ public class ConsoleLottery {
Injector injector = Guice.createInjector(new LotteryModule());
LotteryService service = injector.getInstance( LotteryService.class);
WireTransfers bank = injector.getInstance(WireTransfers.class);
try (final Scanner scanner = new Scanner(System.in)) {
try (Scanner scanner = new Scanner(System.in)) {
boolean exit = false;
while (!exit) {
printMainMenu();

View File

@ -90,31 +90,9 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-parameters</compilerArgument>
</configuration>
<executions>
<execution>
<id>source</id>
<phase>compile</phase>
</execution>
<execution>
<id>test</id>
<phase>test-compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/*Test.java</include>

View File

@ -66,7 +66,7 @@ public interface Message {
/**
* Enumeration of Type of Headers
*/
public enum Headers {
enum Headers {
DATE, SENDER
}

56
pom.xml
View File

@ -36,10 +36,9 @@
<junit.version>4.12</junit.version>
<junit-jupiter.version>5.0.2</junit-jupiter.version>
<junit-vintage.version>${junit.version}.2</junit-vintage.version>
<junit-platform.version>1.0.2</junit-platform.version>
<sping-test-junit5.version>1.0.2</sping-test-junit5.version>
<compiler.version>3.0</compiler.version>
<jacoco.version>0.7.2.201409121644</jacoco.version>
<compiler.version>3.8.1</compiler.version>
<jacoco.version>0.8.4</jacoco.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<camel.version>2.16.1</camel.version>
<guava.version>19.0</guava.version>
@ -55,6 +54,7 @@
<aws-lambda-log4j.version>1.0.0</aws-lambda-log4j.version>
<aws-lambda-java-events.version>2.0.1</aws-lambda-java-events.version>
<jackson.version>2.8.5</jackson.version>
<pmd.version>3.12.0</pmd.version>
</properties>
<modules>
<module>abstract-factory</module>
@ -353,20 +353,27 @@
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<argLine>-Xmx1024M ${argLine}</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Tell maven to compile using Java 8 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@ -387,7 +394,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<version>3.1.0</version>
<executions>
<execution>
<id>validate</id>
@ -406,25 +413,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform.version}</version>
</dependency>
</dependencies>
<configuration>
<argLine>-Xmx1024M ${argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.6</version>
<version>${pmd.version}</version>
<configuration>
<failOnViolation>true</failOnViolation>
<failurePriority>5</failurePriority>
@ -445,7 +437,7 @@
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.11</version>
<version>3.0</version>
<configuration>
<header>com/mycila/maven/plugin/license/templates/MIT.txt</header>
<properties>
@ -471,7 +463,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.6</version>
<version>${pmd.version}</version>
</plugin>
</plugins>
</reporting>

View File

@ -43,7 +43,8 @@ public class RetryTest {
public void errors() {
final BusinessException e = new BusinessException("unhandled");
final Retry<String> retry = new Retry<>(
() -> { throw e; },
() -> {
throw e; },
2,
0
);
@ -67,7 +68,8 @@ public class RetryTest {
public void attempts() {
final BusinessException e = new BusinessException("unhandled");
final Retry<String> retry = new Retry<>(
() -> { throw e; },
() -> {
throw e; },
2,
0
);
@ -91,7 +93,8 @@ public class RetryTest {
public void ignore() throws Exception {
final BusinessException e = new CustomerNotFoundException("customer not found");
final Retry<String> retry = new Retry<>(
() -> { throw e; },
() -> {
throw e; },
2,
0,
ex -> CustomerNotFoundException.class.isAssignableFrom(ex.getClass())

View File

@ -30,7 +30,7 @@ public class Fruit {
/**
* Enumeration of Fruit Types
*/
public static enum FruitType {
public enum FruitType {
ORANGE, APPLE, LEMON
}

View File

@ -25,7 +25,6 @@ package com.iluwatar.servicelayer.common;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
/**
*
@ -36,9 +35,6 @@ import javax.persistence.Version;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class BaseEntity {
@Version
private Long version;
/**
* Indicates the unique id of this entity
*

View File

@ -62,7 +62,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
</configuration>