Skip to content

Commit

Permalink
Upgrade of maven plugins (#951)
Browse files Browse the repository at this point in the history
* 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:
mockito/mockito#152
  • Loading branch information
perwramdemark authored and iluwatar committed Oct 5, 2019
1 parent 05d0f0b commit 218ba44
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 84 deletions.
5 changes: 5 additions & 0 deletions async-method-invocation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
4 changes: 2 additions & 2 deletions bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public enum Instruction {

LITERAL(1),
SET_HEALTH(2),
SET_WISDOM (3),
SET_WISDOM(3),
SET_AGILITY(4),
PLAY_SOUND(5),
SPAWN_PARTICLES(6),
GET_HEALTH(7),
GET_AGILITY(8),
GET_WISDOM(9),
ADD(10),
DIVIDE (11);
DIVIDE(11);

private int value;

Expand Down
1 change: 0 additions & 1 deletion caching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum CachingPolicy {

private String policy;

private CachingPolicy(String policy) {
CachingPolicy(String policy) {
this.policy = policy;
}

Expand Down
17 changes: 8 additions & 9 deletions commander/src/main/java/com/iluwatar/commander/Commander.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ private void updateQueue(QueueTask qt) throws InterruptedException {
//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;
}
Expand Down Expand Up @@ -576,8 +576,8 @@ private void doTasksInQueue() throws Exception {
|| 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) {
Expand Down Expand Up @@ -606,8 +606,7 @@ private void doTasksInQueue() throws Exception {
} else {
Thread.sleep(queueTaskTime / 3);
tryDoingTasksInQueue();
}
return;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ T dequeue() throws IsEmptyException {
Node temp = front;
front = front.next;
size = size - 1;
return ((T) temp.value);
return (T) temp.value;
}
}

T peek() throws IsEmptyException {
if (isEmpty()) {
throw new IsEmptyException();
} else {
return ((T)front.value);
return (T)front.value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public static void main(String[] args) {
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");
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public final void removeListener(final ThreadCompleteListener listener) {
this.eventListener = null;
}

private final void completed() {
private void completed() {
if (eventListener != null) {
eventListener.completedEventHandler(eventId);
}
Expand Down
1 change: 1 addition & 0 deletions exclude-pmd.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion flux/src/main/java/com/iluwatar/flux/action/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public enum Content {

private String title;

private Content(String title) {
Content(String title) {
this.title = title;
}

Expand Down
5 changes: 5 additions & 0 deletions half-sync-half-async/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void main(String[] args) {
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();
Expand Down
22 changes: 0 additions & 22 deletions naked-objects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private RuntimeException poison() {
/**
* Enumeration of Type of Headers
*/
public enum Headers {
enum Headers {
DATE, SENDER
}

Expand Down
56 changes: 24 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
9 changes: 6 additions & 3 deletions retry/src/test/java/com/iluwatar/retry/RetryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -67,7 +68,8 @@ public void errors() {
public void attempts() {
final BusinessException e = new BusinessException("unhandled");
final Retry<String> retry = new Retry<>(
() -> { throw e; },
() -> {
throw e; },
2,
0
);
Expand All @@ -91,7 +93,8 @@ public void attempts() {
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())
Expand Down
2 changes: 1 addition & 1 deletion semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Fruit {
/**
* Enumeration of Fruit Types
*/
public static enum FruitType {
public enum FruitType {
ORANGE, APPLE, LEMON
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,16 @@
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

/**
*
*
* Base class for entities.
*
*/
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class BaseEntity {

@Version
private Long version;

/**
* Indicates the unique id of this entity
*
Expand Down
1 change: 0 additions & 1 deletion trampoline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 218ba44

Please sign in to comment.