diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index 939fe38b97d1..83b618601fb2 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -33,7 +33,7 @@ The bad: * Parallel hierarchy of visitors has to be created for all members in visitable class hierarchy. ## Related patterns -* [Visitor Pattern](../visitor/README.md) +* [Visitor Pattern](../visitor/) ## Credits -* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf) \ No newline at end of file +* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf) diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index dbe303809f9b..6ad8c3c8c5a4 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -32,18 +32,8 @@ 1.22.0-SNAPSHOT 4.0.0 - aggregator-service jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -74,7 +64,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index 16849d529386..131fbf8695cd 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public String getProductTitle() { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return response; } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index 89f1a25e0580..780dccb78e20 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public int getProductInventories() { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return Integer.parseInt(response); } diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index b15af35e4b82..54113d3ad2eb 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -36,14 +36,6 @@ information-microservice jar - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +57,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index 1791ee72c9e8..3a24e9540edf 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -32,18 +32,9 @@ 1.22.0-SNAPSHOT 4.0.0 - inventory-microservice - jar - - - - org.springframework.boot - spring-boot-dependencies - - - + jar org.springframework @@ -65,7 +56,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 82aa6aedef80..44a8bde37923 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -34,15 +34,6 @@ 4.0.0 api-gateway-service jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -73,7 +64,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index c4367cdd8f45..4c897325d931 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -31,19 +31,9 @@ com.iluwatar 1.22.0-SNAPSHOT - 4.0.0 image-microservice jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +55,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 89aaba7ae7d4..21a68dc6efd3 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -36,14 +36,6 @@ price-microservice jar - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +57,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index c6764f61cad0..49e39009ebdd 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java index 2ceb66e3bdc2..1d921da51037 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -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; diff --git a/caching/pom.xml b/caching/pom.xml index 76578b8830cc..c20e29e922d2 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -65,7 +65,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false diff --git a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java index 9f7c92b2eef5..6b7fc35c3ace 100644 --- a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java +++ b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java @@ -32,7 +32,7 @@ public enum CachingPolicy { private String policy; - private CachingPolicy(String policy) { + CachingPolicy(String policy) { this.policy = policy; } diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index 87d4604d4ac3..8f19d1df8794 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -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; } @@ -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) { @@ -606,8 +606,7 @@ private void doTasksInQueue() throws Exception { } else { Thread.sleep(queueTaskTime / 3); tryDoingTasksInQueue(); - } - return; + } } } diff --git a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java index f1b0ef533117..440f65c90938 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java @@ -83,7 +83,7 @@ T dequeue() throws IsEmptyException { Node temp = front; front = front.next; size = size - 1; - return ((T) temp.value); + return (T) temp.value; } } @@ -91,7 +91,7 @@ T peek() throws IsEmptyException { if (isEmpty()) { throw new IsEmptyException(); } else { - return ((T)front.value); + return (T)front.value; } } } diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java index c814f98bc586..3a9faf4dca16 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java @@ -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"); + } }); } diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java index 5dc069bc7032..c22f54ca0e29 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java @@ -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); } diff --git a/exclude-pmd.properties b/exclude-pmd.properties index 288ee9b2d318..5a4bb138834e 100644 --- a/exclude-pmd.properties +++ b/exclude-pmd.properties @@ -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 \ No newline at end of file diff --git a/flux/src/main/java/com/iluwatar/flux/action/Content.java b/flux/src/main/java/com/iluwatar/flux/action/Content.java index 596b466db414..8854ebced07a 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/Content.java +++ b/flux/src/main/java/com/iluwatar/flux/action/Content.java @@ -34,7 +34,7 @@ public enum Content { private String title; - private Content(String title) { + Content(String title) { this.title = title; } diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index d965298ca364..2ca43a964844 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java index 9956788ad100..2d2a53318620 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java @@ -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(); diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 8c21504bb6f5..271a07705589 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -17,23 +17,14 @@ com.iluwatar 1.22.0-SNAPSHOT - naked-objects - pom - - - 3.0.4 - - 1.9.0 - UTF-8 UTF-8 2.0.0 - apache.snapshots @@ -90,31 +81,9 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - -parameters - - - - source - compile - - - test - test-compile - - - - org.apache.maven.plugins maven-surefire-plugin - 2.16 **/*Test.java diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java index cd2d2da6ac90..e9937d30cac0 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java @@ -66,7 +66,7 @@ private RuntimeException poison() { /** * Enumeration of Type of Headers */ - public enum Headers { + enum Headers { DATE, SENDER } diff --git a/pom.xml b/pom.xml index ce773f61a243..539da396b2d8 100644 --- a/pom.xml +++ b/pom.xml @@ -36,25 +36,27 @@ 4.12 5.0.2 ${junit.version}.2 - 1.0.2 1.0.2 - 3.0 - 0.7.2.201409121644 + 3.8.1 + 0.8.4 1.4 2.16.1 19.0 1.10.19 - 4.5.2 + 4.5.10 2.22 4.0 3.3.0 - 1.7.21 - 1.1.7 + 1.7.28 + 1.2.3 1.1.0 1.11.289 1.0.0 2.0.1 2.8.5 + 3.12.0 + 2.3.0 + 1.3.1 abstract-factory @@ -211,11 +213,6 @@ spring-webmvc ${spring.version} - - org.springframework.boot - spring-boot-starter-web - ${spring-boot.version} - org.apache.httpcomponents httpclient @@ -303,6 +300,16 @@ mongo-java-driver ${mongo-java-driver.version} + + javax.xml.bind + jaxb-api + ${jaxb-api.version} + + + javax.annotation + javax.annotation-api + ${annotation-api.version} + @@ -358,20 +365,32 @@ + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler.version} + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + -Xmx1024M ${argLine} + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + - - - org.apache.maven.plugins - maven-compiler-plugin - ${compiler.version} - - 1.8 - 1.8 - - org.jacoco jacoco-maven-plugin @@ -392,7 +411,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.1.0 validate @@ -411,25 +430,10 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.junit.platform - junit-platform-surefire-provider - ${junit-platform.version} - - - - -Xmx1024M ${argLine} - - org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version} true 5 @@ -450,7 +454,7 @@ com.mycila license-maven-plugin - 2.11 + 3.0
com/mycila/maven/plugin/license/templates/MIT.txt
@@ -476,7 +480,12 @@ org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version} + + + org.apache.maven.plugins + maven-jxr-plugin + 3.0.0
diff --git a/repository/pom.xml b/repository/pom.xml index 48bca0cf2ba8..2ccdc9da7ba5 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -63,5 +63,13 @@ com.google.guava guava
+ + javax.xml.bind + jaxb-api + + + javax.annotation + javax.annotation-api +
diff --git a/retry/src/test/java/com/iluwatar/retry/RetryTest.java b/retry/src/test/java/com/iluwatar/retry/RetryTest.java index a8307d1cd9f3..d435c7e84331 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryTest.java @@ -43,7 +43,8 @@ public class RetryTest { public void errors() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -67,7 +68,8 @@ public void errors() { public void attempts() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -91,7 +93,8 @@ public void attempts() { public void ignore() throws Exception { final BusinessException e = new CustomerNotFoundException("customer not found"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0, ex -> CustomerNotFoundException.class.isAssignableFrom(ex.getClass()) diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java index 88255997fa7e..9ab004c17531 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java @@ -30,7 +30,7 @@ public class Fruit { /** * Enumeration of Fruit Types */ - public static enum FruitType { + public enum FruitType { ORANGE, APPLE, LEMON } diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java index 52c24292e2ec..bf3988d07484 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java @@ -25,10 +25,9 @@ import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.MappedSuperclass; -import javax.persistence.Version; /** - * + * * Base class for entities. * */ @@ -36,9 +35,6 @@ @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class BaseEntity { - @Version - private Long version; - /** * Indicates the unique id of this entity * diff --git a/trampoline/pom.xml b/trampoline/pom.xml index e6f2e620afac..1e019ef31297 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -62,7 +62,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false