diff --git a/aws-modules/aws-miscellaneous/README.md b/aws-modules/aws-miscellaneous/README.md
index 5be8e6a3f2..104c8719df 100644
--- a/aws-modules/aws-miscellaneous/README.md
+++ b/aws-modules/aws-miscellaneous/README.md
@@ -5,6 +5,5 @@ This module contains articles about various Amazon Web Services (AWS) such as EC
### Relevant articles
- [Managing EC2 Instances in Java](https://www.baeldung.com/ec2-java)
-- [Integration Testing with a Local DynamoDB Instance](https://www.baeldung.com/dynamodb-local-integration-tests)
- [Managing Amazon SQS Queues in Java](https://www.baeldung.com/aws-queues-java)
- [Guide to AWS Aurora RDS with Java](https://www.baeldung.com/aws-aurora-rds-java)
diff --git a/core-java-modules/core-java-8/README.md b/core-java-modules/core-java-8/README.md
index 6061f3318d..0921c1538a 100644
--- a/core-java-modules/core-java-8/README.md
+++ b/core-java-modules/core-java-8/README.md
@@ -11,5 +11,5 @@ This module contains articles about Java 8 core features
- [Finding Min/Max in an Array with Java](https://www.baeldung.com/java-array-min-max)
- [Internationalization and Localization in Java 8](https://www.baeldung.com/java-8-localization)
- [Generalized Target-Type Inference in Java](https://www.baeldung.com/java-generalized-target-type-inference)
-- [Monads in Java](https://www.baeldung.com/java-monads)
+- [Monads in Java – Optional](https://www.baeldung.com/java-monads)
- [[More -->]](/core-java-modules/core-java-8-2)
diff --git a/core-java-modules/core-java-arrays-operations-basic-2/README.md b/core-java-modules/core-java-arrays-operations-basic-2/README.md
new file mode 100644
index 0000000000..da2f17111f
--- /dev/null
+++ b/core-java-modules/core-java-arrays-operations-basic-2/README.md
@@ -0,0 +1,5 @@
+## Core Java Arrays - Basic Operations
+
+This module contains articles about Java array fundamentals. They assume no previous background knowledge on working with arrays.
+
+### Relevant Articles:
diff --git a/core-java-modules/core-java-arrays-operations-basic-2/pom.xml b/core-java-modules/core-java-arrays-operations-basic-2/pom.xml
new file mode 100644
index 0000000000..7257a39462
--- /dev/null
+++ b/core-java-modules/core-java-arrays-operations-basic-2/pom.xml
@@ -0,0 +1,16 @@
+
+
+ 4.0.0
+ core-java-arrays-operations-basic-2
+ core-java-arrays-operations-basic-2
+ jar
+
+
+ core-java-modules
+ com.baeldung.core-java-modules
+ 0.0.1-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-arrays-operations-basic-2/src/test/java/com/baeldung/array/mismatch/ArrayMismatchUnitTest.java b/core-java-modules/core-java-arrays-operations-basic-2/src/test/java/com/baeldung/array/mismatch/ArrayMismatchUnitTest.java
new file mode 100644
index 0000000000..464221efd0
--- /dev/null
+++ b/core-java-modules/core-java-arrays-operations-basic-2/src/test/java/com/baeldung/array/mismatch/ArrayMismatchUnitTest.java
@@ -0,0 +1,269 @@
+package com.baeldung.array.mismatch;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.junit.jupiter.api.Test;
+
+class ArrayMismatchUnitTest {
+
+ @Test
+ void givenTwoArraysWithACommonPrefix_whenMismatch_thenIndexOfFirstMismatch() {
+ int[] firstArray = {1, 2, 3, 4, 5};
+ int[] secondArray = {1, 2, 3, 5, 8};
+ assertEquals(3, Arrays.mismatch(firstArray, secondArray));
+ }
+
+ @Test
+ void givenTwoIdenticalArrays_whenMismatch_thenMinusOne() {
+ int[] firstArray = {1, 2, 3, 4, 5};
+ int[] secondArray = {1, 2, 3, 4, 5};
+ assertEquals(-1, Arrays.mismatch(firstArray, secondArray));
+ }
+
+ @Test
+ void givenFirstArrayIsAPrefixOfTheSecond_whenMismatch_thenFirstArrayLength() {
+ int[] firstArray = {1, 2, 3, 4, 5};
+ int[] secondArray = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+ assertEquals(firstArray.length, Arrays.mismatch(firstArray, secondArray));
+ }
+
+ @Test
+ void givenNoCommonPrefix_whenMismatch_thenZero() {
+ int[] firstArray = {1, 2, 3, 4, 5};
+ int[] secondArray = {9, 8, 7};
+ assertEquals(0, Arrays.mismatch(firstArray, secondArray));
+ }
+
+ @Test
+ void givenAtLeastANullArray_whenMismatch_thenThrowsNullPointerException() {
+ int[] firstArray = null;
+ int[] secondArray = {1, 2, 3, 4, 5};
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, secondArray));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, firstArray));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, firstArray));
+ }
+
+ @Test
+ void givenExactlyOneAnEmptyArray_whenMismatch_thenZero() {
+ int[] firstArray = {};
+ int[] secondArray = {1, 2, 3};
+ assertEquals(0, Arrays.mismatch(firstArray, secondArray));
+ assertEquals(0, Arrays.mismatch(secondArray, firstArray));
+ }
+
+ @Test
+ void givenTwoEmptyArrays_whenMismatch_thenMinusOne() {
+ assertEquals(-1, Arrays.mismatch(new int[] {}, new int[] {}));
+ }
+
+ @Test
+ void givenTwoSubArraysWithACommonPrefix_whenMismatch_thenIndexOfFirstMismatch() {
+ int[] firstArray = {1, 2, 3, 4, 5};
+ int[] secondArray = {0, 1, 2, 3, 5, 8};
+ assertEquals(3, Arrays.mismatch(firstArray, 0, 4, secondArray, 1, 6));
+ }
+
+ @Test
+ void givenTwoIdenticalSubArrays_whenMismatch_thenMinusOne() {
+ int[] firstArray = {0, 0, 1, 2};
+ int[] secondArray = {0, 1, 2, 3, 4};
+ assertEquals(-1, Arrays.mismatch(firstArray, 2, 4, secondArray, 1, 3));
+ }
+
+ @Test
+ void givenFirstSubArrayIsAPrefixOfTheSecond_whenMismatch_thenFirstArrayLength() {
+ int[] firstArray = {2, 3, 4, 5, 4, 3, 2};
+ int[] secondArray = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ assertEquals(4, Arrays.mismatch(firstArray, 0, 4, secondArray, 2, 9));
+ }
+
+ @Test
+ void givenNoCommonPrefixForSubArrays_whenMismatch_thenZero() {
+ int[] firstArray = {0, 0, 0, 0, 0};
+ int[] secondArray = {9, 8, 7, 6, 5};
+ assertEquals(0, Arrays.mismatch(firstArray, 1, 2, secondArray, 1, 2));
+ }
+
+ @Test
+ void givenAtLeastANullSubArray_whenMismatch_thenThrowsNullPointerException() {
+ int[] firstArray = null;
+ int[] secondArray = {1, 2, 3, 4, 5};
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, 0, 1, secondArray, 0, 1));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, 0, 1, firstArray, 0, 1));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, 0, 1, firstArray, 0, 1));
+ }
+
+ @Test
+ void givenExactlyOneEmptySubArray_whenMismatch_thenZero() {
+ int[] firstArray = {1};
+ int[] secondArray = {1, 2, 3};
+ assertEquals(0, Arrays.mismatch(firstArray, 0, 0, secondArray, 0, 2));
+ assertEquals(0, Arrays.mismatch(firstArray, 0, 1, secondArray, 2, 2));
+ }
+
+ @Test
+ void givenTwoEmptySubArrays_whenMismatch_thenMinusOne() {
+ int[] firstArray = {1};
+ int[] secondArray = {1, 2, 3};
+ assertEquals(-1, Arrays.mismatch(firstArray, 0, 0, secondArray, 2, 2));
+ }
+
+ @Test
+ void givenToIndexGreaterThanFromIndex_whenMismatch_thenThrowsIllegalArgumentException() {
+ int[] firstArray = {2, 3, 4, 5, 4, 3, 2};
+ int[] secondArray = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ assertThrows(IllegalArgumentException.class, () -> Arrays.mismatch(firstArray, 4, 2, secondArray, 0, 6));
+ assertThrows(IllegalArgumentException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, 6, 0));
+ }
+
+ @Test
+ void givenIllegalIndexes_whenMismatch_thenThrowsArrayIndexOutOfBoundsException() {
+ int[] firstArray = {2, 3, 4, 5, 4, 3, 2};
+ int[] secondArray = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, -1, 2, secondArray, 0, 6));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 0, 8, secondArray, 0, 6));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, -5, 0));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, 11, 12));
+ }
+
+ @Test
+ void givenTwoStringArraysAndAComparator_whenMismatch_thenIndexOfFirstMismatch() {
+ String[] firstArray = {"one", "two", "three"};
+ String[] secondArray = {"ONE", "TWO", "FOUR"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(2, Arrays.mismatch(firstArray, secondArray, comparator));
+ }
+
+ @Test
+ void givenTwoIdenticalStringArraysForTheComparator_whenMismatch_thenMinusOne() {
+ String[] firstArray = {"one", "two", "three"};
+ String[] secondArray = {"ONE", "TWO", "THREE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(-1, Arrays.mismatch(firstArray, secondArray, comparator));
+ }
+
+ @Test
+ void givenFirstStringArrayIsAPrefixOfTheSecondForTheComparator_whenMismatch_thenFirstArrayLength() {
+ String[] firstArray = {"one", "two", "three"};
+ String[] secondArray = {"ONE", "TWO", "THREE", "FOUR", "FIVE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(firstArray.length, Arrays.mismatch(firstArray, secondArray, comparator));
+ }
+
+ @Test
+ void givenNoCommonPrefixForTheComparator_whenMismatch_thenZero() {
+ String[] firstArray = {"one", "two", "three"};
+ String[] secondArray = {"six", "seven", "eight"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(0, Arrays.mismatch(firstArray, secondArray, comparator));
+ }
+
+ @Test
+ void givenAtLeastANullArrayOrNullComparator_whenMismatch_thenThrowsNullPointerException() {
+ String[] firstArray = null;
+ String[] secondArray = {"one"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, secondArray, comparator));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, firstArray, comparator));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, secondArray, null));
+ }
+
+ @Test
+ void givenExactlyOneAnEmptyArrayAndAComparator_whenMismatch_thenZero() {
+ String[] firstArray = {};
+ String[] secondArray = {"one"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(0, Arrays.mismatch(firstArray, secondArray, comparator));
+ assertEquals(0, Arrays.mismatch(secondArray, firstArray, comparator));
+ }
+
+ @Test
+ void givenTwoEmptyStringArraysForTheComparator_whenMismatch_thenMinusOne() {
+ assertEquals(-1, Arrays.mismatch(new String[] {}, new String[] {}, String.CASE_INSENSITIVE_ORDER));
+ }
+
+ @Test
+ void givenTwoStringSubarraysAndAComparator_whenMismatch_thenIndexOfFirstMismatch() {
+ String[] firstArray = {"one", "two", "three", "four"};
+ String[] secondArray = {"ZERO", "ONE", "TWO", "FOUR", "EIGHT", "SIXTEEN"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(2, Arrays.mismatch(firstArray, 0, 4, secondArray, 1, 3, comparator));
+ }
+
+ @Test
+ void givenTwoIdenticalStringSubArraysForTheComparator_whenMismatch_thenMinusOne() {
+ String[] firstArray = {"zero", "zero", "one", "two"};
+ String[] secondArray = {"zero", "one", "two", "three", "four"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(-1, Arrays.mismatch(firstArray, 2, 4, secondArray, 1, 3, comparator));
+ }
+
+ @Test
+ void givenFirstSubArrayIsAPrefixOfTheSecondForTheComparator_whenMismatch_thenFirstArrayLength() {
+ String[] firstArray = {"two", "three", "four", "five", "four", "three", "two"};
+ String[] secondArray = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "EIGHT", "NINE", "TEN"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(4, Arrays.mismatch(firstArray, 0, 4, secondArray, 2, 9, comparator));
+ }
+
+ @Test
+ void givenNoCommonPrefixForSubArraysForTheComparator_whenMismatch_thenZero() {
+ String[] firstArray = {"zero", "one"};
+ String[] secondArray = {"TEN", "ELEVEN", "TWELVE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(0, Arrays.mismatch(firstArray, 1, 2, secondArray, 1, 2, comparator));
+ }
+
+ @Test
+ void givenAtLeastANullSubArrayOrNullComparator_whenMismatch_thenThrowsNullPointerException() {
+ String[] firstArray = null;
+ String[] secondArray = {"ONE", "TWO", "THREE", "FOUR", "FIVE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, 0, 1, secondArray, 0, 1, comparator));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, 0, 1, firstArray, 0, 1, comparator));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(firstArray, 0, 1, firstArray, 0, 1, comparator));
+ assertThrows(NullPointerException.class, () -> Arrays.mismatch(secondArray, 0, 1, secondArray, 0, 1, null));
+ }
+
+ @Test
+ void givenExactlyOneEmptySubArrayAndAComparator_whenMismatch_thenZero() {
+ String[] firstArray = {"one"};
+ String[] secondArray = {"ONE", "TWO", "THREE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(0, Arrays.mismatch(firstArray, 0, 0, secondArray, 0, 2, comparator));
+ assertEquals(0, Arrays.mismatch(firstArray, 0, 1, secondArray, 2, 2, comparator));
+ }
+
+ @Test
+ void givenTwoEmptySubArraysAndAComparator_whenMismatch_thenMinusOne() {
+ String[] firstArray = {"one"};
+ String[] secondArray = {"ONE", "TWO", "THREE"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertEquals(-1, Arrays.mismatch(firstArray, 0, 0, secondArray, 2, 2, comparator));
+ }
+
+ @Test
+ void givenToIndexGreaterThanFromIndexAndAComparator_whenMismatch_thenThrowsIllegalArgumentException() {
+ String[] firstArray = {"two", "three", "four", "five", "four", "three", "two"};
+ String[] secondArray = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "EIGHT", "NINE", "TEN"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertThrows(IllegalArgumentException.class, () -> Arrays.mismatch(firstArray, 4, 2, secondArray, 0, 6, comparator));
+ assertThrows(IllegalArgumentException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, 6, 0, comparator));
+ }
+
+ @Test
+ void givenIllegalIndexesAndAComparator_whenMismatch_thenThrowsArrayIndexOutOfBoundsException() {
+ String[] firstArray = {"two", "three", "four", "five", "four", "three", "two"};
+ String[] secondArray = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "EIGHT", "NINE", "TEN"};
+ Comparator comparator = String.CASE_INSENSITIVE_ORDER;
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, -1, 2, secondArray, 0, 6, comparator));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 0, 8, secondArray, 0, 6, comparator));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, -5, 0, comparator));
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> Arrays.mismatch(firstArray, 2, 3, secondArray, 11, 12, comparator));
+ }
+
+}
diff --git a/core-java-modules/core-java-collections-5/src/test/java/com/baeldung/removequeueelements/RemoveQueueElementsUnitTest.java b/core-java-modules/core-java-collections-5/src/test/java/com/baeldung/removequeueelements/RemoveQueueElementsUnitTest.java
index 66cfade866..38fdc58099 100644
--- a/core-java-modules/core-java-collections-5/src/test/java/com/baeldung/removequeueelements/RemoveQueueElementsUnitTest.java
+++ b/core-java-modules/core-java-collections-5/src/test/java/com/baeldung/removequeueelements/RemoveQueueElementsUnitTest.java
@@ -12,7 +12,7 @@ public class RemoveQueueElementsUnitTest {
@Test
public void givenQueueWithEvenAndOddNumbers_whenRemovingEvenNumbers_thenOddNumbersRemain() {
Queue queue = new LinkedList<>();
- Queue evenElementsQueue = new LinkedList<>();
+ Queue oddElementsQueue = new LinkedList<>();
queue.add(1);
queue.add(2);
queue.add(3);
@@ -22,14 +22,14 @@ public class RemoveQueueElementsUnitTest {
while (queue.peek() != null) {
int element = queue.remove();
if (element % 2 != 0) {
- evenElementsQueue.add(element);
+ oddElementsQueue.add(element);
}
}
- assertEquals(3, evenElementsQueue.size());
- assertTrue(evenElementsQueue.contains(1));
- assertTrue(evenElementsQueue.contains(3));
- assertTrue(evenElementsQueue.contains(5));
+ assertEquals(3, oddElementsQueue.size());
+ assertTrue(oddElementsQueue.contains(1));
+ assertTrue(oddElementsQueue.contains(3));
+ assertTrue(oddElementsQueue.contains(5));
}
@Test
diff --git a/core-java-modules/core-java-concurrency-advanced-5/README.md b/core-java-modules/core-java-concurrency-advanced-5/README.md
new file mode 100644
index 0000000000..ba845a7c4b
--- /dev/null
+++ b/core-java-modules/core-java-concurrency-advanced-5/README.md
@@ -0,0 +1,3 @@
+
+### Relevant Articles:
+- [Why wait() Requires Synchronization?](https://www.baeldung.com/java-wait-necessary-synchronization)
diff --git a/core-java-modules/core-java-concurrency-basic-3/src/main/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFuture.java b/core-java-modules/core-java-concurrency-basic-3/src/main/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFuture.java
new file mode 100644
index 0000000000..a3df6b3624
--- /dev/null
+++ b/core-java-modules/core-java-concurrency-basic-3/src/main/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFuture.java
@@ -0,0 +1,63 @@
+package com.baeldung.concurrent.completablefuture.retry;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class RetryCompletableFuture {
+ public static CompletableFuture retryTask(Supplier supplier, int maxRetries) {
+ Supplier retryableSupplier = retryFunction(supplier, maxRetries);
+ return CompletableFuture.supplyAsync(retryableSupplier);
+ }
+
+ static Supplier retryFunction(Supplier supplier, int maxRetries) {
+ return () -> {
+ int retries = 0;
+ while (retries < maxRetries) {
+ try {
+ return supplier.get();
+ } catch (Exception e) {
+ retries++;
+ }
+ }
+ throw new IllegalStateException(String.format("Task failed after %s attempts", maxRetries));
+ };
+ }
+
+ public static CompletableFuture retryUnsafe(Supplier supplier, int maxRetries) {
+ CompletableFuture cf = CompletableFuture.supplyAsync(supplier);
+ sleep(100l);
+ for (int i = 0; i < maxRetries; i++) {
+ cf = cf.exceptionally(__ -> supplier.get());
+ }
+ return cf;
+ }
+
+ public static CompletableFuture retryNesting(Supplier supplier, int maxRetries) {
+ CompletableFuture cf = CompletableFuture.supplyAsync(supplier);
+ sleep(100);
+ for (int i = 0; i < maxRetries; i++) {
+ cf = cf.thenApply(CompletableFuture::completedFuture)
+ .exceptionally(__ -> CompletableFuture.supplyAsync(supplier))
+ .thenCompose(Function.identity());
+ }
+ return cf;
+ }
+
+ public static CompletableFuture retryExceptionallyAsync(Supplier supplier, int maxRetries) {
+ CompletableFuture cf = CompletableFuture.supplyAsync(supplier);
+ sleep(100);
+ for (int i = 0; i < maxRetries; i++) {
+ cf = cf.exceptionallyAsync(__ -> supplier.get());
+ }
+ return cf;
+ }
+
+ private static void sleep(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/core-java-modules/core-java-concurrency-basic-3/src/test/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFutureUnitTest.java b/core-java-modules/core-java-concurrency-basic-3/src/test/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFutureUnitTest.java
new file mode 100644
index 0000000000..ea49f0fa08
--- /dev/null
+++ b/core-java-modules/core-java-concurrency-basic-3/src/test/java/com/baeldung/concurrent/completablefuture/retry/RetryCompletableFutureUnitTest.java
@@ -0,0 +1,120 @@
+package com.baeldung.concurrent.completablefuture.retry;
+
+import static com.baeldung.concurrent.completablefuture.retry.RetryCompletableFuture.retryExceptionallyAsync;
+import static com.baeldung.concurrent.completablefuture.retry.RetryCompletableFuture.retryNesting;
+import static com.baeldung.concurrent.completablefuture.retry.RetryCompletableFuture.retryTask;
+import static com.baeldung.concurrent.completablefuture.retry.RetryCompletableFuture.retryUnsafe;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Supplier;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class RetryCompletableFutureUnitTest {
+ private AtomicInteger retriesCounter = new AtomicInteger(0);
+
+ @BeforeEach
+ void beforeEach() {
+ retriesCounter.set(0);
+ }
+
+ @Test
+ void whenRetryingTask_thenReturnsCorrectlyAfterFourInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryTask(codeToRun, 10);
+
+ assertThat(result.join()).isEqualTo(100);
+ assertThat(retriesCounter).hasValue(4);
+ }
+
+ @Test
+ void whenRetryingTask_thenThrowsExceptionAfterThreeInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryTask(codeToRun, 3);
+
+ assertThatThrownBy(result::join)
+ .isInstanceOf(CompletionException.class)
+ .hasMessageContaining("IllegalStateException: Task failed after 3 attempts");
+ }
+
+ @Test
+ void whenRetryingExceptionally_thenReturnsCorrectlyAfterFourInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryUnsafe(codeToRun, 10);
+
+ assertThat(result.join()).isEqualTo(100);
+ assertThat(retriesCounter).hasValue(4);
+ }
+
+ @Test
+ void whenRetryingExceptionally_thenThrowsExceptionAfterThreeInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryUnsafe(codeToRun, 3);
+
+ assertThatThrownBy(result::join)
+ .isInstanceOf(CompletionException.class)
+ .hasMessageContaining("RuntimeException: task failed for 3 time(s)");
+ }
+
+ @Test
+ void whenRetryingExceptionallyAsync_thenReturnsCorrectlyAfterFourInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryExceptionallyAsync(codeToRun, 10);
+
+ assertThat(result.join()).isEqualTo(100);
+ assertThat(retriesCounter).hasValue(4);
+ }
+
+ @Test
+ void whenRetryingExceptionallyAsync_thenThrowsExceptionAfterThreeInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryExceptionallyAsync(codeToRun, 3);
+
+ assertThatThrownBy(result::join)
+ .isInstanceOf(CompletionException.class)
+ .hasMessageContaining("RuntimeException: task failed for 3 time(s)");
+ }
+
+ @Test
+ void whenRetryingNesting_thenReturnsCorrectlyAfterFourInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryNesting(codeToRun, 10);
+
+ assertThat(result.join()).isEqualTo(100);
+ assertThat(retriesCounter).hasValue(4);
+ }
+
+ @Test
+ void whenRetryingNesting_thenThrowsExceptionAfterThreeInvocations() {
+ Supplier codeToRun = () -> failFourTimesThenReturn(100);
+
+ CompletableFuture result = retryNesting(codeToRun, 3);
+
+ assertThatThrownBy(result::join)
+ .isInstanceOf(CompletionException.class)
+ .hasMessageContaining("RuntimeException: task failed for 3 time(s)");
+ }
+
+ int failFourTimesThenReturn(int returnValue) {
+ int retryNr = retriesCounter.get();
+ System.out.println(String.format("invocation: %s, thread: %s", retryNr, Thread.currentThread().getName()));
+ if (retryNr < 4) {
+ retriesCounter.set(retryNr + 1);
+ throw new RuntimeException(String.format("task failed for %s time(s)", retryNr));
+ }
+ return returnValue;
+ }
+
+}
diff --git a/core-java-modules/core-java-numbers-6/src/test/java/com/baeldung/truncatedouble/TruncateDoubleUnitTest.java b/core-java-modules/core-java-numbers-6/src/test/java/com/baeldung/truncatedouble/TruncateDoubleUnitTest.java
new file mode 100644
index 0000000000..1bbca4069f
--- /dev/null
+++ b/core-java-modules/core-java-numbers-6/src/test/java/com/baeldung/truncatedouble/TruncateDoubleUnitTest.java
@@ -0,0 +1,73 @@
+package com.baeldung.truncatedouble;
+
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.junit.Test;
+
+public class TruncateDoubleUnitTest {
+
+ @Test
+ public void givenADouble_whenUsingDecimalFormat_truncateToTwoDecimalPlaces() {
+ DecimalFormat df = new DecimalFormat("#.##");
+ df.setRoundingMode(RoundingMode.DOWN);
+
+ double value = 1.55555555;
+ String truncated = df.format(value);
+ assertEquals("1.55", truncated);
+
+ double negativeValue = -1.55555555;
+ String negativeTruncated = df.format(negativeValue);
+ assertEquals("-1.55", negativeTruncated);
+ }
+
+ @Test
+ public void givenADouble_whenUsingNumberFormat_truncateToTwoDecimalPlaces() {
+ NumberFormat nf = NumberFormat.getNumberInstance();
+ nf.setMaximumFractionDigits(2);
+ nf.setRoundingMode(RoundingMode.DOWN);
+
+ double value = 1.55555555;
+ String truncated = nf.format(value);
+ assertEquals("1.55", truncated);
+
+ double negativeValue = -1.55555555;
+ String negativeTruncated = nf.format(negativeValue);
+ assertEquals("-1.55", negativeTruncated);
+ }
+
+ @Test
+ public void givenADouble_whenUsingBigDecimal_truncateToTwoDecimalPlaces() {
+ BigDecimal positive = new BigDecimal(2.555555).setScale(2, RoundingMode.DOWN);
+ BigDecimal negative = new BigDecimal(-2.555555).setScale(2, RoundingMode.DOWN);
+ assertEquals("2.55", positive.toString());
+ assertEquals("-2.55", negative.toString());
+ }
+
+ @Test
+ public void givenADouble_whenUsingMath_truncateToTwoDecimalPlaces() {
+ double positive = 1.55555555;
+ double truncated = Math.floor(positive * 100) / 100;
+ assertEquals("1.55", String.valueOf(truncated));
+
+ double negative = -1.55555555;
+ double negativeTruncated = Math.ceil(negative * 100) / 100;
+ assertEquals("-1.55", String.valueOf(negativeTruncated));
+ }
+
+ @Test
+ public void givenADouble_whenUsingStringFormat_truncateToTwoDecimalPlaces() {
+ double positive = 1.55555555;
+ String truncated = String.format("%.2f", positive);
+ assertEquals("1.56", truncated);
+
+ double negative = -1.55555555;
+ String negativeTruncated = String.format("%.2f", negative);
+ assertEquals("-1.56", negativeTruncated);
+ }
+
+}
diff --git a/core-java-modules/core-java-numbers-conversions/src/test/java/com/baeldung/floatdoubleconversions/FloatDoubleConversionsTest.java b/core-java-modules/core-java-numbers-conversions/src/test/java/com/baeldung/floatdoubleconversions/FloatDoubleConversionsTest.java
index 9c6b01e9de..9da50276a9 100644
--- a/core-java-modules/core-java-numbers-conversions/src/test/java/com/baeldung/floatdoubleconversions/FloatDoubleConversionsTest.java
+++ b/core-java-modules/core-java-numbers-conversions/src/test/java/com/baeldung/floatdoubleconversions/FloatDoubleConversionsTest.java
@@ -7,23 +7,27 @@ public class FloatDoubleConversionsTest {
@Test
public void whenDoubleType_thenFloatTypeSuccess(){
- double interestRatesYearly = 13.333333333333334;
+ double interestRatesYearly = 13.333333333333333;
float interest = (float) interestRatesYearly;
- Assert.assertEquals(13.333333f, interest, 0.000004f);
+ System.out.println(interest); //13.333333
+ Assert.assertEquals(13.333333f, interest, 0.000001f);
- Double monthlyRates = 2.111111111111112;
+ Double monthlyRates = 2.111111111111111;
float rates = monthlyRates.floatValue();
- Assert.assertEquals(2.1111112f, rates, 0.00000013);
+ System.out.println(rates); //2.1111112
+ Assert.assertEquals(2.1111111f, rates, 0.0000001f);
}
@Test
public void whenFloatType_thenDoubleTypeSuccess(){
float gradeAverage =2.05f;
double average = gradeAverage;
- Assert.assertEquals(2.05, average, 0.06);
+ System.out.println(average); //2.049999952316284
+ Assert.assertEquals(2.05, average, 0.01);
- Float monthlyRates = 2.1111112f;
+ Float monthlyRates = 2.1111111f;
Double rates = monthlyRates.doubleValue();
- Assert.assertEquals(2.11111112, rates, 0.0000002);//true
+ System.out.println(rates); //2.1111111640930176
+ Assert.assertEquals(2.11111111, rates, 0.0000001);//true
}
}
diff --git a/core-java-modules/core-java-string-operations-7/README.md b/core-java-modules/core-java-string-operations-7/README.md
index 2dce44d217..7020369f02 100644
--- a/core-java-modules/core-java-string-operations-7/README.md
+++ b/core-java-modules/core-java-string-operations-7/README.md
@@ -1,2 +1,3 @@
### Relevant Articles:
+[How to Center Text Output in Java](https://www.baeldung.com/java-center-text-output)
diff --git a/core-java-modules/core-java-string-operations-7/pom.xml b/core-java-modules/core-java-string-operations-7/pom.xml
index 595f918fcd..a2c7036e34 100644
--- a/core-java-modules/core-java-string-operations-7/pom.xml
+++ b/core-java-modules/core-java-string-operations-7/pom.xml
@@ -1,72 +1,72 @@
-
-
- 4.0.0
- core-java-string-operations-7
- core-java-string-operations-7
- jar
-
-
- com.baeldung.core-java-modules
- core-java-modules
- 0.0.1-SNAPSHOT
-
-
-
-
- org.apache.commons
- commons-lang3
- ${apache.commons.lang3.version}
-
-
- org.apache.commons
- commons-text
- ${commons-text.version}
-
-
- org.liquibase
- liquibase-core
- 4.9.1
- test
-
-
- org.junit.jupiter
- junit-jupiter
- 5.8.1
- test
-
-
- org.liquibase
- liquibase-core
- 4.9.1
- test
-
-
- junit
- junit
- 4.13.2
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- ${maven.compiler.target}
-
-
-
-
-
-
- 11
- 11
- 3.12.0
- 1.10.0
-
-
+
+
+ 4.0.0
+ core-java-string-operations-7
+ core-java-string-operations-7
+ jar
+
+
+ com.baeldung.core-java-modules
+ core-java-modules
+ 0.0.1-SNAPSHOT
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${apache.commons.lang3.version}
+
+
+ org.apache.commons
+ commons-text
+ ${commons-text.version}
+
+
+ org.liquibase
+ liquibase-core
+ 4.9.1
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.8.1
+ test
+
+
+ org.liquibase
+ liquibase-core
+ 4.9.1
+ test
+
+
+ junit
+ junit
+ 4.13.2
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${maven.compiler.target}
+
+
+
+
+
+
+ 11
+ 11
+ 3.13.0
+ 1.10.0
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtils.java b/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtils.java
new file mode 100644
index 0000000000..cccc745499
--- /dev/null
+++ b/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtils.java
@@ -0,0 +1,40 @@
+package com.baeldung.capitalizefirstcharactereachword;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+
+class CapitalizeFirstCharacterEachWordUtils {
+
+ static String usingCharacterToUpperCaseMethod(String input) {
+ if (input == null || input.isEmpty()) {
+ return null;
+ }
+
+ return Arrays.stream(input.split("\\s+"))
+ .map(word -> Character.toUpperCase(word.charAt(0)) + word.substring(1))
+ .collect(Collectors.joining(" "));
+ }
+
+ static String usingStringToUpperCaseMethod(String input) {
+ if (input == null || input.isEmpty()) {
+ return null;
+ }
+
+ return Arrays.stream(input.split("\\s+"))
+ .map(word -> word.substring(0, 1).toUpperCase() + word.substring(1))
+ .collect(Collectors.joining(" "));
+ }
+
+ static String usingStringUtilsClass(String input) {
+ if (input == null || input.isEmpty()) {
+ return null;
+ }
+
+ return Arrays.stream(input.split("\\s+"))
+ .map(StringUtils::capitalize)
+ .collect(Collectors.joining(" "));
+ }
+
+}
diff --git a/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/strcontainsnumber/StrContainsNumberUtils.java b/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/strcontainsnumber/StrContainsNumberUtils.java
new file mode 100644
index 0000000000..a609b94cb8
--- /dev/null
+++ b/core-java-modules/core-java-string-operations-7/src/main/java/com/baeldung/strcontainsnumber/StrContainsNumberUtils.java
@@ -0,0 +1,77 @@
+package com.baeldung.strcontainsnumber;
+
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.google.common.base.CharMatcher;
+
+public class StrContainsNumberUtils {
+
+ static boolean checkUsingMatchesMethod(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ return input.matches(".*\\d.*");
+ }
+
+ static boolean checkUsingPatternClass(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ return Pattern.compile(".*\\d.*")
+ .matcher(input)
+ .matches();
+ }
+
+ static boolean checkUsingReplaceAllMethod(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ String result = input.replaceAll("\\d", "");
+ return result.length() != input.length();
+ }
+
+ static boolean checkUsingIsDigitMethod(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ for (char c : input.toCharArray()) {
+ if (Character.isDigit(c)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static boolean checkUsingStreamApi(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ return input.chars()
+ .anyMatch(Character::isDigit);
+ }
+
+ static boolean checkUsingApacheCommonsLang(String input) {
+ String result = StringUtils.getDigits(input);
+ return result != null && !result.isEmpty();
+ }
+
+ static boolean checkUsingGuava(String input) {
+ if (input == null || input.isEmpty()) {
+ return false;
+ }
+
+ String result = CharMatcher.forPredicate(Character::isDigit)
+ .retainFrom(input);
+
+ return !result.isEmpty();
+ }
+
+}
diff --git a/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtilsUnitTest.java b/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtilsUnitTest.java
new file mode 100644
index 0000000000..27c7ddb4c4
--- /dev/null
+++ b/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/capitalizefirstcharactereachword/CapitalizeFirstCharacterEachWordUtilsUnitTest.java
@@ -0,0 +1,38 @@
+package com.baeldung.capitalizefirstcharactereachword;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.commons.text.WordUtils;
+import org.junit.jupiter.api.Test;
+
+class CapitalizeFirstCharacterEachWordUtilsUnitTest {
+
+ @Test
+ void givenString_whenUsingCharacterToUpperCaseMethod_thenCapitalizeFirstCharacter() {
+ String input = "hello baeldung visitors";
+
+ assertEquals("Hello Baeldung Visitors", CapitalizeFirstCharacterEachWordUtils.usingCharacterToUpperCaseMethod(input));
+ }
+
+ @Test
+ void givenString_whenUsingSubstringMethod_thenCapitalizeFirstCharacter() {
+ String input = "Hi, my name is azhrioun";
+
+ assertEquals("Hi, My Name Is Azhrioun", CapitalizeFirstCharacterEachWordUtils.usingStringToUpperCaseMethod(input));
+ }
+
+ @Test
+ void givenString_whenUsingStringUtilsClass_thenCapitalizeFirstCharacter() {
+ String input = "life is short the world is wide";
+
+ assertEquals("Life Is Short The World Is Wide", CapitalizeFirstCharacterEachWordUtils.usingStringUtilsClass(input));
+ }
+
+ @Test
+ void givenString_whenUsingWordUtilsClass_thenCapitalizeFirstCharacter() {
+ String input = "smile sunshine is good for your teeth";
+
+ assertEquals("Smile Sunshine Is Good For Your Teeth", WordUtils.capitalizeFully(input));
+ }
+
+}
diff --git a/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/strcontainsnumber/StrContainsNumberUtilsUnitTest.java b/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/strcontainsnumber/StrContainsNumberUtilsUnitTest.java
new file mode 100644
index 0000000000..9a60a827e0
--- /dev/null
+++ b/core-java-modules/core-java-string-operations-7/src/test/java/com/baeldung/strcontainsnumber/StrContainsNumberUtilsUnitTest.java
@@ -0,0 +1,69 @@
+package com.baeldung.strcontainsnumber;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+import org.junit.Test;
+
+public class StrContainsNumberUtilsUnitTest {
+
+ private static final String INPUT_WITH_NUMBERS = "We hope 2024 will be great";
+ private static final String INPUT_WITHOUT_NUMBERS = "Hello world";
+
+ @Test
+ public void givenInputString_whenUsingMatchesMethod_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingMatchesMethod(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingMatchesMethod(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingMatchesMethod(""));
+ assertFalse(StrContainsNumberUtils.checkUsingMatchesMethod(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingPatternClass_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingPatternClass(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingPatternClass(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingPatternClass(""));
+ assertFalse(StrContainsNumberUtils.checkUsingPatternClass(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingReplaceAllMethod_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingReplaceAllMethod(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingReplaceAllMethod(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingReplaceAllMethod(""));
+ assertFalse(StrContainsNumberUtils.checkUsingReplaceAllMethod(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingIsDigitMethod_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingIsDigitMethod(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingIsDigitMethod(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingIsDigitMethod(""));
+ assertFalse(StrContainsNumberUtils.checkUsingIsDigitMethod(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingStreamApi_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingStreamApi(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingStreamApi(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingStreamApi(""));
+ assertFalse(StrContainsNumberUtils.checkUsingStreamApi(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingApacheCommonsLang_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingApacheCommonsLang(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingApacheCommonsLang(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingApacheCommonsLang(""));
+ assertFalse(StrContainsNumberUtils.checkUsingApacheCommonsLang(null));
+ }
+
+ @Test
+ public void givenInputString_whenUsingGuava_ThenCheck() {
+ assertTrue(StrContainsNumberUtils.checkUsingGuava(INPUT_WITH_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingGuava(INPUT_WITHOUT_NUMBERS));
+ assertFalse(StrContainsNumberUtils.checkUsingGuava(""));
+ assertFalse(StrContainsNumberUtils.checkUsingGuava(null));
+ }
+
+}
diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml
index 2152b90bcb..bf5b90cd32 100644
--- a/core-java-modules/pom.xml
+++ b/core-java-modules/pom.xml
@@ -73,6 +73,7 @@
core-java-arrays-multidimensional
core-java-arrays-convert
core-java-arrays-operations-basic
+ core-java-arrays-operations-basic-2
core-java-arrays-operations-advanced
core-java-arrays-operations-advanced-2
core-java-booleans
diff --git a/axon/README.md b/patterns-modules/axon/README.md
similarity index 100%
rename from axon/README.md
rename to patterns-modules/axon/README.md
diff --git a/axon/pom.xml b/patterns-modules/axon/pom.xml
similarity index 98%
rename from axon/pom.xml
rename to patterns-modules/axon/pom.xml
index 5eed742aab..473a1b0e15 100644
--- a/axon/pom.xml
+++ b/patterns-modules/axon/pom.xml
@@ -11,7 +11,7 @@
com.baeldung
parent-boot-2
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../../parent-boot-2
diff --git a/axon/src/main/java/com/baeldung/axon/OrderApplication.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/OrderApplication.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/OrderApplication.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/OrderApplication.java
diff --git a/axon/src/main/java/com/baeldung/axon/OrderApplicationConfiguration.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/OrderApplicationConfiguration.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/OrderApplicationConfiguration.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/OrderApplicationConfiguration.java
diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderAggregate.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderAggregate.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderAggregate.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderAggregate.java
diff --git a/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderLine.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderLine.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderLine.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/commandmodel/order/OrderLine.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/AddProductCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/AddProductCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/AddProductCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/AddProductCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/ConfirmOrderCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateOrderCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateOrderCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateOrderCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/CreateOrderCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/DecrementProductCountCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/DecrementProductCountCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/DecrementProductCountCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/DecrementProductCountCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/IncrementProductCountCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/IncrementProductCountCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/IncrementProductCountCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/IncrementProductCountCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/commands/ShipOrderCommand.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderConfirmedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderCreatedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderCreatedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/OrderCreatedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderCreatedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/OrderShippedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductAddedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductAddedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/ProductAddedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductAddedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountDecrementedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountDecrementedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountDecrementedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountDecrementedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountIncrementedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountIncrementedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountIncrementedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductCountIncrementedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductRemovedEvent.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductRemovedEvent.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/events/ProductRemovedEvent.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/events/ProductRemovedEvent.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/DuplicateOrderLineException.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/DuplicateOrderLineException.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/exceptions/DuplicateOrderLineException.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/DuplicateOrderLineException.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/OrderAlreadyConfirmedException.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/OrderAlreadyConfirmedException.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/exceptions/OrderAlreadyConfirmedException.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/OrderAlreadyConfirmedException.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/UnconfirmedOrderException.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/UnconfirmedOrderException.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/exceptions/UnconfirmedOrderException.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/exceptions/UnconfirmedOrderException.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/FindAllOrderedProductsQuery.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/Order.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/Order.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/queries/Order.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/Order.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderStatus.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderUpdatesQuery.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderUpdatesQuery.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderUpdatesQuery.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/OrderUpdatesQuery.java
diff --git a/axon/src/main/java/com/baeldung/axon/coreapi/queries/TotalProductsShippedQuery.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/TotalProductsShippedQuery.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/coreapi/queries/TotalProductsShippedQuery.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/coreapi/queries/TotalProductsShippedQuery.java
diff --git a/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/gui/OrderRestEndpoint.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandler.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandler.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandler.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandler.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/LegacyQueryHandler.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/LegacyQueryHandler.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/LegacyQueryHandler.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/LegacyQueryHandler.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/MongoConfiguration.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/MongoConfiguration.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/MongoConfiguration.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/MongoConfiguration.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/MongoOrdersEventHandler.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/MongoOrdersEventHandler.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/MongoOrdersEventHandler.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/MongoOrdersEventHandler.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderQueryService.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderQueryService.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/OrderQueryService.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderQueryService.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderResponse.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderResponse.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/OrderResponse.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderResponse.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrderStatusResponse.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderStatusResponse.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/OrderStatusResponse.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrderStatusResponse.java
diff --git a/axon/src/main/java/com/baeldung/axon/querymodel/OrdersEventHandler.java b/patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrdersEventHandler.java
similarity index 100%
rename from axon/src/main/java/com/baeldung/axon/querymodel/OrdersEventHandler.java
rename to patterns-modules/axon/src/main/java/com/baeldung/axon/querymodel/OrdersEventHandler.java
diff --git a/axon/src/main/resources/application-mongo.properties b/patterns-modules/axon/src/main/resources/application-mongo.properties
similarity index 100%
rename from axon/src/main/resources/application-mongo.properties
rename to patterns-modules/axon/src/main/resources/application-mongo.properties
diff --git a/axon/src/main/resources/application.properties b/patterns-modules/axon/src/main/resources/application.properties
similarity index 100%
rename from axon/src/main/resources/application.properties
rename to patterns-modules/axon/src/main/resources/application.properties
diff --git a/axon/src/main/resources/logback.xml b/patterns-modules/axon/src/main/resources/logback.xml
similarity index 100%
rename from axon/src/main/resources/logback.xml
rename to patterns-modules/axon/src/main/resources/logback.xml
diff --git a/axon/src/main/resources/order-api.http b/patterns-modules/axon/src/main/resources/order-api.http
similarity index 100%
rename from axon/src/main/resources/order-api.http
rename to patterns-modules/axon/src/main/resources/order-api.http
diff --git a/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/commandmodel/OrderAggregateUnitTest.java
diff --git a/axon/src/test/java/com/baeldung/axon/gui/OrderRestEndpointManualTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/gui/OrderRestEndpointManualTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/gui/OrderRestEndpointManualTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/gui/OrderRestEndpointManualTest.java
diff --git a/axon/src/test/java/com/baeldung/axon/querymodel/AbstractOrdersEventHandlerUnitTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/AbstractOrdersEventHandlerUnitTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/querymodel/AbstractOrdersEventHandlerUnitTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/AbstractOrdersEventHandlerUnitTest.java
diff --git a/axon/src/test/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandlerUnitTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandlerUnitTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandlerUnitTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/InMemoryOrdersEventHandlerUnitTest.java
diff --git a/axon/src/test/java/com/baeldung/axon/querymodel/MongoOrdersEventHandlerUnitTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/MongoOrdersEventHandlerUnitTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/querymodel/MongoOrdersEventHandlerUnitTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/MongoOrdersEventHandlerUnitTest.java
diff --git a/axon/src/test/java/com/baeldung/axon/querymodel/OrderQueryServiceIntegrationTest.java b/patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/OrderQueryServiceIntegrationTest.java
similarity index 100%
rename from axon/src/test/java/com/baeldung/axon/querymodel/OrderQueryServiceIntegrationTest.java
rename to patterns-modules/axon/src/test/java/com/baeldung/axon/querymodel/OrderQueryServiceIntegrationTest.java
diff --git a/axon/src/test/resources/application.properties b/patterns-modules/axon/src/test/resources/application.properties
similarity index 100%
rename from axon/src/test/resources/application.properties
rename to patterns-modules/axon/src/test/resources/application.properties
diff --git a/axon/start_axon_server.sh b/patterns-modules/axon/start_axon_server.sh
old mode 100755
new mode 100644
similarity index 100%
rename from axon/start_axon_server.sh
rename to patterns-modules/axon/start_axon_server.sh
diff --git a/axon/start_mongo.sh b/patterns-modules/axon/start_mongo.sh
old mode 100755
new mode 100644
similarity index 100%
rename from axon/start_mongo.sh
rename to patterns-modules/axon/start_mongo.sh
diff --git a/ddd-contexts/README.md b/patterns-modules/ddd-contexts/README.md
similarity index 100%
rename from ddd-contexts/README.md
rename to patterns-modules/ddd-contexts/README.md
diff --git a/ddd-contexts/ddd-contexts-infrastructure/pom.xml b/patterns-modules/ddd-contexts/ddd-contexts-infrastructure/pom.xml
similarity index 100%
rename from ddd-contexts/ddd-contexts-infrastructure/pom.xml
rename to patterns-modules/ddd-contexts/ddd-contexts-infrastructure/pom.xml
diff --git a/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/db/InMemoryOrderStore.java b/patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/db/InMemoryOrderStore.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/db/InMemoryOrderStore.java
rename to patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/db/InMemoryOrderStore.java
diff --git a/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/events/SimpleEventBus.java b/patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/events/SimpleEventBus.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/events/SimpleEventBus.java
rename to patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/com/baeldung/dddcontexts/infrastructure/events/SimpleEventBus.java
diff --git a/ddd-contexts/ddd-contexts-infrastructure/src/main/java/module-info.java b/patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/module-info.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-infrastructure/src/main/java/module-info.java
rename to patterns-modules/ddd-contexts/ddd-contexts-infrastructure/src/main/java/module-info.java
diff --git a/ddd-contexts/ddd-contexts-mainapp/pom.xml b/patterns-modules/ddd-contexts/ddd-contexts-mainapp/pom.xml
similarity index 100%
rename from ddd-contexts/ddd-contexts-mainapp/pom.xml
rename to patterns-modules/ddd-contexts/ddd-contexts-mainapp/pom.xml
diff --git a/ddd-contexts/ddd-contexts-mainapp/src/main/java/com/baeldung/dddcontexts/mainapp/Application.java b/patterns-modules/ddd-contexts/ddd-contexts-mainapp/src/main/java/com/baeldung/dddcontexts/mainapp/Application.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-mainapp/src/main/java/com/baeldung/dddcontexts/mainapp/Application.java
rename to patterns-modules/ddd-contexts/ddd-contexts-mainapp/src/main/java/com/baeldung/dddcontexts/mainapp/Application.java
diff --git a/ddd-contexts/ddd-contexts-mainapp/src/main/java/module-info.java b/patterns-modules/ddd-contexts/ddd-contexts-mainapp/src/main/java/module-info.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-mainapp/src/main/java/module-info.java
rename to patterns-modules/ddd-contexts/ddd-contexts-mainapp/src/main/java/module-info.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/pom.xml b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/pom.xml
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/pom.xml
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/pom.xml
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/CustomerOrder.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/CustomerOrder.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/CustomerOrder.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/CustomerOrder.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/OrderItem.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/OrderItem.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/OrderItem.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/model/OrderItem.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/repository/CustomerOrderRepository.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/repository/CustomerOrderRepository.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/repository/CustomerOrderRepository.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/repository/CustomerOrderRepository.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/CustomerOrderService.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/CustomerOrderService.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/CustomerOrderService.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/CustomerOrderService.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/OrderService.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/OrderService.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/OrderService.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/com/baeldung/dddcontexts/ordercontext/service/OrderService.java
diff --git a/ddd-contexts/ddd-contexts-ordercontext/src/main/java/module-info.java b/patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/module-info.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-ordercontext/src/main/java/module-info.java
rename to patterns-modules/ddd-contexts/ddd-contexts-ordercontext/src/main/java/module-info.java
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/pom.xml b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/pom.xml
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/pom.xml
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/pom.xml
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/ApplicationEvent.java b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/ApplicationEvent.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/ApplicationEvent.java
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/ApplicationEvent.java
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventBus.java b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventBus.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventBus.java
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventBus.java
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventSubscriber.java b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventSubscriber.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventSubscriber.java
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/events/EventSubscriber.java
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/service/ApplicationService.java b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/service/ApplicationService.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/service/ApplicationService.java
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/com/baeldung/dddcontexts/sharedkernel/service/ApplicationService.java
diff --git a/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/module-info.java b/patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/module-info.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-sharedkernel/src/main/java/module-info.java
rename to patterns-modules/ddd-contexts/ddd-contexts-sharedkernel/src/main/java/module-info.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/pom.xml b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/pom.xml
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/pom.xml
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/pom.xml
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/PackageItem.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/PackageItem.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/PackageItem.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/PackageItem.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/Parcel.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/Parcel.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/Parcel.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/Parcel.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/ShippableOrder.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/ShippableOrder.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/ShippableOrder.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/model/ShippableOrder.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/repository/ShippingOrderRepository.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/repository/ShippingOrderRepository.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/repository/ShippingOrderRepository.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/repository/ShippingOrderRepository.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ParcelShippingService.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ParcelShippingService.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ParcelShippingService.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ParcelShippingService.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ShippingService.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ShippingService.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ShippingService.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/com/baeldung/dddcontexts/shippingcontext/service/ShippingService.java
diff --git a/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/module-info.java b/patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/module-info.java
similarity index 100%
rename from ddd-contexts/ddd-contexts-shippingcontext/src/main/java/module-info.java
rename to patterns-modules/ddd-contexts/ddd-contexts-shippingcontext/src/main/java/module-info.java
diff --git a/ddd-contexts/pom.xml b/patterns-modules/ddd-contexts/pom.xml
similarity index 98%
rename from ddd-contexts/pom.xml
rename to patterns-modules/ddd-contexts/pom.xml
index 961a1d1624..f43581b0c8 100644
--- a/ddd-contexts/pom.xml
+++ b/patterns-modules/ddd-contexts/pom.xml
@@ -11,7 +11,7 @@
com.baeldung
- parent-modules
+ patterns-modules
1.0.0-SNAPSHOT
diff --git a/ddd/README.md b/patterns-modules/ddd/README.md
similarity index 100%
rename from ddd/README.md
rename to patterns-modules/ddd/README.md
diff --git a/ddd/pom.xml b/patterns-modules/ddd/pom.xml
similarity index 98%
rename from ddd/pom.xml
rename to patterns-modules/ddd/pom.xml
index 443b2b5148..80147c29c6 100644
--- a/ddd/pom.xml
+++ b/patterns-modules/ddd/pom.xml
@@ -12,7 +12,7 @@
com.baeldung
parent-boot-2
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../../parent-boot-2
diff --git a/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java
similarity index 96%
rename from ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java
index 3a52fd0440..2d671ff85e 100644
--- a/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java
+++ b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java
@@ -1,12 +1,12 @@
-package com.baeldung.ddd;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication(scanBasePackages = "com.baeldung.ddd.order")
-public class PersistingDddAggregatesApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(PersistingDddAggregatesApplication.class, args);
- }
-}
+package com.baeldung.ddd;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = "com.baeldung.ddd.order")
+public class PersistingDddAggregatesApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(PersistingDddAggregatesApplication.class, args);
+ }
+}
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/Order.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/Order.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/Order.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/Order.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/Product.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/Product.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/Product.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/Product.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/AmountBasedDiscountPolicy.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/AmountBasedDiscountPolicy.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/AmountBasedDiscountPolicy.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/AmountBasedDiscountPolicy.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/DiscountPolicy.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/DiscountPolicy.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/DiscountPolicy.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/DiscountPolicy.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/FlatDiscountPolicy.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/FlatDiscountPolicy.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/FlatDiscountPolicy.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/FlatDiscountPolicy.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/Order.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/Order.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/Order.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/Order.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialDiscountPolicy.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialDiscountPolicy.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialDiscountPolicy.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialDiscountPolicy.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialOrder.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialOrder.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialOrder.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialOrder.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/HtmlOrderViewCreator.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/HtmlOrderViewCreator.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/HtmlOrderViewCreator.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/HtmlOrderViewCreator.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/OrderVisitor.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/OrderVisitor.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/OrderVisitor.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/OrderVisitor.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/Visitable.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/Visitable.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/Visitable.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/visitor/Visitable.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java
diff --git a/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/AddProductRequest.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/request/CreateOrderRequest.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/response/CreateOrderResponse.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/DomainException.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderItem.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/OrderStatus.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Product.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/repository/OrderRepository.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderService.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/service/OrderService.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/BeanConfiguration.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java
diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java b/patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java
similarity index 100%
rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java
rename to patterns-modules/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java
diff --git a/ddd/src/main/resources/ddd-layers.properties b/patterns-modules/ddd/src/main/resources/ddd-layers.properties
similarity index 100%
rename from ddd/src/main/resources/ddd-layers.properties
rename to patterns-modules/ddd/src/main/resources/ddd-layers.properties
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/OrderFixtureUtils.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/OrderFixtureUtils.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/OrderFixtureUtils.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/OrderFixtureUtils.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/OrderUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/OrderUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/OrderUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/OrderUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/DoubleDispatchDiscountPolicyUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/DoubleDispatchDiscountPolicyUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/DoubleDispatchDiscountPolicyUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/DoubleDispatchDiscountPolicyUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/HtmlOrderViewCreatorUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/HtmlOrderViewCreatorUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/HtmlOrderViewCreatorUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/HtmlOrderViewCreatorUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/MethodOverloadExampleUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/MethodOverloadExampleUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/MethodOverloadExampleUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/MethodOverloadExampleUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/SingleDispatchDiscountPolicyUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/SingleDispatchDiscountPolicyUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/SingleDispatchDiscountPolicyUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/doubledispatch/SingleDispatchDiscountPolicyUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderProvider.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/OrderUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/domain/service/DomainOrderServiceUnitTest.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java
diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java b/patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java
similarity index 100%
rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java
rename to patterns-modules/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java
diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md b/patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md
similarity index 100%
rename from ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md
rename to patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md
diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql b/patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql
similarity index 100%
rename from ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql
rename to patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql
diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml b/patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml
similarity index 100%
rename from ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml
rename to patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml
diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js b/patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js
similarity index 100%
rename from ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js
rename to patterns-modules/ddd/src/test/resources/com/baeldung/dddhexagonalspring/mongo-init.js
diff --git a/ddd/src/test/resources/ddd-layers-test.properties b/patterns-modules/ddd/src/test/resources/ddd-layers-test.properties
similarity index 100%
rename from ddd/src/test/resources/ddd-layers-test.properties
rename to patterns-modules/ddd/src/test/resources/ddd-layers-test.properties
diff --git a/patterns-modules/pom.xml b/patterns-modules/pom.xml
index add2b0475b..7dd26ac31c 100644
--- a/patterns-modules/pom.xml
+++ b/patterns-modules/pom.xml
@@ -14,6 +14,12 @@
+ axon
+ clean-architecture
+ coupling
+ cqrs-es
+ ddd
+ ddd-contexts
design-patterns-architectural
design-patterns-behavioral
design-patterns-behavioral-2
@@ -24,14 +30,11 @@
design-patterns-singleton
design-patterns-structural
dip
- cqrs-es
+ enterprise-patterns
front-controller
+ idd
intercepting-filter
solid
- clean-architecture
- enterprise-patterns
- coupling
- idd
diff --git a/couchbase/.gitignore b/persistence-modules/couchbase/.gitignore
similarity index 100%
rename from couchbase/.gitignore
rename to persistence-modules/couchbase/.gitignore
diff --git a/couchbase/README.md b/persistence-modules/couchbase/README.md
similarity index 100%
rename from couchbase/README.md
rename to persistence-modules/couchbase/README.md
diff --git a/couchbase/mvnw b/persistence-modules/couchbase/mvnw
similarity index 100%
rename from couchbase/mvnw
rename to persistence-modules/couchbase/mvnw
diff --git a/couchbase/mvnw.cmd b/persistence-modules/couchbase/mvnw.cmd
similarity index 100%
rename from couchbase/mvnw.cmd
rename to persistence-modules/couchbase/mvnw.cmd
diff --git a/couchbase/pom.xml b/persistence-modules/couchbase/pom.xml
similarity index 98%
rename from couchbase/pom.xml
rename to persistence-modules/couchbase/pom.xml
index 823b33ee29..b98c0cc387 100644
--- a/couchbase/pom.xml
+++ b/persistence-modules/couchbase/pom.xml
@@ -10,7 +10,7 @@
com.baeldung
- parent-modules
+ persistence-modules
1.0.0-SNAPSHOT
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java
diff --git a/couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java b/persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java
similarity index 100%
rename from couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java
rename to persistence-modules/couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java
diff --git a/couchbase/src/main/resources/application.properties b/persistence-modules/couchbase/src/main/resources/application.properties
similarity index 100%
rename from couchbase/src/main/resources/application.properties
rename to persistence-modules/couchbase/src/main/resources/application.properties
diff --git a/couchbase/src/main/resources/logback.xml b/persistence-modules/couchbase/src/main/resources/logback.xml
similarity index 100%
rename from couchbase/src/main/resources/logback.xml
rename to persistence-modules/couchbase/src/main/resources/logback.xml
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTestConfig.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTestConfig.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTestConfig.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTestConfig.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceLiveTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceLiveTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceLiveTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLLiveTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceLiveTest.java
diff --git a/couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceLiveTest.java b/persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceLiveTest.java
similarity index 100%
rename from couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceLiveTest.java
rename to persistence-modules/couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceLiveTest.java
diff --git a/couchbase/src/test/resources/logback.xml b/persistence-modules/couchbase/src/test/resources/logback.xml
similarity index 100%
rename from couchbase/src/test/resources/logback.xml
rename to persistence-modules/couchbase/src/test/resources/logback.xml
diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml
index 162894f1e0..53e408c3a5 100644
--- a/persistence-modules/pom.xml
+++ b/persistence-modules/pom.xml
@@ -21,7 +21,7 @@
blaze-persistence
core-java-persistence
core-java-persistence-2
- core-java-persistence-3
+ couchbase
elasticsearch
flyway
flyway-repair
diff --git a/persistence-modules/spring-data-cassandra-2/src/test/java/org/baeldung/cassandra/inquery/ProductRepositoryNestedLiveTest.java b/persistence-modules/spring-data-cassandra-2/src/test/java/org/baeldung/cassandra/inquery/ProductRepositoryNestedLiveTest.java
index 3592c8b80d..3d99782afd 100644
--- a/persistence-modules/spring-data-cassandra-2/src/test/java/org/baeldung/cassandra/inquery/ProductRepositoryNestedLiveTest.java
+++ b/persistence-modules/spring-data-cassandra-2/src/test/java/org/baeldung/cassandra/inquery/ProductRepositoryNestedLiveTest.java
@@ -20,7 +20,9 @@ import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
-
+/**
+ * This live test requires a running Docker instance so that a Cassandra container can be created
+ */
@Testcontainers
@SpringBootTest
class ProductRepositoryNestedLiveTest {
diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java
index 14d5403cb5..7b5a307b81 100644
--- a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java
+++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java
@@ -12,6 +12,9 @@ interface PassengerRepository extends JpaRepository, CustomPass
Passenger findTopByOrderBySeatNumberAsc();
List findByOrderBySeatNumberAsc();
+
+ //The Limit type is a new feature in Spring Data JPA version 3.2
+ //List findByOrderBySeatNumberAsc(Limit limit);
List findByFirstNameIgnoreCase(String firstName);
diff --git a/pom.xml b/pom.xml
index 327d83017f..07b9d6d842 100644
--- a/pom.xml
+++ b/pom.xml
@@ -765,13 +765,11 @@
aws-modules
checker-framework
- couchbase
core-groovy-modules
core-java-modules
custom-pmd
data-structures
- ddd-contexts
jackson-modules
jmh
deeplearning4j
@@ -821,11 +819,8 @@
atomikos
atomix
- axon
-
bazel
google-auto-project
- ddd
disruptor
dozer
dubbo
@@ -1039,8 +1034,7 @@
aws-modules
checker-framework
- couchbase
-
+
core-groovy-modules
core-java-modules
@@ -1057,7 +1051,6 @@
spring-aop-2
custom-pmd
data-structures
- ddd-contexts
jackson-modules
jmh
deeplearning4j
@@ -1107,11 +1100,8 @@
atomikos
atomix
- axon
-
bazel
google-auto-project
- ddd
disruptor
dozer
@@ -1221,7 +1211,6 @@
gradle-modules/gradle/maven-to-gradle
persistence-modules/spring-data-neo4j
spring-actuator
- gcp-firebase
spring-di-4
spring-kafka-2
diff --git a/spring-cloud-modules/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/com/baeldung/spring/cloud/springcloudcontractconsumer/controller/BasicMathControllerIntegrationTest.java b/spring-cloud-modules/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/com/baeldung/spring/cloud/springcloudcontractconsumer/controller/BasicMathControllerIntegrationTest.java
index e21223e6ea..c19b3f3694 100644
--- a/spring-cloud-modules/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/com/baeldung/spring/cloud/springcloudcontractconsumer/controller/BasicMathControllerIntegrationTest.java
+++ b/spring-cloud-modules/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/com/baeldung/spring/cloud/springcloudcontractconsumer/controller/BasicMathControllerIntegrationTest.java
@@ -1,5 +1,10 @@
package com.baeldung.spring.cloud.springcloudcontractconsumer.controller;
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +18,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -26,6 +32,36 @@ public class BasicMathControllerIntegrationTest {
@Autowired
private MockMvc mockMvc;
+ private static WireMockServer wireMockServer;
+
+
+ @BeforeClass
+ public static void setupClass() {
+ WireMockConfiguration wireMockConfiguration = WireMockConfiguration.options().port(8090); // Use the same port as in your code
+
+ wireMockServer = new WireMockServer(wireMockConfiguration);
+ wireMockServer.start();
+ }
+
+ @AfterClass
+ public static void teardownClass() {
+ wireMockServer.stop();
+ }
+
+ @Before
+ public void setup() {
+ wireMockServer.stubFor(get(urlEqualTo("/validate/prime-number?number=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody("Odd")));
+
+ wireMockServer.stubFor(get(urlEqualTo("/validate/prime-number?number=2"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody("Even")));
+ }
@Test
public void given_WhenPassEvenNumberInQueryParam_ThenReturnEven() throws Exception {
diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml
index c6c163d7d1..042e81971f 100644
--- a/spring-cucumber/pom.xml
+++ b/spring-cucumber/pom.xml
@@ -45,6 +45,12 @@
${cucumber.version}
test
+
+ org.junit.vintage
+ junit-vintage-engine
+ ${junit-vintage-engine.version}
+ test
+
org.apache.commons
@@ -54,8 +60,9 @@
- 6.8.0
+ 7.14.0
1.3.2
+ 5.10.0
\ No newline at end of file
diff --git a/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/CucumberOptionsApplication.java b/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/CucumberOptionsApplication.java
new file mode 100644
index 0000000000..03082128b3
--- /dev/null
+++ b/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/CucumberOptionsApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.cucumberoptions;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class CucumberOptionsApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(CucumberOptionsApplication.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/HealthCheckController.java b/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/HealthCheckController.java
new file mode 100644
index 0000000000..637dbdb540
--- /dev/null
+++ b/spring-cucumber/src/main/java/com/baeldung/cucumberoptions/HealthCheckController.java
@@ -0,0 +1,22 @@
+package com.baeldung.cucumberoptions;
+
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HealthCheckController {
+
+ @GetMapping(path = "/v1/status", produces = APPLICATION_JSON_VALUE)
+ public HttpStatus getV1Status() {
+ return ResponseEntity.ok().build().getStatusCode();
+ }
+
+ @GetMapping(path = "/v2/status", produces = APPLICATION_JSON_VALUE)
+ public HttpStatus getV2Status() {
+ return ResponseEntity.ok().build().getStatusCode();
+ }
+}
\ No newline at end of file
diff --git a/spring-cucumber/src/test/java/com/baeldung/cucumberoptions/HealthCheckStepDefsIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/cucumberoptions/HealthCheckStepDefsIntegrationTest.java
new file mode 100644
index 0000000000..999adadbef
--- /dev/null
+++ b/spring-cucumber/src/test/java/com/baeldung/cucumberoptions/HealthCheckStepDefsIntegrationTest.java
@@ -0,0 +1,38 @@
+package com.baeldung.cucumberoptions;
+
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import com.baeldung.SpringIntegrationTest;
+
+public class HealthCheckStepDefsIntegrationTest extends SpringIntegrationTest {
+
+ private ResponseEntity statusResponse;
+
+ private ResponseEntity doGet(String url) {
+ return new RestTemplate().getForEntity(url, String.class);
+ }
+
+ @When("^the client calls /v1/status")
+ public void checkV1Status() throws Throwable {
+ statusResponse = doGet("http://localhost:8082/v1/status");
+ }
+
+ @When("^the client calls /v2/status")
+ public void checkV2Status() throws Throwable {
+ statusResponse = doGet("http://localhost:8082/v2/status");
+ }
+
+ @Then("^the client receives (\\d+) status code$")
+ public void verifyStatusCode(int statusCode) throws Throwable {
+ final HttpStatus currentStatusCode = statusResponse.getStatusCode();
+ assertThat(currentStatusCode.value(), is(statusCode));
+ }
+}
\ No newline at end of file
diff --git a/spring-cucumber/src/test/resources/com/baeldung/cucumberoptions/healthcheck.feature b/spring-cucumber/src/test/resources/com/baeldung/cucumberoptions/healthcheck.feature
new file mode 100644
index 0000000000..33e07c1add
--- /dev/null
+++ b/spring-cucumber/src/test/resources/com/baeldung/cucumberoptions/healthcheck.feature
@@ -0,0 +1,11 @@
+Feature: healthcheck endpoints can be verified
+
+ @v1
+ Scenario: v1 status is healthy
+ When the client calls /v1/status
+ Then the client receives 200 status code
+
+ @v2
+ Scenario: v2 status is healthy
+ When the client calls /v2/status
+ Then the client receives 200 status code
diff --git a/spring-cucumber/src/test/resources/cucumber.properties b/spring-cucumber/src/test/resources/cucumber.properties
new file mode 100644
index 0000000000..22c3379201
--- /dev/null
+++ b/spring-cucumber/src/test/resources/cucumber.properties
@@ -0,0 +1 @@
+cucumber.filter.tags=not @v2
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java
index 07bc22f184..873c28c6a2 100644
--- a/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java
+++ b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java
@@ -49,7 +49,7 @@ public class SessionTimerInterceptorIntegrationTest {
.andReturn()
.getRequest()
.getSession();
- Thread.sleep(51000);
+ Thread.sleep(5000);
mockMvc.perform(get("/auth/foos").session((MockHttpSession) session))
.andExpect(status().is2xxSuccessful());
}
diff --git a/spring-web-modules/pom.xml b/spring-web-modules/pom.xml
index 9f03b83392..2be896ad83 100644
--- a/spring-web-modules/pom.xml
+++ b/spring-web-modules/pom.xml
@@ -10,8 +10,9 @@
com.baeldung
- parent-modules
- 1.0.0-SNAPSHOT
+ parent-spring-5
+ 0.0.1-SNAPSHOT
+ ../parent-spring-5
diff --git a/spring-web-modules/spring-mvc-xml-2/pom.xml b/spring-web-modules/spring-mvc-xml-2/pom.xml
index f4326ccf68..8c0062f538 100644
--- a/spring-web-modules/spring-mvc-xml-2/pom.xml
+++ b/spring-web-modules/spring-mvc-xml-2/pom.xml
@@ -19,12 +19,12 @@
org.springframework
spring-web
- ${org.springframework.version}
+ ${spring.version}
org.springframework
spring-webmvc
- ${org.springframework.version}
+ ${spring.version}
@@ -64,7 +64,7 @@
org.springframework.boot
spring-boot-starter-test
- ${spring-boot.version}
+ ${spring-boot-starter-test.version}
test
@@ -95,8 +95,6 @@
- 5.0.2.RELEASE
- 1.5.10.RELEASE
5.1.40
4.4.5
4.5.2
diff --git a/xml-2/src/test/java/com/baeldung/xml/xml2document/XMLStringToDocumentObjectUnitTest.java b/xml-2/src/test/java/com/baeldung/xml/xml2document/XMLStringToDocumentObjectUnitTest.java
new file mode 100644
index 0000000000..f573e1c96d
--- /dev/null
+++ b/xml-2/src/test/java/com/baeldung/xml/xml2document/XMLStringToDocumentObjectUnitTest.java
@@ -0,0 +1,37 @@
+package com.baeldung.xml2document;
+
+import org.junit.Test;
+import org.w3c.dom.*;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import static org.junit.Assert.assertEquals;
+
+public class XMLStringToDocumentObjectUnitTest {
+ @Test
+ public void givenValidXMLString_whenParsing_thenDocumentIsCorrect() throws ParserConfigurationException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ String xmlString = "XML Parsing Example";
+ InputSource is = new InputSource(new StringReader(xmlString));
+ Document xmlDoc = null;
+ try {
+ xmlDoc = builder.parse(is);
+ } catch (SAXException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ assertEquals("root", xmlDoc.getDocumentElement().getNodeName());
+ assertEquals("element", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getNodeName());
+ assertEquals("XML Parsing Example", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getTextContent());
+ }
+}