diff --git a/algorithms-modules/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java b/algorithms-modules/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java index 60171220cd..202912a1af 100644 --- a/algorithms-modules/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java +++ b/algorithms-modules/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithm.java @@ -14,7 +14,7 @@ public class KadaneAlgorithm { int end = 0; int maxSoFar = arr[0], maxEndingHere = arr[0]; - for (int i = 0; i < size; i++) { + for (int i = 1; i < size; i++) { if (arr[i] > maxEndingHere + arr[i]) { start = i; diff --git a/algorithms-modules/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java b/algorithms-modules/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java index 71531dcf59..8dcc81bc5b 100644 --- a/algorithms-modules/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java +++ b/algorithms-modules/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/maximumsubarray/KadaneAlgorithmUnitTest.java @@ -27,4 +27,16 @@ class KadaneAlgorithmUnitTest { //then assertEquals(-1, maxSum); } + + @Test + void givenArrayWithAllPosiitveNumbersWhenMaximumSubarrayThenReturnsExpectedResult() { + //given + int[] arr = new int[] {4, 1, 3, 2}; + //when + KadaneAlgorithm algorithm = new KadaneAlgorithm(); + int maxSum = algorithm.maxSubArraySum(arr); + //then + assertEquals(10, maxSum); + } + } \ No newline at end of file diff --git a/apache-cxf/README.md b/apache-cxf-modules/README.md similarity index 100% rename from apache-cxf/README.md rename to apache-cxf-modules/README.md diff --git a/apache-cxf/cxf-aegis/README.md b/apache-cxf-modules/cxf-aegis/README.md similarity index 100% rename from apache-cxf/cxf-aegis/README.md rename to apache-cxf-modules/cxf-aegis/README.md diff --git a/apache-cxf/cxf-aegis/pom.xml b/apache-cxf-modules/cxf-aegis/pom.xml similarity index 93% rename from apache-cxf/cxf-aegis/pom.xml rename to apache-cxf-modules/cxf-aegis/pom.xml index 996c6fc0cd..d013aabc65 100644 --- a/apache-cxf/cxf-aegis/pom.xml +++ b/apache-cxf-modules/cxf-aegis/pom.xml @@ -8,7 +8,7 @@ com.baeldung - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT diff --git a/apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/Course.java b/apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/Course.java similarity index 100% rename from apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/Course.java rename to apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/Course.java diff --git a/apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepo.java b/apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepo.java similarity index 100% rename from apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepo.java rename to apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepo.java diff --git a/apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java b/apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java similarity index 100% rename from apache-cxf/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java rename to apache-cxf-modules/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java diff --git a/apache-cxf/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/Course.aegis.xml b/apache-cxf-modules/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/Course.aegis.xml similarity index 100% rename from apache-cxf/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/Course.aegis.xml rename to apache-cxf-modules/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/Course.aegis.xml diff --git a/apache-cxf/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml b/apache-cxf-modules/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml similarity index 100% rename from apache-cxf/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml rename to apache-cxf-modules/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml diff --git a/apache-cxf/cxf-aegis/src/main/resources/logback.xml b/apache-cxf-modules/cxf-aegis/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/cxf-aegis/src/main/resources/logback.xml rename to apache-cxf-modules/cxf-aegis/src/main/resources/logback.xml diff --git a/apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungIntegrationTest.java b/apache-cxf-modules/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungIntegrationTest.java similarity index 100% rename from apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungIntegrationTest.java rename to apache-cxf-modules/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungIntegrationTest.java diff --git a/apache-cxf/cxf-introduction/README.md b/apache-cxf-modules/cxf-introduction/README.md similarity index 100% rename from apache-cxf/cxf-introduction/README.md rename to apache-cxf-modules/cxf-introduction/README.md diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf-modules/cxf-introduction/pom.xml similarity index 96% rename from apache-cxf/cxf-introduction/pom.xml rename to apache-cxf-modules/cxf-introduction/pom.xml index 12529e55c1..fe7b917c6f 100644 --- a/apache-cxf/cxf-introduction/pom.xml +++ b/apache-cxf-modules/cxf-introduction/pom.xml @@ -8,7 +8,7 @@ com.baeldung - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Baeldung.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Baeldung.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Baeldung.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Baeldung.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/BaeldungImpl.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/BaeldungImpl.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/BaeldungImpl.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/BaeldungImpl.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Server.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Server.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Server.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Server.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Student.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Student.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Student.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Student.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentAdapter.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentAdapter.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentAdapter.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentAdapter.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentImpl.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentImpl.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentImpl.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentImpl.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMap.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMap.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMap.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMap.java diff --git a/apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMapAdapter.java b/apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMapAdapter.java similarity index 100% rename from apache-cxf/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMapAdapter.java rename to apache-cxf-modules/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMapAdapter.java diff --git a/apache-cxf/cxf-introduction/src/main/resources/logback.xml b/apache-cxf-modules/cxf-introduction/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/cxf-introduction/src/main/resources/logback.xml rename to apache-cxf-modules/cxf-introduction/src/main/resources/logback.xml diff --git a/apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java b/apache-cxf-modules/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java similarity index 100% rename from apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java rename to apache-cxf-modules/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java diff --git a/apache-cxf/cxf-jaxrs-implementation/README.md b/apache-cxf-modules/cxf-jaxrs-implementation/README.md similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/README.md rename to apache-cxf-modules/cxf-jaxrs-implementation/README.md diff --git a/apache-cxf/cxf-jaxrs-implementation/pom.xml b/apache-cxf-modules/cxf-jaxrs-implementation/pom.xml similarity index 97% rename from apache-cxf/cxf-jaxrs-implementation/pom.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/pom.xml index 515f527a5b..cc5eba4025 100644 --- a/apache-cxf/cxf-jaxrs-implementation/pom.xml +++ b/apache-cxf-modules/cxf-jaxrs-implementation/pom.xml @@ -8,7 +8,7 @@ com.baeldung - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Course.java b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Course.java similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Course.java rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Course.java diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Student.java b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Student.java similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Student.java rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Student.java diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/changed_course.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/changed_course.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/changed_course.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/changed_course.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/conflict_student.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/conflict_student.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/conflict_student.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/conflict_student.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/created_student.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/created_student.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/created_student.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/created_student.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/logback.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/non_existent_course.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/non_existent_course.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/non_existent_course.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/non_existent_course.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/unchanged_course.xml b/apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/unchanged_course.xml similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/main/resources/unchanged_course.xml rename to apache-cxf-modules/cxf-jaxrs-implementation/src/main/resources/unchanged_course.xml diff --git a/apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java b/apache-cxf-modules/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java similarity index 100% rename from apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java rename to apache-cxf-modules/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java diff --git a/apache-cxf/cxf-spring/.gitignore b/apache-cxf-modules/cxf-spring/.gitignore similarity index 100% rename from apache-cxf/cxf-spring/.gitignore rename to apache-cxf-modules/cxf-spring/.gitignore diff --git a/apache-cxf/cxf-spring/README.md b/apache-cxf-modules/cxf-spring/README.md similarity index 100% rename from apache-cxf/cxf-spring/README.md rename to apache-cxf-modules/cxf-spring/README.md diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf-modules/cxf-spring/pom.xml similarity index 98% rename from apache-cxf/cxf-spring/pom.xml rename to apache-cxf-modules/cxf-spring/pom.xml index 772ece81da..ebbebd7f3b 100644 --- a/apache-cxf/cxf-spring/pom.xml +++ b/apache-cxf-modules/cxf-spring/pom.xml @@ -9,7 +9,7 @@ com.baeldung - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/AppInitializer.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/AppInitializer.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/AppInitializer.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/AppInitializer.java diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/ClientConfiguration.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/ClientConfiguration.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/ClientConfiguration.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/ClientConfiguration.java diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/ServiceConfiguration.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/ServiceConfiguration.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/ServiceConfiguration.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/ServiceConfiguration.java diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java b/apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java similarity index 100% rename from apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java rename to apache-cxf-modules/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java diff --git a/apache-cxf/cxf-spring/src/main/resources/logback.xml b/apache-cxf-modules/cxf-spring/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/cxf-spring/src/main/resources/logback.xml rename to apache-cxf-modules/cxf-spring/src/main/resources/logback.xml diff --git a/apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java b/apache-cxf-modules/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java similarity index 100% rename from apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java rename to apache-cxf-modules/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java diff --git a/apache-cxf/pom.xml b/apache-cxf-modules/pom.xml similarity index 96% rename from apache-cxf/pom.xml rename to apache-cxf-modules/pom.xml index 6b7e396b9e..fc1cf4fa0f 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf-modules/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT apache-cxf pom diff --git a/apache-cxf/sse-jaxrs/README.md b/apache-cxf-modules/sse-jaxrs/README.md similarity index 100% rename from apache-cxf/sse-jaxrs/README.md rename to apache-cxf-modules/sse-jaxrs/README.md diff --git a/apache-cxf/sse-jaxrs/pom.xml b/apache-cxf-modules/sse-jaxrs/pom.xml similarity index 92% rename from apache-cxf/sse-jaxrs/pom.xml rename to apache-cxf-modules/sse-jaxrs/pom.xml index 1ac2948439..baa32a516a 100644 --- a/apache-cxf/sse-jaxrs/pom.xml +++ b/apache-cxf-modules/sse-jaxrs/pom.xml @@ -9,7 +9,7 @@ com.baeldung - apache-cxf + apache-cxf-modules 0.0.1-SNAPSHOT diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/pom.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/pom.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/pom.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/pom.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html b/apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html similarity index 100% rename from apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html rename to apache-cxf-modules/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html diff --git a/core-groovy-2/README.md b/core-groovy-modules/core-groovy-2/README.md similarity index 100% rename from core-groovy-2/README.md rename to core-groovy-modules/core-groovy-2/README.md diff --git a/core-groovy-2/gmavenplus-pom.xml b/core-groovy-modules/core-groovy-2/gmavenplus-pom.xml similarity index 99% rename from core-groovy-2/gmavenplus-pom.xml rename to core-groovy-modules/core-groovy-2/gmavenplus-pom.xml index 4dbdfe7d42..43f089ac93 100644 --- a/core-groovy-2/gmavenplus-pom.xml +++ b/core-groovy-modules/core-groovy-2/gmavenplus-pom.xml @@ -9,7 +9,7 @@ com.baeldung - parent-modules + core-groovy-modules 1.0.0-SNAPSHOT diff --git a/core-groovy-2/pom.xml b/core-groovy-modules/core-groovy-2/pom.xml similarity index 99% rename from core-groovy-2/pom.xml rename to core-groovy-modules/core-groovy-2/pom.xml index 6b78e21080..cf4951b838 100644 --- a/core-groovy-2/pom.xml +++ b/core-groovy-modules/core-groovy-2/pom.xml @@ -10,7 +10,7 @@ com.baeldung - parent-modules + core-groovy-modules 1.0.0-SNAPSHOT diff --git a/core-groovy-2/src/main/groovy/com/baeldung/CalcMath.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/CalcMath.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/CalcMath.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/CalcMath.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/CalcScript.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/CalcScript.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/CalcScript.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/CalcScript.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/category/BaeldungCategory.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/category/BaeldungCategory.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/category/BaeldungCategory.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/category/BaeldungCategory.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/category/NumberCategory.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/category/NumberCategory.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/category/NumberCategory.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/category/NumberCategory.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/concatenate/Wonder.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/concatenate/Wonder.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/concatenate/Wonder.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/concatenate/Wonder.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/determinedatatype/Person.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/determinedatatype/Person.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/determinedatatype/Person.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/determinedatatype/Person.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/Employee.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/Employee.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/Employee.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/Employee.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy diff --git a/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/StaticEmployeeExtension.groovy b/core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/StaticEmployeeExtension.groovy similarity index 100% rename from core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/StaticEmployeeExtension.groovy rename to core-groovy-modules/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/StaticEmployeeExtension.groovy diff --git a/core-groovy-2/src/main/java/com/baeldung/MyJointCompilationApp.java b/core-groovy-modules/core-groovy-2/src/main/java/com/baeldung/MyJointCompilationApp.java similarity index 100% rename from core-groovy-2/src/main/java/com/baeldung/MyJointCompilationApp.java rename to core-groovy-modules/core-groovy-2/src/main/java/com/baeldung/MyJointCompilationApp.java diff --git a/core-groovy-2/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule b/core-groovy-modules/core-groovy-2/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule similarity index 100% rename from core-groovy-2/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule rename to core-groovy-modules/core-groovy-2/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule diff --git a/core-groovy-2/src/main/resources/articleEmail.template b/core-groovy-modules/core-groovy-2/src/main/resources/articleEmail.template similarity index 100% rename from core-groovy-2/src/main/resources/articleEmail.template rename to core-groovy-modules/core-groovy-2/src/main/resources/articleEmail.template diff --git a/core-groovy-2/src/main/resources/email.template b/core-groovy-modules/core-groovy-2/src/main/resources/email.template similarity index 100% rename from core-groovy-2/src/main/resources/email.template rename to core-groovy-modules/core-groovy-2/src/main/resources/email.template diff --git a/core-groovy-2/src/test/groovy/com/baeldung/category/CategoryUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/category/CategoryUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/category/CategoryUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/category/CategoryUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/determinedatatype/PersonTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/determinedatatype/PersonTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/determinedatatype/PersonTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/determinedatatype/PersonTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/templateengine/TemplateEnginesUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/templateengine/TemplateEnginesUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/templateengine/TemplateEnginesUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/templateengine/TemplateEnginesUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/webservice/WebserviceUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/webservice/WebserviceUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/webservice/WebserviceUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/webservice/WebserviceUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy diff --git a/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy b/core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy similarity index 100% rename from core-groovy-2/src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy rename to core-groovy-modules/core-groovy-2/src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy diff --git a/core-groovy-2/src/test/resources/com/baeldung/xml/articles.xml b/core-groovy-modules/core-groovy-2/src/test/resources/com/baeldung/xml/articles.xml similarity index 100% rename from core-groovy-2/src/test/resources/com/baeldung/xml/articles.xml rename to core-groovy-modules/core-groovy-2/src/test/resources/com/baeldung/xml/articles.xml diff --git a/core-groovy-2/src/test/resources/com/baeldung/xml/articles_short_formatted.xml b/core-groovy-modules/core-groovy-2/src/test/resources/com/baeldung/xml/articles_short_formatted.xml similarity index 100% rename from core-groovy-2/src/test/resources/com/baeldung/xml/articles_short_formatted.xml rename to core-groovy-modules/core-groovy-2/src/test/resources/com/baeldung/xml/articles_short_formatted.xml diff --git a/core-groovy-collections/README.md b/core-groovy-modules/core-groovy-collections/README.md similarity index 100% rename from core-groovy-collections/README.md rename to core-groovy-modules/core-groovy-collections/README.md diff --git a/core-groovy-collections/pom.xml b/core-groovy-modules/core-groovy-collections/pom.xml similarity index 98% rename from core-groovy-collections/pom.xml rename to core-groovy-modules/core-groovy-collections/pom.xml index d589fc74e5..74cde808f5 100644 --- a/core-groovy-collections/pom.xml +++ b/core-groovy-modules/core-groovy-collections/pom.xml @@ -10,7 +10,7 @@ com.baeldung - parent-modules + core-groovy-modules 1.0.0-SNAPSHOT diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/find/Person.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/Person.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/find/Person.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/Person.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/lists/ListUnitTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/lists/ListUnitTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/lists/ListUnitTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/lists/ListUnitTest.groovy diff --git a/core-groovy-collections/src/test/groovy/com/baeldung/maps/MapTest.groovy b/core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/maps/MapTest.groovy similarity index 100% rename from core-groovy-collections/src/test/groovy/com/baeldung/maps/MapTest.groovy rename to core-groovy-modules/core-groovy-collections/src/test/groovy/com/baeldung/maps/MapTest.groovy diff --git a/core-groovy-strings/README.md b/core-groovy-modules/core-groovy-strings/README.md similarity index 100% rename from core-groovy-strings/README.md rename to core-groovy-modules/core-groovy-strings/README.md diff --git a/core-groovy-strings/pom.xml b/core-groovy-modules/core-groovy-strings/pom.xml similarity index 98% rename from core-groovy-strings/pom.xml rename to core-groovy-modules/core-groovy-strings/pom.xml index 333b15cdbe..f6ad4d33cf 100644 --- a/core-groovy-strings/pom.xml +++ b/core-groovy-modules/core-groovy-strings/pom.xml @@ -10,7 +10,7 @@ com.baeldung - parent-modules + core-groovy-modules 1.0.0-SNAPSHOT diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-modules/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy similarity index 100% rename from core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy rename to core-groovy-modules/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy diff --git a/core-groovy/.gitignore b/core-groovy-modules/core-groovy/.gitignore similarity index 100% rename from core-groovy/.gitignore rename to core-groovy-modules/core-groovy/.gitignore diff --git a/core-groovy/README.md b/core-groovy-modules/core-groovy/README.md similarity index 100% rename from core-groovy/README.md rename to core-groovy-modules/core-groovy/README.md diff --git a/core-groovy/build.gradle b/core-groovy-modules/core-groovy/build.gradle similarity index 100% rename from core-groovy/build.gradle rename to core-groovy-modules/core-groovy/build.gradle diff --git a/core-groovy/pom.xml b/core-groovy-modules/core-groovy/pom.xml similarity index 98% rename from core-groovy/pom.xml rename to core-groovy-modules/core-groovy/pom.xml index c24982c6a2..0365a0d565 100644 --- a/core-groovy/pom.xml +++ b/core-groovy-modules/core-groovy/pom.xml @@ -10,7 +10,7 @@ com.baeldung - parent-modules + core-groovy-modules 1.0.0-SNAPSHOT diff --git a/core-groovy/src/main/groovy/com/baeldung/closures/Closures.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/closures/Closures.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/closures/Closures.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/closures/Closures.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/closures/Employee.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/closures/Employee.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/closures/Employee.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/closures/Employee.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/io/Task.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/io/Task.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/io/Task.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/io/Task.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/json/Account.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/json/Account.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/json/Account.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/json/Account.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/scopes/Scopes.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/Scopes.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/scopes/Scopes.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/Scopes.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFail.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFail.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFail.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFail.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFailNoPrint.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFailNoPrint.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFailNoPrint.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/scopes/ScopesFailNoPrint.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/strings/Concatenate.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/AnimalTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/AnimalTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/AnimalTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/AnimalTrait.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/Car.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Car.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/Car.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Car.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/Dog.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Dog.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/Dog.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Dog.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/Employee.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Employee.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/Employee.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Employee.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/Human.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Human.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/Human.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/Human.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/SpeakingTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/SpeakingTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/SpeakingTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/SpeakingTrait.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/UserTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/UserTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/UserTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/UserTrait.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/VehicleTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/VehicleTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/VehicleTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/VehicleTrait.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/WalkingTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/WalkingTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/WalkingTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/WalkingTrait.groovy diff --git a/core-groovy/src/main/groovy/com/baeldung/traits/WheelTrait.groovy b/core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/WheelTrait.groovy similarity index 100% rename from core-groovy/src/main/groovy/com/baeldung/traits/WheelTrait.groovy rename to core-groovy-modules/core-groovy/src/main/groovy/com/baeldung/traits/WheelTrait.groovy diff --git a/core-groovy/src/main/resources/binaryExample.jpg b/core-groovy-modules/core-groovy/src/main/resources/binaryExample.jpg similarity index 100% rename from core-groovy/src/main/resources/binaryExample.jpg rename to core-groovy-modules/core-groovy/src/main/resources/binaryExample.jpg diff --git a/core-groovy/src/main/resources/fileContent.txt b/core-groovy-modules/core-groovy/src/main/resources/fileContent.txt similarity index 100% rename from core-groovy/src/main/resources/fileContent.txt rename to core-groovy-modules/core-groovy/src/main/resources/fileContent.txt diff --git a/core-groovy/src/main/resources/ioData.txt b/core-groovy-modules/core-groovy/src/main/resources/ioData.txt similarity index 100% rename from core-groovy/src/main/resources/ioData.txt rename to core-groovy-modules/core-groovy/src/main/resources/ioData.txt diff --git a/core-groovy/src/main/resources/ioInput.txt b/core-groovy-modules/core-groovy/src/main/resources/ioInput.txt similarity index 100% rename from core-groovy/src/main/resources/ioInput.txt rename to core-groovy-modules/core-groovy/src/main/resources/ioInput.txt diff --git a/core-groovy/src/main/resources/ioOutput.txt b/core-groovy-modules/core-groovy/src/main/resources/ioOutput.txt similarity index 100% rename from core-groovy/src/main/resources/ioOutput.txt rename to core-groovy-modules/core-groovy/src/main/resources/ioOutput.txt diff --git a/core-groovy/src/main/resources/logback.xml b/core-groovy-modules/core-groovy/src/main/resources/logback.xml similarity index 100% rename from core-groovy/src/main/resources/logback.xml rename to core-groovy-modules/core-groovy/src/main/resources/logback.xml diff --git a/core-groovy/src/main/resources/sample.png b/core-groovy-modules/core-groovy/src/main/resources/sample.png similarity index 100% rename from core-groovy/src/main/resources/sample.png rename to core-groovy-modules/core-groovy/src/main/resources/sample.png diff --git a/core-groovy/src/main/resources/utf8Content.html b/core-groovy-modules/core-groovy/src/main/resources/utf8Content.html similarity index 100% rename from core-groovy/src/main/resources/utf8Content.html rename to core-groovy-modules/core-groovy/src/main/resources/utf8Content.html diff --git a/core-groovy/src/test/groovy/com/baeldung/closures/ClosuresUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/closures/ClosuresUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/closures/ClosuresUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/closures/ClosuresUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/date/DateTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/date/DateTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/date/DateTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/date/DateTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/groovy/sql/SqlTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/groovy/sql/SqlTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/groovy/sql/SqlTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/groovy/sql/SqlTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/io/DataAndObjectsUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/DataAndObjectsUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/io/DataAndObjectsUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/DataAndObjectsUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/io/ReadExampleUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/ReadExampleUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/io/ReadExampleUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/ReadExampleUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/io/TraverseFileTreeUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/TraverseFileTreeUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/io/TraverseFileTreeUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/TraverseFileTreeUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/io/WriteExampleUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/WriteExampleUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/io/WriteExampleUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/io/WriteExampleUnitTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtoint/ConvertStringToInt.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtoint/ConvertStringToInt.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtoint/ConvertStringToInt.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtoint/ConvertStringToInt.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/Strings.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy diff --git a/core-groovy/src/test/groovy/com/baeldung/traits/TraitsUnitTest.groovy b/core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/traits/TraitsUnitTest.groovy similarity index 100% rename from core-groovy/src/test/groovy/com/baeldung/traits/TraitsUnitTest.groovy rename to core-groovy-modules/core-groovy/src/test/groovy/com/baeldung/traits/TraitsUnitTest.groovy diff --git a/core-groovy-modules/pom.xml b/core-groovy-modules/pom.xml new file mode 100644 index 0000000000..2fd4da17f9 --- /dev/null +++ b/core-groovy-modules/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + core-groovy-modules + core-groovy-modules + pom + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + core-groovy + core-groovy-2 + core-groovy-collections + core-groovy-strings + + + + + diff --git a/core-java-modules/core-java-collections-4/README.md b/core-java-modules/core-java-collections-4/README.md index cbca44d372..121b92a2e6 100644 --- a/core-java-modules/core-java-collections-4/README.md +++ b/core-java-modules/core-java-collections-4/README.md @@ -8,3 +8,4 @@ - [Java Deque vs. Stack](https://www.baeldung.com/java-deque-vs-stack) - [Collection.toArray(new T[0]) or .toArray(new T[size])](https://www.baeldung.com/java-collection-toarray-methods) - [Create an Empty Map in Java](https://www.baeldung.com/java-create-empty-map) +- [Sorting Objects in a List by Date](https://www.baeldung.com/java-sort-list-by-date) diff --git a/core-java-modules/core-java-collections-list-4/README.md b/core-java-modules/core-java-collections-list-4/README.md index 3a90b3d813..4c020969e3 100644 --- a/core-java-modules/core-java-collections-list-4/README.md +++ b/core-java-modules/core-java-collections-list-4/README.md @@ -4,4 +4,6 @@ This module contains articles about the Java List collection ### Relevant Articles: - [Working With a List of Lists in Java](https://www.baeldung.com/java-list-of-lists) +- [Reverse an ArrayList in Java](https://www.baeldung.com/java-reverse-arraylist) +- [Sort a List Alphabetically in Java](https://www.baeldung.com/java-sort-list-alphabetically) - [[<-- Prev]](/core-java-modules/core-java-collections-list-3) diff --git a/core-java-modules/core-java-collections-list-4/pom.xml b/core-java-modules/core-java-collections-list-4/pom.xml index 8c1d3a881e..b546c5af2a 100644 --- a/core-java-modules/core-java-collections-list-4/pom.xml +++ b/core-java-modules/core-java-collections-list-4/pom.xml @@ -45,12 +45,24 @@ jmh-generator-annprocess ${jmh-generator.version} + + org.apache.commons + commons-lang3 + ${apache-commons.version} + + + org.assertj + assertj-core + ${assertj.version} + test + - 3.0.2 8.1.0 1.2.0 + 3.0 + 3.22.0 \ No newline at end of file diff --git a/core-java-modules/core-java-collections-list-4/src/main/java/com/baeldung/list/reverse/ReverseArrayList.java b/core-java-modules/core-java-collections-list-4/src/main/java/com/baeldung/list/reverse/ReverseArrayList.java new file mode 100644 index 0000000000..a97633b904 --- /dev/null +++ b/core-java-modules/core-java-collections-list-4/src/main/java/com/baeldung/list/reverse/ReverseArrayList.java @@ -0,0 +1,23 @@ +package com.baeldung.list.reverse; + +import java.util.List; + +public class ReverseArrayList { + private ReverseArrayList() { + throw new RuntimeException("This class cannot be instantiated."); + } + + public static void reverseWithRecursion(List list) { + if (list.size() > 1) { + T value = list.remove(0); + reverseWithRecursion(list); + list.add(value); + } + } + + public static void reverseWithLoop(List list) { + for (int i = 0, j = list.size() - 1; i < j; i++) { + list.add(i, list.remove(j)); + } + } +} diff --git a/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/reverse/ReverseArrayListUnitTest.java b/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/reverse/ReverseArrayListUnitTest.java new file mode 100644 index 0000000000..bf5bf43d13 --- /dev/null +++ b/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/reverse/ReverseArrayListUnitTest.java @@ -0,0 +1,46 @@ +package com.baeldung.list.reverse; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +class ReverseArrayListUnitTest { + + private static final List EXPECTED = new ArrayList<>(Arrays.asList(7, 6, 5, 4, 3, 2, 1)); + + @Test + void givenArrayList_whenCallReverseMethod_thenListReversedInPlace() { + List aList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); + Collections.reverse(aList); + assertThat(aList).isEqualTo(EXPECTED); + } + + @Test + void givenArrayList_whenCallReverseMethod_thenListReversedAsaNewList() { + List originalList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); + List aNewList = new ArrayList<>(originalList); + Collections.reverse(aNewList); + + assertThat(aNewList).isNotEqualTo(originalList) + .isEqualTo(EXPECTED); + } + + @Test + void givenArrayList_whenCallReverseWithRecur_thenListReversedInPlace() { + List aList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); + ReverseArrayList.reverseWithRecursion(aList); + assertThat(aList).isEqualTo(EXPECTED); + } + + @Test + void givenArrayList_whenCallReverseWithLoop_thenListReversedInPlace() { + List aList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); + ReverseArrayList.reverseWithLoop(aList); + assertThat(aList).isEqualTo(EXPECTED); + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/sorting/alphabetical/SortingListUnitTest.java b/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/sorting/alphabetical/SortingListUnitTest.java new file mode 100644 index 0000000000..12b6c14181 --- /dev/null +++ b/core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/sorting/alphabetical/SortingListUnitTest.java @@ -0,0 +1,186 @@ +package com.baeldung.list.sorting.alphabetical; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.text.Collator; +import java.text.Normalizer; +import java.text.ParseException; +import java.text.RuleBasedCollator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Locale; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Test; + +public class SortingListUnitTest { + + private static List INPUT_NAMES = Arrays.asList("john", "mike", "usmon", "ken", "harry"); + private static List EXPECTED_NATURAL_ORDER = Arrays.asList("harry", "john", "ken", "mike", "usmon"); + private static List EXPECTED_REVERSE_ORDER = Arrays.asList("usmon", "mike", "ken", "john", "harry"); + + @Test + void givenListOfStrings_whenUsingCollections_thenListIsSorted() { + + Collections.sort(INPUT_NAMES); + + assertThat(INPUT_NAMES).isEqualTo(EXPECTED_NATURAL_ORDER); + } + + @Test + void givenListOfStrings_whenUsingCollections_thenListIsSortedInReverse() { + Comparator reverseComparator = (element1, element2) -> element2.compareTo(element1); + + Collections.sort(INPUT_NAMES, reverseComparator); + + assertThat(INPUT_NAMES).isEqualTo(EXPECTED_REVERSE_ORDER); + } + + @Test + void givenListOfStringsWithUpperAndLowerCaseMixed_whenCustomComparator_thenListIsSortedCorrectly() { + List movieNames = Arrays.asList("amazing SpiderMan", "Godzilla", "Sing", "Minions"); + List naturalSortOrder = Arrays.asList("Godzilla", "Minions", "Sing", "amazing SpiderMan"); + List comparatorSortOrder = Arrays.asList("amazing SpiderMan", "Godzilla", "Minions", "Sing"); + + Collections.sort(movieNames); + + assertThat(movieNames).isEqualTo(naturalSortOrder); + + Collections.sort(movieNames, Comparator.comparing(s -> s.toLowerCase())); + + assertThat(movieNames).isEqualTo(comparatorSortOrder); + } + + @Test + void givenListOfStringsIncludingSomeWithSpecialCharacter_whenCustomComparator_thenListIsSortedWithSpecialCharacterLast() { + List listWithSpecialCharacters = Arrays.asList("@laska", "blah", "jo", "@sk", "foo"); + + List sortedNaturalOrder = Arrays.asList("@laska", "@sk", "blah", "foo", "jo"); + List sortedSpecialCharacterLast = Arrays.asList("blah", "foo", "jo", "@laska", "@sk"); + + Collections.sort(listWithSpecialCharacters); + + assertThat(listWithSpecialCharacters).isEqualTo(sortedNaturalOrder); + + Comparator specialSignComparator = Comparator.comparing(s -> s.startsWith("@")); + Comparator specialCharacterComparator = specialSignComparator.thenComparing(Comparator.naturalOrder()); + + listWithSpecialCharacters.sort(specialCharacterComparator); + + assertThat(listWithSpecialCharacters).isEqualTo(sortedSpecialCharacterLast); + } + + @Test + void givenListOfStrings_whenUsingStreamsAndSort_thenListIsSorted() { + List sortedList = INPUT_NAMES.stream() + .sorted() + .collect(Collectors.toList()); + + assertThat(sortedList).isEqualTo(EXPECTED_NATURAL_ORDER); + } + + @Test + void givenListOfStrings_whenUsingStreamsWithComparator_thenListIsSortedInReverseOrder() { + List sortedList = INPUT_NAMES.stream() + .sorted(Comparator.reverseOrder()) + .collect(Collectors.toList()); + + assertThat(sortedList).isEqualTo(EXPECTED_REVERSE_ORDER); + } + + @Test + void givenListOfStrings_whenUsingTreeSet_thenListIsSorted() { + SortedSet sortedSet = new TreeSet<>(INPUT_NAMES); + List sortedList = new ArrayList<>(sortedSet); + + assertThat(sortedList).isEqualTo(EXPECTED_NATURAL_ORDER); + } + + @Test + void givenListOfStrings_whenSortOnList_thenListIsSorted() { + + INPUT_NAMES.sort(Comparator.reverseOrder()); + + assertThat(INPUT_NAMES).isEqualTo(EXPECTED_REVERSE_ORDER); + } + + @Test + void givenListOfStringsWithAccent_whenUseCollatorWithLocaleSet_thenListIsSortedAccordingToLocaleRules() { + List accentedStrings = Arrays.asList("único", "árbol", "cosas", "fútbol"); + List sortedNaturalOrder = Arrays.asList("cosas", "fútbol", "árbol", "único"); + List sortedLocaleSensitive = Arrays.asList("árbol", "cosas", "fútbol", "único"); + + Collections.sort(accentedStrings); + assertThat(accentedStrings).isEqualTo(sortedNaturalOrder); + + Collator esCollator = Collator.getInstance(new Locale("es")); + + accentedStrings.sort((s1, s2) -> { + return esCollator.compare(s1, s2); + }); + + assertThat(accentedStrings).isEqualTo(sortedLocaleSensitive); + } + + @Test + void givenListOfStringsWithAccentedCharacters_whenComparatorWithNormalizer_thenListIsNormalizeAndSorted() { + List accentedStrings = Arrays.asList("único", "árbol", "cosas", "fútbol"); + + List naturalOrderSorted = Arrays.asList("cosas", "fútbol", "árbol", "único"); + List stripAccentSorted = Arrays.asList("árbol", "cosas", "fútbol", "único"); + + Collections.sort(accentedStrings); + assertThat(accentedStrings).isEqualTo(naturalOrderSorted); + + accentedStrings.sort((o1, o2) -> { + o1 = Normalizer.normalize(o1, Normalizer.Form.NFD); + o2 = Normalizer.normalize(o2, Normalizer.Form.NFD); + return o1.compareTo(o2); + }); + + assertThat(accentedStrings).isEqualTo(stripAccentSorted); + } + + @Test + void givenListOfStringsWithAccentedCharacters_whenComparatorWithStripAccents_canStripAccentsAndSort() { + List accentedStrings = Arrays.asList("único", "árbol", "cosas", "fútbol"); + + List naturalOrderSorted = Arrays.asList("cosas", "fútbol", "árbol", "único"); + List stripAccentSorted = Arrays.asList("árbol", "cosas", "fútbol", "único"); + + Collections.sort(accentedStrings); + + assertThat(accentedStrings).isEqualTo(naturalOrderSorted); + + accentedStrings.sort(Comparator.comparing(input -> StringUtils.stripAccents(input))); + + assertThat(accentedStrings).isEqualTo(stripAccentSorted); + } + + @Test + void givenListofStrings_whenProvidedTheRuleBasedCollator_thenListIsSortedUsingRuleBasedCollator() throws ParseException { + + List movieNames = Arrays.asList("Godzilla", "AmazingSpiderMan", "Smurfs", "Minions"); + + List naturalOrderExpected = Arrays.asList("AmazingSpiderMan", "Godzilla", "Minions", "Smurfs"); + + List rulesBasedExpected = Arrays.asList("Smurfs", "Minions", "AmazingSpiderMan", "Godzilla"); + + Collections.sort(movieNames); + + assertThat(movieNames).isEqualTo(naturalOrderExpected); + + String rule = "< s, S < m, M < a, A < g, G"; + + RuleBasedCollator collator = new RuleBasedCollator(rule); + movieNames.sort(collator); + + assertThat(movieNames).isEqualTo(rulesBasedExpected); + } +} diff --git a/core-java-modules/core-java-networking-3/README.md b/core-java-modules/core-java-networking-3/README.md index 03c2dcfa89..6c336d2e65 100644 --- a/core-java-modules/core-java-networking-3/README.md +++ b/core-java-modules/core-java-networking-3/README.md @@ -12,4 +12,5 @@ This module contains articles about networking in Java - [Unix Domain Socket in Java 16](https://www.baeldung.com/java-unix-domain-socket) - [Get the IP Address of the Current Machine Using Java](https://www.baeldung.com/java-get-ip-address) - [Get Domain Name From Given URL in Java](https://www.baeldung.com/java-domain-name-from-url) +- [Java HttpClient Timeout](https://www.baeldung.com/java-httpclient-timeout) - [[<-- Prev]](/core-java-modules/core-java-networking-2) diff --git a/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/lock/FileLocks.java b/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/lock/FileLocks.java index 4b65221708..df9bef62fe 100644 --- a/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/lock/FileLocks.java +++ b/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/lock/FileLocks.java @@ -79,9 +79,7 @@ public class FileLocks { while (buffer.hasRemaining()) { channel.write(buffer, channel.size()); } - LOG.debug("This was written to the file"); - Files.lines(path) - .forEach(LOG::debug); + return lock; } } diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java index 29cba37d43..557a47318d 100644 --- a/core-java-modules/core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/keystore/JavaKeyStore.java @@ -4,6 +4,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.security.KeyStore; import java.security.KeyStoreException; @@ -48,7 +49,9 @@ public class JavaKeyStore { void loadKeyStore() throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException { char[] pwdArray = keyStorePassword.toCharArray(); - keyStore.load(new FileInputStream(keyStoreName), pwdArray); + FileInputStream fis = new FileInputStream(keyStoreName); + keyStore.load(fis, pwdArray); + fis.close(); } void setEntry(String alias, KeyStore.SecretKeyEntry secretKeyEntry, KeyStore.ProtectionParameter protectionParameter) throws KeyStoreException { @@ -83,7 +86,9 @@ public class JavaKeyStore { keyStore.deleteEntry(alias); } keyStore = null; - Files.delete(Paths.get(keyStoreName)); + + Path keyStoreFile = Paths.get(keyStoreName); + Files.delete(keyStoreFile); } KeyStore getKeyStore() { diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java index fe3867a3c3..273839de1f 100644 --- a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java +++ b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java @@ -78,7 +78,8 @@ public class CharacterEncodingExamplesUnitTest { Assertions.assertEquals("The faade pattern is a software design pattern.", CharacterEncodingExamples.decodeText("The façade pattern is a software design pattern.", StandardCharsets.US_ASCII, CodingErrorAction.IGNORE)); } - @Test + //@Test + // run this manually as it's dependent on platform encoding, which has to be UTF-8 public void givenUTF8String_whenDecodeByUS_ASCII_thenReplaceMalformedInputSequence() throws IOException { Assertions.assertEquals( "The fa��ade pattern is a software design pattern.", diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/illegalcharacter/IllegalCharacterUnitTest.java b/core-java-modules/core-java/src/test/java/com/baeldung/illegalcharacter/IllegalCharacterUnitTest.java index 4a08daa271..8e3f86f48e 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/illegalcharacter/IllegalCharacterUnitTest.java +++ b/core-java-modules/core-java/src/test/java/com/baeldung/illegalcharacter/IllegalCharacterUnitTest.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.Objects; import org.apache.commons.io.ByteOrderMark; @@ -43,7 +44,7 @@ public class IllegalCharacterUnitTest { String line; String actual = ""; - try (BufferedReader br = new BufferedReader(new InputStreamReader(Objects.requireNonNull(ioStream)))) { + try (BufferedReader br = new BufferedReader(new InputStreamReader(Objects.requireNonNull(ioStream), StandardCharsets.UTF_8))) { while ((line = br.readLine()) != null) { actual += line.replace("\uFEFF", ""); } diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/resourcebundle/PropertyResourceUnitTest.java b/core-java-modules/core-java/src/test/java/com/baeldung/resourcebundle/PropertyResourceUnitTest.java index 4da71567e1..79df89516b 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/resourcebundle/PropertyResourceUnitTest.java +++ b/core-java-modules/core-java/src/test/java/com/baeldung/resourcebundle/PropertyResourceUnitTest.java @@ -13,50 +13,68 @@ public class PropertyResourceUnitTest { @Test public void givenLocaleUsAsDefualt_whenGetBundleForLocalePlPl_thenItShouldContain3ButtonsAnd1Label() { - Locale.setDefault(Locale.US); + Locale locale = Locale.getDefault(); + Locale.setDefault(Locale.US); ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("pl", "PL")); assertTrue(bundle.keySet() .containsAll(Arrays.asList("backButton", "helloLabel", "cancelButton", "continueButton", "helloLabelNoEncoding"))); + Locale.setDefault(locale); } @Test public void givenLocaleUsAsDefualt_whenGetBundleForLocaleFrFr_thenItShouldContainKeys1To3AndKey4() { - Locale.setDefault(Locale.US); + Locale locale = Locale.getDefault(); + + Locale.setDefault(Locale.US); ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("fr", "FR")); assertTrue(bundle.keySet() .containsAll(Arrays.asList("deleteButton", "helloLabel", "cancelButton", "continueButton"))); + Locale.setDefault(locale); } @Test public void givenLocaleChinaAsDefualt_whenGetBundleForLocaleFrFr_thenItShouldOnlyContainKeys1To3() { - Locale.setDefault(Locale.CHINA); + Locale locale = Locale.getDefault(); + + Locale.setDefault(Locale.CHINA); ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("fr", "FR")); assertTrue(bundle.keySet() .containsAll(Arrays.asList("continueButton", "helloLabel", "cancelButton"))); + Locale.setDefault(locale); } @Test public void givenLocaleChinaAsDefualt_whenGetBundleForLocaleFrFrAndExampleControl_thenItShouldOnlyContainKey5() { - Locale.setDefault(Locale.CHINA); + Locale locale = Locale.getDefault(); + + Locale.setDefault(Locale.CHINA); ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("fr", "FR"), new ExampleControl()); assertTrue(bundle.keySet() .containsAll(Arrays.asList("backButton", "helloLabel"))); + Locale.setDefault(locale); } @Test public void givenValuesDifferentlyEncoded_whenGetBundleForLocalePlPl_thenItShouldContain3ButtonsAnd1Label() { - ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("pl", "PL")); + Locale locale = Locale.getDefault(); + System.out.println(Locale.getDefault()); + System.out.println("file.encoding=" + System.getProperty("file.encoding")); + + ResourceBundle bundle = ResourceBundle.getBundle("resourcebundle.resource", new Locale("pl", "PL")); assertEquals(bundle.getString("helloLabel"), "cześć"); - assertEquals(bundle.getString("helloLabelNoEncoding"), "czeÅ\u009BÄ\u0087"); + + // this depends on the local system encoding + //assertEquals(bundle.getString("helloLabelNoEncoding"), "czeÅ\u009BÄ\u0087"); + Locale.setDefault(locale); } } diff --git a/data-structures/src/test/java/com/baeldung/circularbuffer/ProducerConsumerLiveTest.java b/data-structures/src/test/java/com/baeldung/circularbuffer/ProducerConsumerLiveTest.java index 83ce27043b..ee1f5d91e2 100644 --- a/data-structures/src/test/java/com/baeldung/circularbuffer/ProducerConsumerLiveTest.java +++ b/data-structures/src/test/java/com/baeldung/circularbuffer/ProducerConsumerLiveTest.java @@ -2,6 +2,7 @@ package com.baeldung.circularbuffer; import static org.junit.Assert.assertArrayEquals; +import java.util.Arrays; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -24,8 +25,9 @@ public class ProducerConsumerLiveTest { executorService.submit(new Producer(buffer, shapes)); Future consumed = executorService.submit(new Consumer(buffer, shapes.length)); - String[] shapesConsumed = consumed.get(5L, TimeUnit.SECONDS); - assertArrayEquals(shapes, shapesConsumed); + Object[] shapesConsumed = consumed.get(5L, TimeUnit.SECONDS); + String[] shapesConsumedStringArray = Arrays.stream(shapesConsumed).toArray(String[]::new); + assertArrayEquals(shapes, shapesConsumedStringArray); } static class Producer implements Runnable { diff --git a/docker/README.md b/docker-modules/README.md similarity index 100% rename from docker/README.md rename to docker-modules/README.md diff --git a/docker/docker-caching/multi-module-caching/Dockerfile b/docker-modules/docker-caching/multi-module-caching/Dockerfile similarity index 100% rename from docker/docker-caching/multi-module-caching/Dockerfile rename to docker-modules/docker-caching/multi-module-caching/Dockerfile diff --git a/docker/docker-caching/multi-module-caching/Dockerfile-Buildkit b/docker-modules/docker-caching/multi-module-caching/Dockerfile-Buildkit similarity index 100% rename from docker/docker-caching/multi-module-caching/Dockerfile-Buildkit rename to docker-modules/docker-caching/multi-module-caching/Dockerfile-Buildkit diff --git a/docker/docker-caching/multi-module-caching/core/pom.xml b/docker-modules/docker-caching/multi-module-caching/core/pom.xml similarity index 100% rename from docker/docker-caching/multi-module-caching/core/pom.xml rename to docker-modules/docker-caching/multi-module-caching/core/pom.xml diff --git a/docker/docker-caching/multi-module-caching/core/src/main/java/com/baeldung/maven_caching/CoreClass.java b/docker-modules/docker-caching/multi-module-caching/core/src/main/java/com/baeldung/maven_caching/CoreClass.java similarity index 100% rename from docker/docker-caching/multi-module-caching/core/src/main/java/com/baeldung/maven_caching/CoreClass.java rename to docker-modules/docker-caching/multi-module-caching/core/src/main/java/com/baeldung/maven_caching/CoreClass.java diff --git a/docker/docker-caching/multi-module-caching/pom.xml b/docker-modules/docker-caching/multi-module-caching/pom.xml similarity index 100% rename from docker/docker-caching/multi-module-caching/pom.xml rename to docker-modules/docker-caching/multi-module-caching/pom.xml diff --git a/docker/docker-caching/multi-module-caching/runner/pom.xml b/docker-modules/docker-caching/multi-module-caching/runner/pom.xml similarity index 100% rename from docker/docker-caching/multi-module-caching/runner/pom.xml rename to docker-modules/docker-caching/multi-module-caching/runner/pom.xml diff --git a/docker/docker-caching/multi-module-caching/runner/src/main/java/com/baeldung/maven_caching/MavenCachingApplication.java b/docker-modules/docker-caching/multi-module-caching/runner/src/main/java/com/baeldung/maven_caching/MavenCachingApplication.java similarity index 100% rename from docker/docker-caching/multi-module-caching/runner/src/main/java/com/baeldung/maven_caching/MavenCachingApplication.java rename to docker-modules/docker-caching/multi-module-caching/runner/src/main/java/com/baeldung/maven_caching/MavenCachingApplication.java diff --git a/docker/docker-caching/single-module-caching/Dockerfile b/docker-modules/docker-caching/single-module-caching/Dockerfile similarity index 100% rename from docker/docker-caching/single-module-caching/Dockerfile rename to docker-modules/docker-caching/single-module-caching/Dockerfile diff --git a/docker/docker-caching/single-module-caching/Dockerfile-Buildkit b/docker-modules/docker-caching/single-module-caching/Dockerfile-Buildkit similarity index 100% rename from docker/docker-caching/single-module-caching/Dockerfile-Buildkit rename to docker-modules/docker-caching/single-module-caching/Dockerfile-Buildkit diff --git a/docker/docker-caching/single-module-caching/pom.xml b/docker-modules/docker-caching/single-module-caching/pom.xml similarity index 100% rename from docker/docker-caching/single-module-caching/pom.xml rename to docker-modules/docker-caching/single-module-caching/pom.xml diff --git a/docker/docker-caching/single-module-caching/src/main/java/com/baeldung/maven_caching/MavenCachingMain.java b/docker-modules/docker-caching/single-module-caching/src/main/java/com/baeldung/maven_caching/MavenCachingMain.java similarity index 100% rename from docker/docker-caching/single-module-caching/src/main/java/com/baeldung/maven_caching/MavenCachingMain.java rename to docker-modules/docker-caching/single-module-caching/src/main/java/com/baeldung/maven_caching/MavenCachingMain.java diff --git a/docker/docker-compose.yml b/docker-modules/docker-compose.yml similarity index 100% rename from docker/docker-compose.yml rename to docker-modules/docker-compose.yml diff --git a/docker/docker-include-outside-build-context/projects/config/Dockerfile b/docker-modules/docker-include-outside-build-context/projects/config/Dockerfile similarity index 100% rename from docker/docker-include-outside-build-context/projects/config/Dockerfile rename to docker-modules/docker-include-outside-build-context/projects/config/Dockerfile diff --git a/docker/docker-include-outside-build-context/projects/config/nginx.conf b/docker-modules/docker-include-outside-build-context/projects/config/nginx.conf similarity index 100% rename from docker/docker-include-outside-build-context/projects/config/nginx.conf rename to docker-modules/docker-include-outside-build-context/projects/config/nginx.conf diff --git a/docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile b/docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile similarity index 100% rename from docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile rename to docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile diff --git a/docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-from-base b/docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-from-base similarity index 100% rename from docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-from-base rename to docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-from-base diff --git a/docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-script b/docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-script similarity index 100% rename from docker/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-script rename to docker-modules/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-script diff --git a/docker/docker-include-outside-build-context/projects/sample-site/docker/build-docker.sh b/docker-modules/docker-include-outside-build-context/projects/sample-site/docker/build-docker.sh similarity index 100% rename from docker/docker-include-outside-build-context/projects/sample-site/docker/build-docker.sh rename to docker-modules/docker-include-outside-build-context/projects/sample-site/docker/build-docker.sh diff --git a/docker/docker-include-outside-build-context/projects/sample-site/html/index.html b/docker-modules/docker-include-outside-build-context/projects/sample-site/html/index.html similarity index 100% rename from docker/docker-include-outside-build-context/projects/sample-site/html/index.html rename to docker-modules/docker-include-outside-build-context/projects/sample-site/html/index.html diff --git a/docker/docker-internal-dto/pom.xml b/docker-modules/docker-internal-dto/pom.xml similarity index 91% rename from docker/docker-internal-dto/pom.xml rename to docker-modules/docker-internal-dto/pom.xml index 09013d2fc3..467d46e7ae 100644 --- a/docker/docker-internal-dto/pom.xml +++ b/docker-modules/docker-internal-dto/pom.xml @@ -8,7 +8,7 @@ com.baeldung.docker - docker + docker-modules 0.0.1 diff --git a/docker/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java b/docker-modules/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java similarity index 100% rename from docker/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java rename to docker-modules/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java diff --git a/docker/docker-push-to-private-repo/.gitignore b/docker-modules/docker-push-to-private-repo/.gitignore similarity index 100% rename from docker/docker-push-to-private-repo/.gitignore rename to docker-modules/docker-push-to-private-repo/.gitignore diff --git a/docker/docker-push-to-private-repo/Dockerfile b/docker-modules/docker-push-to-private-repo/Dockerfile similarity index 100% rename from docker/docker-push-to-private-repo/Dockerfile rename to docker-modules/docker-push-to-private-repo/Dockerfile diff --git a/docker/docker-push-to-private-repo/README.md b/docker-modules/docker-push-to-private-repo/README.md similarity index 100% rename from docker/docker-push-to-private-repo/README.md rename to docker-modules/docker-push-to-private-repo/README.md diff --git a/docker/docker-push-to-private-repo/pom.xml b/docker-modules/docker-push-to-private-repo/pom.xml similarity index 96% rename from docker/docker-push-to-private-repo/pom.xml rename to docker-modules/docker-push-to-private-repo/pom.xml index 19be098794..c45baa65c3 100644 --- a/docker/docker-push-to-private-repo/pom.xml +++ b/docker-modules/docker-push-to-private-repo/pom.xml @@ -10,7 +10,7 @@ com.baeldung.docker - docker + docker-modules 0.0.1 diff --git a/docker/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/HelloWorldController.java b/docker-modules/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/HelloWorldController.java similarity index 100% rename from docker/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/HelloWorldController.java rename to docker-modules/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/HelloWorldController.java diff --git a/docker/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/PushToPrivateRepoApplication.java b/docker-modules/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/PushToPrivateRepoApplication.java similarity index 100% rename from docker/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/PushToPrivateRepoApplication.java rename to docker-modules/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/PushToPrivateRepoApplication.java diff --git a/docker/docker-push-to-private-repo/src/main/resources/application.properties b/docker-modules/docker-push-to-private-repo/src/main/resources/application.properties similarity index 100% rename from docker/docker-push-to-private-repo/src/main/resources/application.properties rename to docker-modules/docker-push-to-private-repo/src/main/resources/application.properties diff --git a/docker/docker-sample-app/Dockerfile b/docker-modules/docker-sample-app/Dockerfile similarity index 100% rename from docker/docker-sample-app/Dockerfile rename to docker-modules/docker-sample-app/Dockerfile diff --git a/docker/docker-sample-app/README.md b/docker-modules/docker-sample-app/README.md similarity index 100% rename from docker/docker-sample-app/README.md rename to docker-modules/docker-sample-app/README.md diff --git a/docker/docker-sample-app/docker-compose-build-image.yaml b/docker-modules/docker-sample-app/docker-compose-build-image.yaml similarity index 100% rename from docker/docker-sample-app/docker-compose-build-image.yaml rename to docker-modules/docker-sample-app/docker-compose-build-image.yaml diff --git a/docker/docker-sample-app/docker-compose-with-image.yaml b/docker-modules/docker-sample-app/docker-compose-with-image.yaml similarity index 100% rename from docker/docker-sample-app/docker-compose-with-image.yaml rename to docker-modules/docker-sample-app/docker-compose-with-image.yaml diff --git a/docker/docker-sample-app/pom.xml b/docker-modules/docker-sample-app/pom.xml similarity index 96% rename from docker/docker-sample-app/pom.xml rename to docker-modules/docker-sample-app/pom.xml index 24fede56fd..893fb4ebe2 100644 --- a/docker/docker-sample-app/pom.xml +++ b/docker-modules/docker-sample-app/pom.xml @@ -9,7 +9,7 @@ com.baeldung.docker - docker + docker-modules 0.0.1 diff --git a/docker/docker-sample-app/src/main/java/com/baeldung/docker/app/DockAppApplication.java b/docker-modules/docker-sample-app/src/main/java/com/baeldung/docker/app/DockAppApplication.java similarity index 100% rename from docker/docker-sample-app/src/main/java/com/baeldung/docker/app/DockAppApplication.java rename to docker-modules/docker-sample-app/src/main/java/com/baeldung/docker/app/DockAppApplication.java diff --git a/docker/docker-sample-app/src/main/java/com/baeldung/docker/app/endpoint/MyController.java b/docker-modules/docker-sample-app/src/main/java/com/baeldung/docker/app/endpoint/MyController.java similarity index 100% rename from docker/docker-sample-app/src/main/java/com/baeldung/docker/app/endpoint/MyController.java rename to docker-modules/docker-sample-app/src/main/java/com/baeldung/docker/app/endpoint/MyController.java diff --git a/docker/docker-sample-app/src/main/resources/application.properties b/docker-modules/docker-sample-app/src/main/resources/application.properties similarity index 100% rename from docker/docker-sample-app/src/main/resources/application.properties rename to docker-modules/docker-sample-app/src/main/resources/application.properties diff --git a/docker/docker-sample-app/src/test/java/com/baeldung/docker/app/DockAppApplicationUnitTest.java b/docker-modules/docker-sample-app/src/test/java/com/baeldung/docker/app/DockAppApplicationUnitTest.java similarity index 100% rename from docker/docker-sample-app/src/test/java/com/baeldung/docker/app/DockAppApplicationUnitTest.java rename to docker-modules/docker-sample-app/src/test/java/com/baeldung/docker/app/DockAppApplicationUnitTest.java diff --git a/docker/docker-spring-boot-postgres/.gitignore b/docker-modules/docker-spring-boot-postgres/.gitignore similarity index 100% rename from docker/docker-spring-boot-postgres/.gitignore rename to docker-modules/docker-spring-boot-postgres/.gitignore diff --git a/docker/docker-spring-boot-postgres/.mvn/wrapper/MavenWrapperDownloader.java b/docker-modules/docker-spring-boot-postgres/.mvn/wrapper/MavenWrapperDownloader.java similarity index 100% rename from docker/docker-spring-boot-postgres/.mvn/wrapper/MavenWrapperDownloader.java rename to docker-modules/docker-spring-boot-postgres/.mvn/wrapper/MavenWrapperDownloader.java diff --git a/docker/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.jar b/docker-modules/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from docker/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.jar rename to docker-modules/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.jar diff --git a/docker/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.properties b/docker-modules/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from docker/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.properties rename to docker-modules/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.properties diff --git a/docker/docker-spring-boot-postgres/mvnw b/docker-modules/docker-spring-boot-postgres/mvnw similarity index 100% rename from docker/docker-spring-boot-postgres/mvnw rename to docker-modules/docker-spring-boot-postgres/mvnw diff --git a/docker/docker-spring-boot-postgres/mvnw.cmd b/docker-modules/docker-spring-boot-postgres/mvnw.cmd similarity index 100% rename from docker/docker-spring-boot-postgres/mvnw.cmd rename to docker-modules/docker-spring-boot-postgres/mvnw.cmd diff --git a/docker/docker-spring-boot-postgres/pom.xml b/docker-modules/docker-spring-boot-postgres/pom.xml similarity index 100% rename from docker/docker-spring-boot-postgres/pom.xml rename to docker-modules/docker-spring-boot-postgres/pom.xml diff --git a/docker/docker-spring-boot-postgres/src/main/docker/Dockerfile b/docker-modules/docker-spring-boot-postgres/src/main/docker/Dockerfile similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/docker/Dockerfile rename to docker-modules/docker-spring-boot-postgres/src/main/docker/Dockerfile diff --git a/docker/docker-spring-boot-postgres/src/main/docker/docker-compose.yml b/docker-modules/docker-spring-boot-postgres/src/main/docker/docker-compose.yml similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/docker/docker-compose.yml rename to docker-modules/docker-spring-boot-postgres/src/main/docker/docker-compose.yml diff --git a/docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/Customer.java b/docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/Customer.java similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/Customer.java rename to docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/Customer.java diff --git a/docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/CustomerRepository.java b/docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/CustomerRepository.java similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/CustomerRepository.java rename to docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/CustomerRepository.java diff --git a/docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/DemoApplication.java b/docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/DemoApplication.java similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/DemoApplication.java rename to docker-modules/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/DemoApplication.java diff --git a/docker/docker-spring-boot-postgres/src/main/resources/application.properties b/docker-modules/docker-spring-boot-postgres/src/main/resources/application.properties similarity index 100% rename from docker/docker-spring-boot-postgres/src/main/resources/application.properties rename to docker-modules/docker-spring-boot-postgres/src/main/resources/application.properties diff --git a/docker/docker-spring-boot-postgres/src/test/java/com/baeldung/docker/DemoApplicationTests.java b/docker-modules/docker-spring-boot-postgres/src/test/java/com/baeldung/docker/DemoApplicationTests.java similarity index 100% rename from docker/docker-spring-boot-postgres/src/test/java/com/baeldung/docker/DemoApplicationTests.java rename to docker-modules/docker-spring-boot-postgres/src/test/java/com/baeldung/docker/DemoApplicationTests.java diff --git a/docker/docker-spring-boot/README.md b/docker-modules/docker-spring-boot/README.md similarity index 100% rename from docker/docker-spring-boot/README.md rename to docker-modules/docker-spring-boot/README.md diff --git a/docker/docker-spring-boot/pom.xml b/docker-modules/docker-spring-boot/pom.xml similarity index 97% rename from docker/docker-spring-boot/pom.xml rename to docker-modules/docker-spring-boot/pom.xml index 69d25e374b..22a5e254fe 100644 --- a/docker/docker-spring-boot/pom.xml +++ b/docker-modules/docker-spring-boot/pom.xml @@ -9,7 +9,7 @@ com.baeldung.docker - docker + docker-modules 0.0.1 diff --git a/docker/docker-spring-boot/src/layers.xml b/docker-modules/docker-spring-boot/src/layers.xml similarity index 100% rename from docker/docker-spring-boot/src/layers.xml rename to docker-modules/docker-spring-boot/src/layers.xml diff --git a/docker/docker-spring-boot/src/main/docker/Dockerfile b/docker-modules/docker-spring-boot/src/main/docker/Dockerfile similarity index 100% rename from docker/docker-spring-boot/src/main/docker/Dockerfile rename to docker-modules/docker-spring-boot/src/main/docker/Dockerfile diff --git a/docker/docker-spring-boot/src/main/docker/springprofile/Dockerfile b/docker-modules/docker-spring-boot/src/main/docker/springprofile/Dockerfile similarity index 100% rename from docker/docker-spring-boot/src/main/docker/springprofile/Dockerfile rename to docker-modules/docker-spring-boot/src/main/docker/springprofile/Dockerfile diff --git a/docker/docker-spring-boot/src/main/docker/springprofile/docker-compose-prod.yml b/docker-modules/docker-spring-boot/src/main/docker/springprofile/docker-compose-prod.yml similarity index 100% rename from docker/docker-spring-boot/src/main/docker/springprofile/docker-compose-prod.yml rename to docker-modules/docker-spring-boot/src/main/docker/springprofile/docker-compose-prod.yml diff --git a/docker/docker-spring-boot/src/main/docker/springprofile/docker-compose-test.yml b/docker-modules/docker-spring-boot/src/main/docker/springprofile/docker-compose-test.yml similarity index 100% rename from docker/docker-spring-boot/src/main/docker/springprofile/docker-compose-test.yml rename to docker-modules/docker-spring-boot/src/main/docker/springprofile/docker-compose-test.yml diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java b/docker-modules/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java similarity index 100% rename from docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java rename to docker-modules/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java b/docker-modules/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java similarity index 100% rename from docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java rename to docker-modules/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java diff --git a/docker/docker-spring-boot/src/main/resources/application.properties b/docker-modules/docker-spring-boot/src/main/resources/application.properties similarity index 100% rename from docker/docker-spring-boot/src/main/resources/application.properties rename to docker-modules/docker-spring-boot/src/main/resources/application.properties diff --git a/docker/dockerfile-with-git/.gitmodules b/docker-modules/dockerfile-with-git/.gitmodules similarity index 100% rename from docker/dockerfile-with-git/.gitmodules rename to docker-modules/dockerfile-with-git/.gitmodules diff --git a/docker/dockerfile-with-git/Dockerfile b/docker-modules/dockerfile-with-git/Dockerfile similarity index 100% rename from docker/dockerfile-with-git/Dockerfile rename to docker-modules/dockerfile-with-git/Dockerfile diff --git a/docker/heap-sizing/Dockerfile b/docker-modules/heap-sizing/Dockerfile similarity index 100% rename from docker/heap-sizing/Dockerfile rename to docker-modules/heap-sizing/Dockerfile diff --git a/docker/heap-sizing/pom.xml b/docker-modules/heap-sizing/pom.xml similarity index 100% rename from docker/heap-sizing/pom.xml rename to docker-modules/heap-sizing/pom.xml diff --git a/docker/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/HeapSizingApplication.java b/docker-modules/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/HeapSizingApplication.java similarity index 100% rename from docker/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/HeapSizingApplication.java rename to docker-modules/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/HeapSizingApplication.java diff --git a/docker/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/PrintXmxXms.java b/docker-modules/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/PrintXmxXms.java similarity index 100% rename from docker/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/PrintXmxXms.java rename to docker-modules/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/PrintXmxXms.java diff --git a/docker/pom.xml b/docker-modules/pom.xml similarity index 93% rename from docker/pom.xml rename to docker-modules/pom.xml index f46ceac963..87c7960a7f 100644 --- a/docker/pom.xml +++ b/docker-modules/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung.docker - docker + docker-modules 0.0.1 - docker + docker-modules Demo project showing Spring Boot and Docker pom diff --git a/feign/README.md b/feign/README.md index eeff55a4d4..2dea14ca52 100644 --- a/feign/README.md +++ b/feign/README.md @@ -6,4 +6,4 @@ This module contains articles about Feign - [Intro to Feign](https://www.baeldung.com/intro-to-feign) - [Retrying Feign Calls](https://www.baeldung.com/feign-retry) - +- [Setting Request Headers Using Feign](https://www.baeldung.com/java-feign-request-headers) diff --git a/graphql/graphql-dgs/README.md b/graphql-modules/graphql-dgs/README.md similarity index 100% rename from graphql/graphql-dgs/README.md rename to graphql-modules/graphql-dgs/README.md diff --git a/graphql/graphql-dgs/pom.xml b/graphql-modules/graphql-dgs/pom.xml similarity index 98% rename from graphql/graphql-dgs/pom.xml rename to graphql-modules/graphql-dgs/pom.xml index 56e261f14d..051785b4b8 100644 --- a/graphql/graphql-dgs/pom.xml +++ b/graphql-modules/graphql-dgs/pom.xml @@ -9,7 +9,7 @@ com.baeldung.graphql - graphql + graphql-modules 1.0.0-SNAPSHOT diff --git a/graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Album.java b/graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Album.java similarity index 100% rename from graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Album.java rename to graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Album.java diff --git a/graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java b/graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java similarity index 100% rename from graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java rename to graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java diff --git a/graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Application.java b/graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Application.java similarity index 100% rename from graphql/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Application.java rename to graphql-modules/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Application.java diff --git a/graphql/graphql-dgs/src/main/resources/application.properties b/graphql-modules/graphql-dgs/src/main/resources/application.properties similarity index 100% rename from graphql/graphql-dgs/src/main/resources/application.properties rename to graphql-modules/graphql-dgs/src/main/resources/application.properties diff --git a/graphql/graphql-dgs/src/main/resources/schema/schema.graphqls b/graphql-modules/graphql-dgs/src/main/resources/schema/schema.graphqls similarity index 100% rename from graphql/graphql-dgs/src/main/resources/schema/schema.graphqls rename to graphql-modules/graphql-dgs/src/main/resources/schema/schema.graphqls diff --git a/graphql/graphql-error-handling/README.md b/graphql-modules/graphql-error-handling/README.md similarity index 100% rename from graphql/graphql-error-handling/README.md rename to graphql-modules/graphql-error-handling/README.md diff --git a/graphql/graphql-error-handling/pom.xml b/graphql-modules/graphql-error-handling/pom.xml similarity index 98% rename from graphql/graphql-error-handling/pom.xml rename to graphql-modules/graphql-error-handling/pom.xml index 92696d8ed7..f10bb524fb 100644 --- a/graphql/graphql-error-handling/pom.xml +++ b/graphql-modules/graphql-error-handling/pom.xml @@ -10,7 +10,7 @@ com.baeldung.graphql - graphql + graphql-modules 1.0.0-SNAPSHOT diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplication.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplication.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplication.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplication.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Location.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Location.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Location.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Location.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Vehicle.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Vehicle.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Vehicle.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Vehicle.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/AbstractGraphQLException.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/AbstractGraphQLException.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/AbstractGraphQLException.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/AbstractGraphQLException.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/GraphQLErrorAdapter.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/GraphQLErrorAdapter.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/GraphQLErrorAdapter.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/GraphQLErrorAdapter.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/InvalidInputException.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/InvalidInputException.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/InvalidInputException.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/InvalidInputException.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleNotFoundException.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleNotFoundException.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleNotFoundException.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleNotFoundException.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/InventoryRepository.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/InventoryRepository.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/InventoryRepository.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/InventoryRepository.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/LocationRepository.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/LocationRepository.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/LocationRepository.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/LocationRepository.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Mutation.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Mutation.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Mutation.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Mutation.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Query.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Query.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Query.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Query.java diff --git a/graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/service/InventoryService.java b/graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/service/InventoryService.java similarity index 100% rename from graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/service/InventoryService.java rename to graphql-modules/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/service/InventoryService.java diff --git a/graphql/graphql-error-handling/src/main/resources/application.yml b/graphql-modules/graphql-error-handling/src/main/resources/application.yml similarity index 100% rename from graphql/graphql-error-handling/src/main/resources/application.yml rename to graphql-modules/graphql-error-handling/src/main/resources/application.yml diff --git a/graphql/graphql-error-handling/src/main/resources/graphql/inventory.graphqls b/graphql-modules/graphql-error-handling/src/main/resources/graphql/inventory.graphqls similarity index 100% rename from graphql/graphql-error-handling/src/main/resources/graphql/inventory.graphqls rename to graphql-modules/graphql-error-handling/src/main/resources/graphql/inventory.graphqls diff --git a/graphql/graphql-error-handling/src/main/resources/import.sql b/graphql-modules/graphql-error-handling/src/main/resources/import.sql similarity index 100% rename from graphql/graphql-error-handling/src/main/resources/import.sql rename to graphql-modules/graphql-error-handling/src/main/resources/import.sql diff --git a/graphql/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplicationIntegrationTest.java b/graphql-modules/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplicationIntegrationTest.java similarity index 100% rename from graphql/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplicationIntegrationTest.java rename to graphql-modules/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplicationIntegrationTest.java diff --git a/graphql/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/TestUtils.java b/graphql-modules/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/TestUtils.java similarity index 100% rename from graphql/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/TestUtils.java rename to graphql-modules/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/TestUtils.java diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/request/field_error_request_non_null_fields_partial_response.graphql b/graphql-modules/graphql-error-handling/src/test/resources/graphql/request/field_error_request_non_null_fields_partial_response.graphql similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/request/field_error_request_non_null_fields_partial_response.graphql rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/request/field_error_request_non_null_fields_partial_response.graphql diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/request/request_error_invalid_request_syntax.graphql b/graphql-modules/graphql-error-handling/src/test/resources/graphql/request/request_error_invalid_request_syntax.graphql similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/request/request_error_invalid_request_syntax.graphql rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/request/request_error_invalid_request_syntax.graphql diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/request/request_error_unknown_operation.graphql b/graphql-modules/graphql-error-handling/src/test/resources/graphql/request/request_error_unknown_operation.graphql similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/request/request_error_unknown_operation.graphql rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/request/request_error_unknown_operation.graphql diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/response/field_error_request_non_null_fields_partial_response.json b/graphql-modules/graphql-error-handling/src/test/resources/graphql/response/field_error_request_non_null_fields_partial_response.json similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/response/field_error_request_non_null_fields_partial_response.json rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/response/field_error_request_non_null_fields_partial_response.json diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/response/request_error_invalid_request_syntax.json b/graphql-modules/graphql-error-handling/src/test/resources/graphql/response/request_error_invalid_request_syntax.json similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/response/request_error_invalid_request_syntax.json rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/response/request_error_invalid_request_syntax.json diff --git a/graphql/graphql-error-handling/src/test/resources/graphql/response/request_error_unknown_operation.json b/graphql-modules/graphql-error-handling/src/test/resources/graphql/response/request_error_unknown_operation.json similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/graphql/response/request_error_unknown_operation.json rename to graphql-modules/graphql-error-handling/src/test/resources/graphql/response/request_error_unknown_operation.json diff --git a/graphql/graphql-error-handling/src/test/resources/init_script.sql b/graphql-modules/graphql-error-handling/src/test/resources/init_script.sql similarity index 100% rename from graphql/graphql-error-handling/src/test/resources/init_script.sql rename to graphql-modules/graphql-error-handling/src/test/resources/init_script.sql diff --git a/graphql/graphql-java/README.md b/graphql-modules/graphql-java/README.md similarity index 100% rename from graphql/graphql-java/README.md rename to graphql-modules/graphql-java/README.md diff --git a/graphql/graphql-java/payload-examples/createUser.json b/graphql-modules/graphql-java/payload-examples/createUser.json similarity index 100% rename from graphql/graphql-java/payload-examples/createUser.json rename to graphql-modules/graphql-java/payload-examples/createUser.json diff --git a/graphql/graphql-java/payload-examples/deleteUser.json b/graphql-modules/graphql-java/payload-examples/deleteUser.json similarity index 100% rename from graphql/graphql-java/payload-examples/deleteUser.json rename to graphql-modules/graphql-java/payload-examples/deleteUser.json diff --git a/graphql/graphql-java/payload-examples/listUsers.json b/graphql-modules/graphql-java/payload-examples/listUsers.json similarity index 100% rename from graphql/graphql-java/payload-examples/listUsers.json rename to graphql-modules/graphql-java/payload-examples/listUsers.json diff --git a/graphql/graphql-java/payload-examples/retrieveUser.json b/graphql-modules/graphql-java/payload-examples/retrieveUser.json similarity index 100% rename from graphql/graphql-java/payload-examples/retrieveUser.json rename to graphql-modules/graphql-java/payload-examples/retrieveUser.json diff --git a/graphql/graphql-java/payload-examples/searchName.json b/graphql-modules/graphql-java/payload-examples/searchName.json similarity index 100% rename from graphql/graphql-java/payload-examples/searchName.json rename to graphql-modules/graphql-java/payload-examples/searchName.json diff --git a/graphql/graphql-java/payload-examples/updateUser.json b/graphql-modules/graphql-java/payload-examples/updateUser.json similarity index 100% rename from graphql/graphql-java/payload-examples/updateUser.json rename to graphql-modules/graphql-java/payload-examples/updateUser.json diff --git a/graphql/graphql-java/pom.xml b/graphql-modules/graphql-java/pom.xml similarity index 99% rename from graphql/graphql-java/pom.xml rename to graphql-modules/graphql-java/pom.xml index b0b2c15359..1993130b12 100644 --- a/graphql/graphql-java/pom.xml +++ b/graphql-modules/graphql-java/pom.xml @@ -1,3 +1,4 @@ + com.baeldung.graphql - graphql + graphql-modules 1.0.0-SNAPSHOT diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/Application.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/Application.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/Application.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/Application.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/clients/AmericanExpressNodes.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/clients/AmericanExpressNodes.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/clients/AmericanExpressNodes.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/clients/AmericanExpressNodes.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/clients/ApacheHttpClient.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/clients/ApacheHttpClient.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/clients/ApacheHttpClient.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/clients/ApacheHttpClient.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Author.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Author.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Author.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Author.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Book.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Book.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Book.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Book.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/data/BookRepository.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/BookRepository.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/data/BookRepository.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/BookRepository.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Data.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Data.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Data.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Data.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Response.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Response.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/data/Response.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/data/Response.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLEndpoint.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLEndpoint.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLEndpoint.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLEndpoint.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLQuery.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLQuery.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLQuery.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLQuery.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/AppHandler.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/AppHandler.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/AppHandler.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/AppHandler.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/ExtendedGraphQLScalarType.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/ExtendedGraphQLScalarType.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/ExtendedGraphQLScalarType.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/ExtendedGraphQLScalarType.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/GraphqlReturnMap.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/GraphqlReturnMap.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/GraphqlReturnMap.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/GraphqlReturnMap.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Attribute.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Attribute.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Attribute.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Attribute.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Product.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Product.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Product.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Product.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/model/AttributeKeyValueModel.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/model/AttributeKeyValueModel.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/model/AttributeKeyValueModel.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/model/AttributeKeyValueModel.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/ProductRepository.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/ProductRepository.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/ProductRepository.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/ProductRepository.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/impl/ProductRepositoryImpl.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/impl/ProductRepositoryImpl.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/impl/ProductRepositoryImpl.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/impl/ProductRepositoryImpl.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/ProductResolver.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/ProductResolver.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/ProductResolver.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/ProductResolver.java diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/Query.java b/graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/Query.java similarity index 100% rename from graphql/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/Query.java rename to graphql-modules/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/Query.java diff --git a/graphql/graphql-java/src/main/resources/logback.xml b/graphql-modules/graphql-java/src/main/resources/logback.xml similarity index 100% rename from graphql/graphql-java/src/main/resources/logback.xml rename to graphql-modules/graphql-java/src/main/resources/logback.xml diff --git a/graphql/graphql-java/src/main/resources/schema.graphqls b/graphql-modules/graphql-java/src/main/resources/schema.graphqls similarity index 100% rename from graphql/graphql-java/src/main/resources/schema.graphqls rename to graphql-modules/graphql-java/src/main/resources/schema.graphqls diff --git a/graphql/graphql-java/src/test/java/com/baeldung/graphql/GraphQLMockServer.java b/graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/GraphQLMockServer.java similarity index 100% rename from graphql/graphql-java/src/test/java/com/baeldung/graphql/GraphQLMockServer.java rename to graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/GraphQLMockServer.java diff --git a/graphql/graphql-java/src/test/java/com/baeldung/graphql/clients/AmericanExpressNodesUnitTest.java b/graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/clients/AmericanExpressNodesUnitTest.java similarity index 100% rename from graphql/graphql-java/src/test/java/com/baeldung/graphql/clients/AmericanExpressNodesUnitTest.java rename to graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/clients/AmericanExpressNodesUnitTest.java diff --git a/graphql/graphql-java/src/test/java/com/baeldung/graphql/clients/ApacheHttpClientUnitTest.java b/graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/clients/ApacheHttpClientUnitTest.java similarity index 100% rename from graphql/graphql-java/src/test/java/com/baeldung/graphql/clients/ApacheHttpClientUnitTest.java rename to graphql-modules/graphql-java/src/test/java/com/baeldung/graphql/clients/ApacheHttpClientUnitTest.java diff --git a/graphql/graphql-spqr/README.md b/graphql-modules/graphql-spqr/README.md similarity index 100% rename from graphql/graphql-spqr/README.md rename to graphql-modules/graphql-spqr/README.md diff --git a/graphql/graphql-spqr/pom.xml b/graphql-modules/graphql-spqr/pom.xml similarity index 95% rename from graphql/graphql-spqr/pom.xml rename to graphql-modules/graphql-spqr/pom.xml index 75a1b5d79b..7bc450036a 100644 --- a/graphql/graphql-spqr/pom.xml +++ b/graphql-modules/graphql-spqr/pom.xml @@ -9,7 +9,7 @@ com.baeldung.graphql - graphql + graphql-modules 1.0.0-SNAPSHOT diff --git a/graphql/graphql-spqr/src/main/java/com/baeldung/SpringBootApp.java b/graphql-modules/graphql-spqr/src/main/java/com/baeldung/SpringBootApp.java similarity index 100% rename from graphql/graphql-spqr/src/main/java/com/baeldung/SpringBootApp.java rename to graphql-modules/graphql-spqr/src/main/java/com/baeldung/SpringBootApp.java diff --git a/graphql/graphql-spqr/src/main/java/com/baeldung/spqr/Book.java b/graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/Book.java similarity index 100% rename from graphql/graphql-spqr/src/main/java/com/baeldung/spqr/Book.java rename to graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/Book.java diff --git a/graphql/graphql-spqr/src/main/java/com/baeldung/spqr/BookService.java b/graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/BookService.java similarity index 100% rename from graphql/graphql-spqr/src/main/java/com/baeldung/spqr/BookService.java rename to graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/BookService.java diff --git a/graphql/graphql-spqr/src/main/java/com/baeldung/spqr/IBookService.java b/graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/IBookService.java similarity index 100% rename from graphql/graphql-spqr/src/main/java/com/baeldung/spqr/IBookService.java rename to graphql-modules/graphql-spqr/src/main/java/com/baeldung/spqr/IBookService.java diff --git a/graphql/pom.xml b/graphql-modules/pom.xml similarity index 90% rename from graphql/pom.xml rename to graphql-modules/pom.xml index aec097752a..7a77e3ff0c 100644 --- a/graphql/pom.xml +++ b/graphql-modules/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung.graphql - graphql + graphql-modules 1.0.0-SNAPSHOT - graphql + graphql-modules pom @@ -23,4 +23,4 @@ graphql-spqr - \ No newline at end of file + diff --git a/java-numbers-4/README.md b/java-numbers-4/README.md index 2a77992c8f..12f9890ee3 100644 --- a/java-numbers-4/README.md +++ b/java-numbers-4/README.md @@ -9,3 +9,4 @@ - [Convert boolean to int in Java](https://www.baeldung.com/java-boolean-to-int) - [Generate a Random Value From an Enum](https://www.baeldung.com/java-enum-random-value) - [Reverse a Number in Java](https://www.baeldung.com/java-reverse-number) +- [Check if BigDecimal Value Is Zero](https://www.baeldung.com/java-bigdecimal-zero) diff --git a/java-numbers-4/src/test/java/com/baeldung/bigdecimalzero/BigDecimalZeroChkUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/bigdecimalzero/BigDecimalZeroChkUnitTest.java new file mode 100644 index 0000000000..a61bfe1dd7 --- /dev/null +++ b/java-numbers-4/src/test/java/com/baeldung/bigdecimalzero/BigDecimalZeroChkUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.bigdecimalzero; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.math.BigDecimal; + +import org.junit.jupiter.api.Test; + +class BigDecimalZeroChkUnitTest { + private static final BigDecimal BD1 = new BigDecimal("0"); + private static final BigDecimal BD2 = new BigDecimal("0.0000"); + + @Test + void givenBD_whenCheckedWithEquals_shouldCheckedAsZero() { + assertThat(BigDecimal.ZERO.equals(BD1)).isTrue(); + + // in the article, we show the failure of the assertion below + // assertThat(BigDecimal.ZERO.equals(BD2)).isTrue(); + + assertThat(BigDecimal.ZERO.equals(BD2)).isFalse(); + } + + @Test + void givenBD_whenCheckedWithCompareTo_shouldCheckedAsZero() { + assertThat(BigDecimal.ZERO.compareTo(BD1)).isSameAs(0); + assertThat(BigDecimal.ZERO.compareTo(BD2)).isSameAs(0); + } + + @Test + void givenBD_whenCheckedWithSignum_shouldCheckedAsZero() { + assertThat(BD1.signum()).isSameAs(0); + assertThat(BD2.signum()).isSameAs(0); + } +} diff --git a/javax-servlets-2/README.md b/javax-servlets-2/README.md index 9a7ad02d39..cd599890ad 100644 --- a/javax-servlets-2/README.md +++ b/javax-servlets-2/README.md @@ -4,3 +4,4 @@ This module contains articles about Servlets. ### Relevant Articles: - [Check if a User Is Logged-in With Servlets and JSP](https://www.baeldung.com/servlets-jsp-check-user-login) +- [How to Mock HttpServletRequest](https://www.baeldung.com/java-httpservletrequest-mock) diff --git a/javax-servlets-2/pom.xml b/javax-servlets-2/pom.xml index 5d8310f2b2..6469c66db6 100644 --- a/javax-servlets-2/pom.xml +++ b/javax-servlets-2/pom.xml @@ -39,6 +39,18 @@ jstl ${jstl.version} + + org.jmockit + jmockit + ${jmockit.version} + test + + + org.springframework + spring-test + ${spring-test.version} + test + org.apache.httpcomponents httpclient @@ -53,9 +65,26 @@ + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + -javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar + + + + + + 4.5.13 4.0.1 + 1.49 + 5.3.20 + 2.22.2 \ No newline at end of file diff --git a/javax-servlets-2/src/main/java/com/baeldung/servlets/UserServlet.java b/javax-servlets-2/src/main/java/com/baeldung/servlets/UserServlet.java new file mode 100644 index 0000000000..a71a4da8e4 --- /dev/null +++ b/javax-servlets-2/src/main/java/com/baeldung/servlets/UserServlet.java @@ -0,0 +1,24 @@ +package com.baeldung.servlets; + +import java.io.IOException; + +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(name = "UserServlet", urlPatterns = "/user") +public class UserServlet extends HttpServlet { + + private static final long serialVersionUID = 2923732283720972121L; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + String firstName = request.getParameter("firstName"); + String lastName = request.getParameter("lastName"); + + response.getWriter() + .append("Full Name: " + firstName + " " + lastName); + } + +} diff --git a/javax-servlets-2/src/test/java/com/baeldung/servlets/TestUtil.java b/javax-servlets-2/src/test/java/com/baeldung/servlets/TestUtil.java new file mode 100644 index 0000000000..e010de3a55 --- /dev/null +++ b/javax-servlets-2/src/test/java/com/baeldung/servlets/TestUtil.java @@ -0,0 +1,678 @@ +package com.baeldung.servlets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; +import javax.servlet.http.Part; + +public class TestUtil { + + public static HttpServletRequest getRequest(Map params) { + return new HttpServletRequest() { + + @Override + public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException { + // TODO Auto-generated method stub + return null; + } + + @Override + public AsyncContext startAsync() throws IllegalStateException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setCharacterEncoding(String env) throws UnsupportedEncodingException { + // TODO Auto-generated method stub + + } + + @Override + public void setAttribute(String name, Object o) { + // TODO Auto-generated method stub + + } + + @Override + public void removeAttribute(String name) { + // TODO Auto-generated method stub + + } + + @Override + public boolean isSecure() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isAsyncSupported() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isAsyncStarted() { + // TODO Auto-generated method stub + return false; + } + + @Override + public ServletContext getServletContext() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getServerPort() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getServerName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getScheme() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RequestDispatcher getRequestDispatcher(String path) { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getRemotePort() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getRemoteHost() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRemoteAddr() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRealPath(String path) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BufferedReader getReader() throws IOException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getProtocol() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String[] getParameterValues(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Enumeration getParameterNames() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getParameterMap() { + return params; + } + + @Override + public String getParameter(String name) { + String[] values = params.get(name); + if (values == null || values.length == 0) + return null; + return values[0]; + } + + @Override + public Enumeration getLocales() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Locale getLocale() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getLocalPort() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getLocalName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLocalAddr() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ServletInputStream getInputStream() throws IOException { + // TODO Auto-generated method stub + return null; + } + + @Override + public DispatcherType getDispatcherType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getContentType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getContentLengthLong() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getContentLength() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getCharacterEncoding() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Enumeration getAttributeNames() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getAttribute(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AsyncContext getAsyncContext() { + // TODO Auto-generated method stub + return null; + } + + @Override + public T upgrade(Class handlerClass) throws IOException, ServletException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void logout() throws ServletException { + // TODO Auto-generated method stub + + } + + @Override + public void login(String username, String password) throws ServletException { + // TODO Auto-generated method stub + + } + + @Override + public boolean isUserInRole(String role) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isRequestedSessionIdValid() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isRequestedSessionIdFromUrl() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isRequestedSessionIdFromURL() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isRequestedSessionIdFromCookie() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Principal getUserPrincipal() { + // TODO Auto-generated method stub + return null; + } + + @Override + public HttpSession getSession(boolean create) { + // TODO Auto-generated method stub + return null; + } + + @Override + public HttpSession getSession() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getServletPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRequestedSessionId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public StringBuffer getRequestURL() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRequestURI() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRemoteUser() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getQueryString() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getPathTranslated() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getPathInfo() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Collection getParts() throws IOException, ServletException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Part getPart(String name) throws IOException, ServletException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getMethod() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getIntHeader(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Enumeration getHeaders(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Enumeration getHeaderNames() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getHeader(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getDateHeader(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Cookie[] getCookies() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getContextPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getAuthType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String changeSessionId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { + // TODO Auto-generated method stub + return false; + } + }; + } + + public static HttpServletResponse getResponse(StringWriter writer) { + + return new HttpServletResponse() { + + @Override + public void setLocale(Locale loc) { + // TODO Auto-generated method stub + + } + + @Override + public void setContentType(String type) { + // TODO Auto-generated method stub + + } + + @Override + public void setContentLengthLong(long len) { + // TODO Auto-generated method stub + + } + + @Override + public void setContentLength(int len) { + // TODO Auto-generated method stub + + } + + @Override + public void setCharacterEncoding(String charset) { + // TODO Auto-generated method stub + + } + + @Override + public void setBufferSize(int size) { + // TODO Auto-generated method stub + + } + + @Override + public void resetBuffer() { + // TODO Auto-generated method stub + + } + + @Override + public void reset() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isCommitted() { + return true; + } + + @Override + public PrintWriter getWriter() throws IOException { + return new PrintWriter(writer, isCommitted()); + } + + @Override + public ServletOutputStream getOutputStream() throws IOException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Locale getLocale() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getContentType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCharacterEncoding() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getBufferSize() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void flushBuffer() throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public void setStatus(int sc, String sm) { + // TODO Auto-generated method stub + + } + + @Override + public void setStatus(int sc) { + // TODO Auto-generated method stub + + } + + @Override + public void setIntHeader(String name, int value) { + // TODO Auto-generated method stub + + } + + @Override + public void setHeader(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void setDateHeader(String name, long date) { + // TODO Auto-generated method stub + + } + + @Override + public void sendRedirect(String location) throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public void sendError(int sc, String msg) throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public void sendError(int sc) throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public int getStatus() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Collection getHeaders(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Collection getHeaderNames() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getHeader(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String encodeUrl(String url) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String encodeURL(String url) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String encodeRedirectUrl(String url) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String encodeRedirectURL(String url) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean containsHeader(String name) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void addIntHeader(String name, int value) { + // TODO Auto-generated method stub + + } + + @Override + public void addHeader(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void addDateHeader(String name, long date) { + // TODO Auto-generated method stub + + } + + @Override + public void addCookie(Cookie cookie) { + // TODO Auto-generated method stub + + } + }; + + } +} \ No newline at end of file diff --git a/javax-servlets-2/src/test/java/com/baeldung/servlets/UserServletUnitTest.java b/javax-servlets-2/src/test/java/com/baeldung/servlets/UserServletUnitTest.java new file mode 100644 index 0000000000..7c207d5be3 --- /dev/null +++ b/javax-servlets-2/src/test/java/com/baeldung/servlets/UserServletUnitTest.java @@ -0,0 +1,93 @@ +package com.baeldung.servlets; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; + +import mockit.Expectations; +import mockit.Mocked; + +class UserServletUnitTest { + + private UserServlet servlet; + private StringWriter writer; + + @Mocked + HttpServletRequest mockRequest; + @Mocked + HttpServletResponse mockResponse; + + @BeforeEach + public void setUp() throws IOException { + servlet = new UserServlet(); + writer = new StringWriter(); + } + + @Test + void givenHttpServletRequest_whenUsingAnonymousClass_thenReturnsParameterValues() throws IOException { + final Map params = new HashMap<>(); + params.put("firstName", new String[] { "Anonymous Class" }); + params.put("lastName", new String[] { "Test" }); + + servlet.doGet(TestUtil.getRequest(params), TestUtil.getResponse(writer)); + + assertThat(writer.toString()).isEqualTo("Full Name: Anonymous Class Test"); + } + + @Test + void givenHttpServletRequest_whenMockedWithMockito_thenReturnsParameterValues() throws IOException { + // mock HttpServletRequest & HttpServletResponse + HttpServletRequest request = mock(HttpServletRequest.class); + HttpServletResponse response = mock(HttpServletResponse.class); + + // mock the returned value of request.getParameterMap() + when(request.getParameter("firstName")).thenReturn("Mockito"); + when(request.getParameter("lastName")).thenReturn("Test"); + when(response.getWriter()).thenReturn(new PrintWriter(writer)); + + servlet.doGet(request, response); + + assertThat(writer.toString()).isEqualTo("Full Name: Mockito Test"); + } + + @Test + void givenHttpServletRequest_whenMockedWithJMockit_thenReturnsParameterValues() throws IOException { + + new Expectations() {{ + mockRequest.getParameter("firstName"); result = "JMockit"; + mockRequest.getParameter("lastName"); result = "Test"; + mockResponse.getWriter(); result = new PrintWriter(writer); + }}; + + servlet.doGet(mockRequest, mockResponse); + + assertThat(writer.toString()).isEqualTo("Full Name: JMockit Test"); + } + + @Test + void givenHttpServletRequest_whenUsingMockHttpServletRequest_thenReturnsParameterValues() throws IOException { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setParameter("firstName", "Spring"); + request.setParameter("lastName", "Test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + + servlet.doGet(request, response); + + assertThat(response.getContentAsString()).isEqualTo("Full Name: Spring Test"); + } + +} diff --git a/javax-sound/README.md b/javax-sound/README.md new file mode 100644 index 0000000000..9776e7754a --- /dev/null +++ b/javax-sound/README.md @@ -0,0 +1,3 @@ + +### Relevant Articles: +- [How to Play Sound With Java](https://www.baeldung.com/java-play-sound) diff --git a/pom.xml b/pom.xml index 9fa62d27ee..fccf6aafe7 100644 --- a/pom.xml +++ b/pom.xml @@ -337,7 +337,7 @@ annotations antlr - apache-cxf + apache-cxf-modules apache-kafka apache-libraries apache-olingo @@ -372,10 +372,7 @@ cloud-foundry-uaa code-generation - core-groovy - core-groovy-2 - core-groovy-collections - core-groovy-strings + core-groovy-modules core-java-modules @@ -405,7 +402,7 @@ - graphql + graphql-modules grpc gson guava-modules @@ -795,11 +792,11 @@ akka-http akka-streams - algorithms-modules + algorithms-modules annotations antlr - apache-cxf + apache-cxf-modules apache-kafka apache-libraries apache-olingo @@ -834,10 +831,7 @@ cloud-foundry-uaa code-generation - core-groovy - core-groovy-2 - core-groovy-collections - core-groovy-strings + core-groovy-modules core-java-modules @@ -867,7 +861,7 @@ - graphql + graphql-modules grpc gson guava-modules @@ -1303,7 +1297,7 @@ core-java-modules/core-java-strings core-java-modules/core-java-httpclient ddd-contexts - docker + docker-modules apache-httpclient-2 libraries-concurrency persistence-modules/sirix @@ -1371,7 +1365,7 @@ core-java-modules/multimodulemavenproject core-java-modules/core-java-strings ddd-contexts - docker + docker-modules apache-httpclient-2 libraries-concurrency persistence-modules/sirix diff --git a/spring-boot-modules/spring-boot-libraries/README.md b/spring-boot-modules/spring-boot-libraries/README.md index b72815e4a9..cc7e511ac8 100644 --- a/spring-boot-modules/spring-boot-libraries/README.md +++ b/spring-boot-modules/spring-boot-libraries/README.md @@ -14,6 +14,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Boot and Caffeine Cache](https://www.baeldung.com/spring-boot-caffeine-cache) - [Spring Boot and Togglz Aspect](https://www.baeldung.com/spring-togglz) - [Getting Started with GraphQL and Spring Boot](https://www.baeldung.com/spring-graphql) +- [Expose GraphQL Field with Different Name](https://www.baeldung.com/expose-graphql-field-with-different-name) - More articles: [[next -->]](/spring-boot-modules/spring-boot-libraries-2) ### GraphQL sample queries diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java index 329d1f469a..d4dff23a29 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java @@ -12,4 +12,9 @@ public class PostResolver implements GraphQLResolver { public Author getAuthor(Post post) { return authorDao.getAuthor(post.getAuthorId()).orElseThrow(RuntimeException::new); } + + public Author getFirst_author(Post post) { + return authorDao.getAuthor(post.getAuthorId()).orElseThrow(RuntimeException::new); + } + } diff --git a/spring-boot-modules/spring-boot-libraries/src/main/resources/graphql/post.graphqls b/spring-boot-modules/spring-boot-libraries/src/main/resources/graphql/post.graphqls index 0e42f7255c..e426f3508f 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/resources/graphql/post.graphqls +++ b/spring-boot-modules/spring-boot-libraries/src/main/resources/graphql/post.graphqls @@ -4,6 +4,7 @@ type Post { text: String! category: String author: Author! + first_author: Author! } type Author { diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java index 216740f979..8cb1ca1f60 100644 --- a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java @@ -52,6 +52,7 @@ public class SecurityConfiguration { //@formatter:off return http .authorizeHttpRequests(authorizeRequests -> authorizeRequests + .antMatchers("/api/auth/**", "/swagger-ui-custom.html" ,"/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", "/swagger-ui/index.html","/api-docs/**") .permitAll() diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java index ba396e1703..4e759c87e4 100644 --- a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java @@ -14,4 +14,3 @@ public class SecurityTokenApplication { SpringApplication.run(SecurityTokenApplication.class); } } - diff --git a/spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java b/spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java index fecd4101eb..a4920914fd 100644 --- a/spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java +++ b/spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java @@ -43,8 +43,7 @@ class OpenApiJwtIntegrationTest { assertNotNull(authenticationApi); - ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", - String.class); + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", String.class); assertNotNull(response); assertEquals(HttpStatus.OK, response.getStatusCode()); @@ -59,8 +58,8 @@ class OpenApiJwtIntegrationTest { assertNotNull(authenticationApi); - ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", - String.class); + + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", String.class); assertNotNull(response); assertNotNull(response.getBody()); @@ -75,8 +74,7 @@ class OpenApiJwtIntegrationTest { assertNotNull(authenticationApi); - ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", - String.class); + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/api-docs", String.class); assertNotNull(response); assertNotNull(response.getBody()); diff --git a/spring-boot-modules/spring-boot-testing-2/README.md b/spring-boot-modules/spring-boot-testing-2/README.md index afc75f6727..a32469fb2f 100644 --- a/spring-boot-modules/spring-boot-testing-2/README.md +++ b/spring-boot-modules/spring-boot-testing-2/README.md @@ -10,4 +10,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Setting the Log Level in Spring Boot when Testing](https://www.baeldung.com/spring-boot-testing-log-level) - [Failed to Load ApplicationContext for JUnit Test of Spring Controller](https://www.baeldung.com/spring-junit-failed-to-load-applicationcontext) +- [Spring Web Service Integration Tests with @WebServiceServerTest](https://www.baeldung.com/spring-webserviceservertest) - More articles: [[<-- prev]](../spring-boot-testing) diff --git a/spring-cloud-modules/spring-cloud-docker/README.md b/spring-cloud-modules/spring-cloud-docker/README.md index 018d4ab1eb..9c7eac5105 100644 --- a/spring-cloud-modules/spring-cloud-docker/README.md +++ b/spring-cloud-modules/spring-cloud-docker/README.md @@ -1,3 +1,4 @@ ## Relevant Articles: - [Dockerizing a Spring Boot Application](https://www.baeldung.com/dockerizing-spring-boot-application) +- [Docker Compose Restart Policies](https://www.baeldung.com/ops/docker-compose-restart-policies) diff --git a/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml new file mode 100644 index 0000000000..ddc1e4001a --- /dev/null +++ b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml @@ -0,0 +1,37 @@ +version: '3' +services: + message-server: + container_name: message-server + build: + context: docker-message-server + dockerfile: Dockerfile + image: message-server:latest + ports: + - 18888:8888 + networks: + - spring-cloud-network + deploy: + restart_policy: + condition: any + delay: 5s + max_attempts: 3 + window: 120s + product-server: + container_name: product-server + build: + context: docker-product-server + dockerfile: Dockerfile + image: product-server:latest + ports: + - 19999:9999 + networks: + - spring-cloud-network + deploy: + restart_policy: + condition: on-failure + delay: 3s + max_attempts: 5 + window: 60s +networks: + spring-cloud-network: + driver: bridge diff --git a/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy.yml b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy.yml new file mode 100644 index 0000000000..e305b00dc4 --- /dev/null +++ b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy.yml @@ -0,0 +1,27 @@ +version: '2' +services: + message-server: + container_name: message-server + build: + context: docker-message-server + dockerfile: Dockerfile + image: message-server:latest + ports: + - 18888:8888 + networks: + - spring-cloud-network + restart: always + product-server: + container_name: product-server + build: + context: docker-product-server + dockerfile: Dockerfile + image: product-server:latest + ports: + - 19999:9999 + networks: + - spring-cloud-network + restart: on-failure +networks: + spring-cloud-network: + driver: bridge diff --git a/spring-cloud-modules/spring-cloud-netflix-sidecar/README.md b/spring-cloud-modules/spring-cloud-netflix-sidecar/README.md new file mode 100644 index 0000000000..7735faeb67 --- /dev/null +++ b/spring-cloud-modules/spring-cloud-netflix-sidecar/README.md @@ -0,0 +1,3 @@ + +### Relevant Articles: +- [Introduction to Spring Cloud Sidecar](https://www.baeldung.com/spring-cloud-sidecar-intro) diff --git a/spring-cloud/spring-cloud-netflix-sidecar/echo-demo/pom.xml b/spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/pom.xml similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/echo-demo/pom.xml rename to spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/pom.xml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/main/java/com/baeldung/cloud/echo/EchoApplication.java b/spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/main/java/com/baeldung/cloud/echo/EchoApplication.java similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/main/java/com/baeldung/cloud/echo/EchoApplication.java rename to spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/main/java/com/baeldung/cloud/echo/EchoApplication.java diff --git a/spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/main/resources/application.yml b/spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/main/resources/application.yml similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/main/resources/application.yml rename to spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/main/resources/application.yml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/test/java/com/baeldung/cloud/echo/SpringContextTest.java b/spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/test/java/com/baeldung/cloud/echo/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/echo-demo/src/test/java/com/baeldung/cloud/echo/SpringContextTest.java rename to spring-cloud-modules/spring-cloud-netflix-sidecar/echo-demo/src/test/java/com/baeldung/cloud/echo/SpringContextTest.java diff --git a/spring-cloud/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-modules/spring-cloud-netflix-sidecar/pom.xml similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/pom.xml rename to spring-cloud-modules/spring-cloud-netflix-sidecar/pom.xml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/nodejs/hello.js b/spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/nodejs/hello.js similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/nodejs/hello.js rename to spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/nodejs/hello.js diff --git a/spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/pom.xml b/spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/pom.xml similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/pom.xml rename to spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/pom.xml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/main/java/com/baeldung/cloud/sidecar/SidecarApplication.java b/spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/main/java/com/baeldung/cloud/sidecar/SidecarApplication.java similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/main/java/com/baeldung/cloud/sidecar/SidecarApplication.java rename to spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/main/java/com/baeldung/cloud/sidecar/SidecarApplication.java diff --git a/spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/main/resources/application.yml b/spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/main/resources/application.yml similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/main/resources/application.yml rename to spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/main/resources/application.yml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/test/java/com/baeldung/cloud/sidecar/SpringContextTest.java b/spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/test/java/com/baeldung/cloud/sidecar/SpringContextTest.java similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/sidecar-demo/src/test/java/com/baeldung/cloud/sidecar/SpringContextTest.java rename to spring-cloud-modules/spring-cloud-netflix-sidecar/sidecar-demo/src/test/java/com/baeldung/cloud/sidecar/SpringContextTest.java diff --git a/spring-cloud-modules/spring-cloud-openfeign/README.md b/spring-cloud-modules/spring-cloud-openfeign/README.md index c1bd5ad43e..a369da96da 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/README.md +++ b/spring-cloud-modules/spring-cloud-openfeign/README.md @@ -6,3 +6,4 @@ - [Feign Logging Configuration](https://www.baeldung.com/java-feign-logging) - [Provide an OAuth2 Token to a Feign Client](https://www.baeldung.com/spring-cloud-feign-oauth-token) - [Retrieve Original Message From Feign ErrorDecoder](https://www.baeldung.com/feign-retrieve-original-message) +- [RequestLine with Feign Client](https://www.baeldung.com/feign-requestline) diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/EmployeeClient.java b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/EmployeeClient.java similarity index 100% rename from spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/EmployeeClient.java rename to spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/EmployeeClient.java diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/controller/EmployeeController.java b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/controller/EmployeeController.java similarity index 100% rename from spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/controller/EmployeeController.java rename to spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/controller/EmployeeController.java diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/model/Employee.java b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/model/Employee.java similarity index 100% rename from spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/model/Employee.java rename to spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/model/Employee.java diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/Employee.java b/spring-cloud-modules/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/Employee.java similarity index 100% rename from spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/Employee.java rename to spring-cloud-modules/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/Employee.java diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/EmployeeKey.java b/spring-cloud-modules/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/EmployeeKey.java similarity index 100% rename from spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/EmployeeKey.java rename to spring-cloud-modules/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/EmployeeKey.java diff --git a/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java b/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java new file mode 100644 index 0000000000..99b79d88ea --- /dev/null +++ b/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java @@ -0,0 +1,37 @@ +package com.baeldung.reactive.security; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +import java.security.Principal; + +@RestController +public class GreetController { + + private GreetService greetService; + + public GreetController(GreetService greetService) { + this.greetService = greetService; + } + + @GetMapping("/") + public Mono greet(Mono principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Hello, %s", name)); + } + + @GetMapping("/admin") + public Mono greetAdmin(Mono principal) { + return principal + .map(Principal::getName) + .map(name -> String.format("Admin access: %s", name)); + } + + @GetMapping("/greetService") + public Mono greetService() { + return greetService.greet(); + } + +} diff --git a/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingService.java b/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetService.java similarity index 91% rename from spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingService.java rename to spring-reactive/src/main/java/com/baeldung/reactive/security/GreetService.java index b512f12bae..93df64bced 100644 --- a/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingService.java +++ b/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetService.java @@ -5,7 +5,7 @@ import org.springframework.stereotype.Service; import reactor.core.publisher.Mono; @Service -public class GreetingService { +public class GreetService { @PreAuthorize("hasRole('ADMIN')") public Mono greet() { diff --git a/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingController.java b/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingController.java deleted file mode 100644 index 10d6cf4df7..0000000000 --- a/spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.reactive.security; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Mono; - -import java.security.Principal; - -@RestController -public class GreetingController { - - private final GreetingService greetingService; - - public GreetingController(GreetingService greetingService) { - this.greetingService = greetingService; - } - - @GetMapping("/") - public Mono greet(Mono principal) { - return principal - .map(Principal::getName) - .map(name -> String.format("Hello, %s", name)); - } - - @GetMapping("/admin") - public Mono greetAdmin(Mono principal) { - return principal - .map(Principal::getName) - .map(name -> String.format("Admin access: %s", name)); - } - - @GetMapping("/greetingService") - public Mono greetingService() { - return greetingService.greet(); - } - -} diff --git a/spring-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java b/spring-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java index 67e54ad26a..bb2f2d50e1 100644 --- a/spring-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java +++ b/spring-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java @@ -16,37 +16,40 @@ import org.springframework.security.web.server.SecurityWebFilterChain; public class SecurityConfig { @Bean - public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { + public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) { return http.authorizeExchange() - .pathMatchers("/admin").hasAuthority("ROLE_ADMIN") - .anyExchange().authenticated() - .and() - .formLogin() - .and() - .csrf().disable() - .build(); + .pathMatchers("/admin") + .hasAuthority("ROLE_ADMIN") + .anyExchange() + .authenticated() + .and() + .formLogin() + .and() + .csrf() + .disable() + .build(); } @Bean public MapReactiveUserDetailsService userDetailsService() { UserDetails user = User - .withUsername("user") - .password(passwordEncoder().encode("password")) - .roles("USER") - .build(); + .withUsername("user") + .password(passwordEncoder().encode("password")) + .roles("USER") + .build(); UserDetails admin = User - .withUsername("admin") - .password(passwordEncoder().encode("password")) - .roles("ADMIN") - .build(); + .withUsername("admin") + .password(passwordEncoder().encode("password")) + .roles("ADMIN") + .build(); return new MapReactiveUserDetailsService(user, admin); } - + @Bean public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); + return new BCryptPasswordEncoder(); } } diff --git a/spring-reactive/src/main/java/com/baeldung/reactive/webflux/functional/EmployeeFunctionalConfig.java b/spring-reactive/src/main/java/com/baeldung/reactive/webflux/functional/EmployeeFunctionalConfig.java index 8b5c7233d6..e6f8ba35c2 100644 --- a/spring-reactive/src/main/java/com/baeldung/reactive/webflux/functional/EmployeeFunctionalConfig.java +++ b/spring-reactive/src/main/java/com/baeldung/reactive/webflux/functional/EmployeeFunctionalConfig.java @@ -25,49 +25,39 @@ public class EmployeeFunctionalConfig { @Bean RouterFunction getAllEmployeesRoute() { - return route(GET("/employees"), - req -> ok().body( - employeeRepository().findAllEmployees(), Employee.class)); + return route(GET("/employees"), req -> ok().body(employeeRepository().findAllEmployees(), Employee.class)); } @Bean RouterFunction getEmployeeByIdRoute() { - return route(GET("/employees/{id}"), - req -> ok().body( - employeeRepository().findEmployeeById(req.pathVariable("id")), Employee.class)); + return route(GET("/employees/{id}"), req -> ok().body(employeeRepository().findEmployeeById(req.pathVariable("id")), Employee.class)); } @Bean RouterFunction updateEmployeeRoute() { - return route(POST("/employees/update"), - req -> req.body(toMono(Employee.class)) + return route(POST("/employees/update"), req -> req.body(toMono(Employee.class)) .doOnNext(employeeRepository()::updateEmployee) .then(ok().build())); } @Bean RouterFunction composedRoutes() { - return - route(GET("/employees"), - req -> ok().body( - employeeRepository().findAllEmployees(), Employee.class)) + return route(GET("/employees"), req -> ok().body(employeeRepository().findAllEmployees(), Employee.class)) - .and(route(GET("/employees/{id}"), - req -> ok().body( - employeeRepository().findEmployeeById(req.pathVariable("id")), Employee.class))) + .and(route(GET("/employees/{id}"), req -> ok().body(employeeRepository().findEmployeeById(req.pathVariable("id")), Employee.class))) - .and(route(POST("/employees/update"), - req -> req.body(toMono(Employee.class)) + .and(route(POST("/employees/update"), req -> req.body(toMono(Employee.class)) .doOnNext(employeeRepository()::updateEmployee) .then(ok().build()))); } @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { - http - .csrf().disable() - .authorizeExchange() - .anyExchange().permitAll(); + http.csrf() + .disable() + .authorizeExchange() + .anyExchange() + .permitAll(); return http.build(); } -} +} \ No newline at end of file diff --git a/spring-reactive/src/test/java/com/baeldung/reactive/security/SecurityIntegrationTest.java b/spring-reactive/src/test/java/com/baeldung/reactive/security/SecurityIntegrationTest.java index 0ef828df5a..06644fbf77 100644 --- a/spring-reactive/src/test/java/com/baeldung/reactive/security/SecurityIntegrationTest.java +++ b/spring-reactive/src/test/java/com/baeldung/reactive/security/SecurityIntegrationTest.java @@ -15,32 +15,23 @@ import org.springframework.test.web.reactive.server.WebTestClient; public class SecurityIntegrationTest { @Autowired - private ApplicationContext context; + ApplicationContext context; - private WebTestClient webTestClient; + private WebTestClient rest; @BeforeEach public void setup() { - webTestClient = WebTestClient.bindToApplicationContext(context) - .configureClient() - .build(); + this.rest = WebTestClient.bindToApplicationContext(this.context).configureClient().build(); } @Test public void whenNoCredentials_thenRedirectToLogin() { - webTestClient.get() - .uri("/") - .exchange() - .expectStatus().is3xxRedirection(); + this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection(); } @Test @WithMockUser public void whenHasCredentials_thenSeesGreeting() { - webTestClient.get() - .uri("/") - .exchange() - .expectStatus().isOk() - .expectBody(String.class).isEqualTo("Hello, user"); + this.rest.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class).isEqualTo("Hello, user"); } } diff --git a/spring-reactive/src/test/java/com/baeldung/reactive/webflux/functional/EmployeeSpringFunctionalIntegrationTest.java b/spring-reactive/src/test/java/com/baeldung/reactive/webflux/functional/EmployeeSpringFunctionalIntegrationTest.java index 198ec0d081..5a54820e23 100644 --- a/spring-reactive/src/test/java/com/baeldung/reactive/webflux/functional/EmployeeSpringFunctionalIntegrationTest.java +++ b/spring-reactive/src/test/java/com/baeldung/reactive/webflux/functional/EmployeeSpringFunctionalIntegrationTest.java @@ -31,55 +31,54 @@ public class EmployeeSpringFunctionalIntegrationTest { @Test public void givenEmployeeId_whenGetEmployeeById_thenCorrectEmployee() { - WebTestClient client = WebTestClient - .bindToRouterFunction(config.getEmployeeByIdRoute()) - .build(); + WebTestClient client = WebTestClient.bindToRouterFunction(config.getEmployeeByIdRoute()) + .build(); Employee employee = new Employee("1", "Employee 1"); given(employeeRepository.findEmployeeById("1")).willReturn(Mono.just(employee)); client.get() - .uri("/employees/1") - .exchange() - .expectStatus().isOk() - .expectBody(Employee.class).isEqualTo(employee); + .uri("/employees/1") + .exchange() + .expectStatus() + .isOk() + .expectBody(Employee.class) + .isEqualTo(employee); } @Test public void whenGetAllEmployees_thenCorrectEmployees() { - WebTestClient client = WebTestClient - .bindToRouterFunction(config.getAllEmployeesRoute()) - .build(); + WebTestClient client = WebTestClient.bindToRouterFunction(config.getAllEmployeesRoute()) + .build(); - List employees = Arrays.asList( - new Employee("1", "Employee 1"), - new Employee("2", "Employee 2") - ); + List employees = Arrays.asList(new Employee("1", "Employee 1"), new Employee("2", "Employee 2")); Flux employeeFlux = Flux.fromIterable(employees); given(employeeRepository.findAllEmployees()).willReturn(employeeFlux); client.get() - .uri("/employees") - .exchange() - .expectStatus().isOk() - .expectBodyList(Employee.class).isEqualTo(employees); + .uri("/employees") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Employee.class) + .isEqualTo(employees); } @Test public void whenUpdateEmployee_thenEmployeeUpdated() { - WebTestClient client = WebTestClient - .bindToRouterFunction(config.updateEmployeeRoute()) - .build(); + WebTestClient client = WebTestClient.bindToRouterFunction(config.updateEmployeeRoute()) + .build(); Employee employee = new Employee("1", "Employee 1 Updated"); client.post() - .uri("/employees/update") - .body(Mono.just(employee), Employee.class) - .exchange() - .expectStatus().isOk(); + .uri("/employees/update") + .body(Mono.just(employee), Employee.class) + .exchange() + .expectStatus() + .isOk(); verify(employeeRepository).updateEmployee(employee); } diff --git a/spring-web-modules/spring-mvc-basics-5/README.md b/spring-web-modules/spring-mvc-basics-5/README.md index 880db7aacd..dfd6522b0f 100644 --- a/spring-web-modules/spring-mvc-basics-5/README.md +++ b/spring-web-modules/spring-mvc-basics-5/README.md @@ -13,4 +13,5 @@ The "REST With Spring" Classes: https://bit.ly/restwithspring - [The HttpMediaTypeNotAcceptableException in Spring MVC](https://www.baeldung.com/spring-httpmediatypenotacceptable) - [Spring @RequestParam Annotation](https://www.baeldung.com/spring-request-param) - [Spring @RequestParam vs @PathVariable Annotations](https://www.baeldung.com/spring-requestparam-vs-pathvariable) +- [@RequestMapping Value in Properties File](https://www.baeldung.com/spring-requestmapping-properties-file) - More articles: [[<-- prev]](../spring-mvc-basics-4) diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/additionalanswers/BookServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/additionalanswers/BookServiceUnitTest.java index ee32bcf70c..b2a998b8b9 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/additionalanswers/BookServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/additionalanswers/BookServiceUnitTest.java @@ -1,5 +1,15 @@ package com.baeldung.mockito.additionalanswers; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.AdditionalAnswers.answer; +import static org.mockito.AdditionalAnswers.answerVoid; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.AdditionalAnswers; @@ -7,8 +17,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; @RunWith(MockitoJUnitRunner.class) public class BookServiceUnitTest { @@ -65,4 +73,32 @@ public class BookServiceUnitTest { assertEquals(bookOnIndex, book2); } + + @Test + public void givenMockedMethod_whenMethodInvoked_thenReturnBook() { + Long id = 1L; + when(bookRepository.getByBookId(anyLong())).thenAnswer(answer(BookServiceUnitTest::buildBook)); + + assertNotNull(bookService.getByBookId(id)); + assertEquals("The Stranger", bookService.getByBookId(id).getTitle()); + } + + @Test + public void givenMockedMethod_whenMethodInvoked_thenReturnVoid() { + Long id = 2L; + when(bookRepository.getByBookId(anyLong())).thenAnswer(answerVoid(BookServiceUnitTest::printBookId)); + + bookService.getByBookId(id); + + verify(bookRepository, times(1)).getByBookId(id); + } + + private static Book buildBook(Long bookId) { + return new Book(bookId, "The Stranger", "Albert Camus", 456); + } + + private static void printBookId(Long bookId) { + System.out.println(bookId); + } + }