From 0cd4aeca9f268a93bd5f0995648026b4b9ae64b2 Mon Sep 17 00:00:00 2001 From: Christian Jaimes Date: Sun, 22 May 2022 07:47:15 -0400 Subject: [PATCH 01/40] restart policies configuration for Docker Compose --- ...cker-compose-restart-policy-swarm-mode.yml | 37 +++++++++++++++++++ .../docker-compose-restart-policy.yml | 27 ++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml create mode 100644 spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml new file mode 100644 index 0000000000..7aca9f6bb4 --- /dev/null +++ b/spring-cloud/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 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml new file mode 100644 index 0000000000..82dc9aed91 --- /dev/null +++ b/spring-cloud/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 \ No newline at end of file From 4d3faee33abd03fffff4080dc7c216d23e430bb5 Mon Sep 17 00:00:00 2001 From: Christian Jaimes Date: Sun, 22 May 2022 07:54:05 -0400 Subject: [PATCH 02/40] added new line eof --- .../docker-compose-restart-policy-swarm-mode.yml | 2 +- .../spring-cloud-docker/docker-compose-restart-policy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml index 7aca9f6bb4..ddc1e4001a 100644 --- a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml +++ b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml @@ -34,4 +34,4 @@ services: window: 60s networks: spring-cloud-network: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml index 82dc9aed91..e305b00dc4 100644 --- a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml +++ b/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml @@ -24,4 +24,4 @@ services: restart: on-failure networks: spring-cloud-network: - driver: bridge \ No newline at end of file + driver: bridge From 68aebad05e26ec72733b254e951529c19cb88264 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:12:57 +0530 Subject: [PATCH 03/40] JAVA-12098: Moved core-groovy inside core-groovy-modules --- .../core-groovy}/.gitignore | 0 .../core-groovy}/README.md | 0 .../core-groovy}/build.gradle | 0 .../core-groovy}/pom.xml | 2 +- .../groovy/com/baeldung/closures/Closures.groovy | 0 .../groovy/com/baeldung/closures/Employee.groovy | 0 .../main/groovy/com/baeldung/file/ReadFile.groovy | 0 .../src/main/groovy/com/baeldung/io/Task.groovy | 0 .../main/groovy/com/baeldung/json/Account.groovy | 0 .../main/groovy/com/baeldung/json/JsonParser.groovy | 0 .../main/groovy/com/baeldung/scopes/Scopes.groovy | 0 .../groovy/com/baeldung/scopes/ScopesFail.groovy | 0 .../com/baeldung/scopes/ScopesFailNoPrint.groovy | 0 .../groovy/com/baeldung/strings/Concatenate.groovy | 0 .../groovy/com/baeldung/traits/AnimalTrait.groovy | 0 .../src/main/groovy/com/baeldung/traits/Car.groovy | 0 .../src/main/groovy/com/baeldung/traits/Dog.groovy | 0 .../main/groovy/com/baeldung/traits/Employee.groovy | 0 .../main/groovy/com/baeldung/traits/Human.groovy | 0 .../groovy/com/baeldung/traits/SpeakingTrait.groovy | 0 .../groovy/com/baeldung/traits/UserTrait.groovy | 0 .../groovy/com/baeldung/traits/VehicleTrait.groovy | 0 .../groovy/com/baeldung/traits/WalkingTrait.groovy | 0 .../groovy/com/baeldung/traits/WheelTrait.groovy | 0 .../src/main/resources/binaryExample.jpg | Bin .../core-groovy}/src/main/resources/fileContent.txt | 0 .../core-groovy}/src/main/resources/ioData.txt | Bin .../core-groovy}/src/main/resources/ioInput.txt | 0 .../core-groovy}/src/main/resources/ioOutput.txt | 0 .../core-groovy}/src/main/resources/logback.xml | 0 .../core-groovy}/src/main/resources/sample.png | Bin .../src/main/resources/utf8Content.html | 0 .../com/baeldung/closures/ClosuresUnitTest.groovy | 0 .../test/groovy/com/baeldung/date/DateTest.groovy | 0 .../com/baeldung/file/ReadFileUnitTest.groovy | 0 .../groovy/com/baeldung/groovy/sql/SqlTest.groovy | 0 .../com/baeldung/io/DataAndObjectsUnitTest.groovy | 0 .../com/baeldung/io/ReadExampleUnitTest.groovy | 0 .../com/baeldung/io/TraverseFileTreeUnitTest.groovy | 0 .../com/baeldung/io/WriteExampleUnitTest.groovy | 0 .../groovy/com/baeldung/json/JsonParserTest.groovy | 0 .../com/baeldung/strings/ConcatenateTest.groovy | 0 .../com/baeldung/strings/StringMatchingSpec.groovy | 0 .../baeldung/stringtoint/ConvertStringToInt.groovy | 0 .../baeldung/stringtypes/CharacterInGroovy.groovy | 0 .../baeldung/stringtypes/DollarSlashyString.groovy | 0 .../baeldung/stringtypes/DoubleQuotedString.groovy | 0 .../baeldung/stringtypes/SingleQuotedString.groovy | 0 .../com/baeldung/stringtypes/SlashyString.groovy | 0 .../groovy/com/baeldung/stringtypes/Strings.groovy | 0 .../stringtypes/TripleDoubleQuotedString.groovy | 0 .../stringtypes/TripleSingleQuotedString.groovy | 0 .../com/baeldung/traits/TraitsUnitTest.groovy | 0 53 files changed, 1 insertion(+), 1 deletion(-) rename {core-groovy => core-groovy-modules/core-groovy}/.gitignore (100%) rename {core-groovy => core-groovy-modules/core-groovy}/README.md (100%) rename {core-groovy => core-groovy-modules/core-groovy}/build.gradle (100%) rename {core-groovy => core-groovy-modules/core-groovy}/pom.xml (98%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/closures/Closures.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/closures/Employee.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/file/ReadFile.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/io/Task.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/json/Account.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/json/JsonParser.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/scopes/Scopes.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/scopes/ScopesFail.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/scopes/ScopesFailNoPrint.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/strings/Concatenate.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/AnimalTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/Car.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/Dog.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/Employee.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/Human.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/SpeakingTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/UserTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/VehicleTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/WalkingTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/groovy/com/baeldung/traits/WheelTrait.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/binaryExample.jpg (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/fileContent.txt (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/ioData.txt (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/ioInput.txt (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/ioOutput.txt (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/logback.xml (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/sample.png (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/main/resources/utf8Content.html (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/closures/ClosuresUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/date/DateTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/file/ReadFileUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/groovy/sql/SqlTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/io/DataAndObjectsUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/io/ReadExampleUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/io/TraverseFileTreeUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/io/WriteExampleUnitTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/json/JsonParserTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/strings/ConcatenateTest.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtoint/ConvertStringToInt.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/CharacterInGroovy.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/DollarSlashyString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/DoubleQuotedString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/SingleQuotedString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/SlashyString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/Strings.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/TripleDoubleQuotedString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/stringtypes/TripleSingleQuotedString.groovy (100%) rename {core-groovy => core-groovy-modules/core-groovy}/src/test/groovy/com/baeldung/traits/TraitsUnitTest.groovy (100%) 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 From d2f3c0bccb9bb1343b08d4c49e61fc35af068b4b Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:13:35 +0530 Subject: [PATCH 04/40] JAVA-12098: Moved core-groovy-2 inside core-groovy-modules --- {core-groovy-2 => core-groovy-modules/core-groovy-2}/README.md | 0 .../core-groovy-2}/gmavenplus-pom.xml | 2 +- {core-groovy-2 => core-groovy-modules/core-groovy-2}/pom.xml | 2 +- .../core-groovy-2}/src/main/groovy/com/baeldung/CalcMath.groovy | 0 .../src/main/groovy/com/baeldung/CalcScript.groovy | 0 .../main/groovy/com/baeldung/category/BaeldungCategory.groovy | 0 .../src/main/groovy/com/baeldung/category/NumberCategory.groovy | 0 .../src/main/groovy/com/baeldung/concatenate/Wonder.groovy | 0 .../main/groovy/com/baeldung/determinedatatype/Person.groovy | 0 .../main/groovy/com/baeldung/metaprogramming/Employee.groovy | 0 .../baeldung/metaprogramming/extension/BasicExtensions.groovy | 0 .../metaprogramming/extension/StaticEmployeeExtension.groovy | 0 .../src/main/java/com/baeldung/MyJointCompilationApp.java | 0 .../services/org.codehaus.groovy.runtime.ExtensionModule | 0 .../core-groovy-2}/src/main/resources/articleEmail.template | 0 .../core-groovy-2}/src/main/resources/email.template | 0 .../test/groovy/com/baeldung/category/CategoryUnitTest.groovy | 0 .../test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy | 0 .../groovy/com/baeldung/determinedatatype/PersonTest.groovy | 0 .../com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy | 0 .../test/groovy/com/baeldung/strings/StringMatchingSpec.groovy | 0 .../com/baeldung/templateengine/TemplateEnginesUnitTest.groovy | 0 .../groovy/com/baeldung/webservice/WebserviceUnitTest.groovy | 0 .../test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy | 0 .../src/test/resources/com/baeldung/xml/articles.xml | 0 .../resources/com/baeldung/xml/articles_short_formatted.xml | 0 29 files changed, 2 insertions(+), 2 deletions(-) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/README.md (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/gmavenplus-pom.xml (99%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/pom.xml (99%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/CalcMath.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/CalcScript.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/category/BaeldungCategory.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/category/NumberCategory.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/concatenate/Wonder.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/determinedatatype/Person.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/metaprogramming/Employee.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/groovy/com/baeldung/metaprogramming/extension/StaticEmployeeExtension.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/java/com/baeldung/MyJointCompilationApp.java (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/resources/articleEmail.template (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/main/resources/email.template (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/category/CategoryUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/concatenate/WonderUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/defkeyword/DefUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/determinedatatype/PersonTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/strings/StringMatchingSpec.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/templateengine/TemplateEnginesUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/webservice/WebserviceUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/xml/MarkupBuilderUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/xml/XmlParserUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/groovy/com/baeldung/xml/XmlSlurperUnitTest.groovy (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/resources/com/baeldung/xml/articles.xml (100%) rename {core-groovy-2 => core-groovy-modules/core-groovy-2}/src/test/resources/com/baeldung/xml/articles_short_formatted.xml (100%) 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 From 7386b5a9fd145dd0a9b076687fe9feafd94d1afb Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:14:03 +0530 Subject: [PATCH 05/40] JAVA-12098: Moved core-groovy-collections inside core-groovy-modules --- .../core-groovy-collections}/README.md | 0 .../core-groovy-collections}/pom.xml | 2 +- .../src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/find/Person.groovy | 0 .../src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy | 0 .../groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/lists/ListUnitTest.groovy | 0 .../src/test/groovy/com/baeldung/maps/MapTest.groovy | 0 9 files changed, 1 insertion(+), 1 deletion(-) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/README.md (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/pom.xml (98%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/find/ListFindUnitTest.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/find/MapFindUnitTest.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/find/Person.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/find/SetFindUnitTest.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/iteratemap/IterateMapUnitTest.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/lists/ListUnitTest.groovy (100%) rename {core-groovy-collections => core-groovy-modules/core-groovy-collections}/src/test/groovy/com/baeldung/maps/MapTest.groovy (100%) 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 From 2ae576475a782bd6619979f9b7af9505a3305e5a Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:14:49 +0530 Subject: [PATCH 06/40] JAVA-12098: Moved core-groovy-strings inside core-groovy-modules --- .../core-groovy-strings}/README.md | 0 .../core-groovy-strings}/pom.xml | 2 +- .../groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {core-groovy-strings => core-groovy-modules/core-groovy-strings}/README.md (100%) rename {core-groovy-strings => core-groovy-modules/core-groovy-strings}/pom.xml (98%) rename {core-groovy-strings => core-groovy-modules/core-groovy-strings}/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy (100%) 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 From 2c6f7ab78905ccb347c51ffd968be18341f9a814 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:15:15 +0530 Subject: [PATCH 07/40] JAVA-12098: new module core-groovy-modules --- core-groovy-modules/pom.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core-groovy-modules/pom.xml 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 + + + + + From 9195a2b341f86546e8f5dc50fffde16eada28ac6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 May 2022 20:15:55 +0530 Subject: [PATCH 08/40] JAVA-12098: updated main pom --- pom.xml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 5919a930f0..ba346f4af0 100644 --- a/pom.xml +++ b/pom.xml @@ -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 @@ -833,11 +830,8 @@ cloud-foundry-uaa code-generation - core-groovy - core-groovy-2 - core-groovy-collections - core-groovy-strings - + core-groovy-modules + core-java-modules couchbase From 8a7e4b9ef4ad21ea180b5aeda178550c76303f1b Mon Sep 17 00:00:00 2001 From: Haroon Khan Date: Sat, 28 May 2022 14:48:24 +0100 Subject: [PATCH 09/40] Revert "[JAVA-8154] Code clean up for reactive security" --- .../reactive/security/GreetController.java | 37 ++++++++++++++++++ ...GreetingService.java => GreetService.java} | 2 +- .../reactive/security/GreetingController.java | 37 ------------------ .../reactive/security/SecurityConfig.java | 39 ++++++++++--------- .../security/SecurityIntegrationTest.java | 19 +++------ 5 files changed, 64 insertions(+), 70 deletions(-) create mode 100644 spring-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java rename spring-reactive/src/main/java/com/baeldung/reactive/security/{GreetingService.java => GreetService.java} (91%) delete mode 100644 spring-reactive/src/main/java/com/baeldung/reactive/security/GreetingController.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/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"); } } From fb5dfc72cd750a05fb70724ff8c6f6728dfa2948 Mon Sep 17 00:00:00 2001 From: uzma khan Date: Tue, 24 May 2022 16:56:49 +0100 Subject: [PATCH 10/40] [BAEL-5556] Add code for sorting article --- .../core-java-collections-list-4/pom.xml | 14 +- .../alphabetical/SortingListUnitTest.java | 186 ++++++++++++++++++ 2 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/sorting/alphabetical/SortingListUnitTest.java 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/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); + } +} From b14e8332f821e64121e17904b0c7706f0c37ce92 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 30 May 2022 18:21:38 +0530 Subject: [PATCH 11/40] JAVA-8149: Update Introduction to the Functional Web Framework in Spring 5 --- .../functional/EmployeeFunctionalConfig.java | 34 +++++-------- ...ployeeSpringFunctionalIntegrationTest.java | 49 +++++++++---------- 2 files changed, 36 insertions(+), 47 deletions(-) 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/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); } From 0a590c2d8691a78d8fb0cd56d34d6b5bd91b6142 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Mon, 30 May 2022 21:50:51 +0530 Subject: [PATCH 12/40] JAVA-12385 GitHub Issue: Test Failure in CircularBuffer/RingBuffer --- .../baeldung/circularbuffer/ProducerConsumerLiveTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 { From 1f632eda4ddc8f564959dc1818c553a4ac775916 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 30 May 2022 23:47:08 +0530 Subject: [PATCH 13/40] JAVA-12419 Renamed apache-cxf to apache-cxf-modules --- {apache-cxf => apache-cxf-modules}/README.md | 0 {apache-cxf => apache-cxf-modules}/cxf-aegis/README.md | 0 {apache-cxf => apache-cxf-modules}/cxf-aegis/pom.xml | 2 +- .../src/main/java/com/baeldung/cxf/aegis/Course.java | 0 .../src/main/java/com/baeldung/cxf/aegis/CourseRepo.java | 0 .../main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java | 0 .../main/resources/com/baeldung/cxf/aegis/Course.aegis.xml | 0 .../resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml | 0 .../cxf-aegis/src/main/resources/logback.xml | 0 .../com/baeldung/cxf/aegis/BaeldungIntegrationTest.java | 0 .../cxf-introduction/README.md | 0 {apache-cxf => apache-cxf-modules}/cxf-introduction/pom.xml | 2 +- .../main/java/com/baeldung/cxf/introduction/Baeldung.java | 0 .../java/com/baeldung/cxf/introduction/BaeldungImpl.java | 0 .../src/main/java/com/baeldung/cxf/introduction/Server.java | 0 .../main/java/com/baeldung/cxf/introduction/Student.java | 0 .../java/com/baeldung/cxf/introduction/StudentAdapter.java | 0 .../java/com/baeldung/cxf/introduction/StudentImpl.java | 0 .../main/java/com/baeldung/cxf/introduction/StudentMap.java | 0 .../com/baeldung/cxf/introduction/StudentMapAdapter.java | 0 .../cxf-introduction/src/main/resources/logback.xml | 0 .../java/com/baeldung/cxf/introduction/StudentLiveTest.java | 0 .../cxf-jaxrs-implementation/README.md | 0 .../cxf-jaxrs-implementation/pom.xml | 2 +- .../java/com/baeldung/cxf/jaxrs/implementation/Course.java | 0 .../baeldung/cxf/jaxrs/implementation/CourseRepository.java | 0 .../baeldung/cxf/jaxrs/implementation/RestfulServer.java | 0 .../java/com/baeldung/cxf/jaxrs/implementation/Student.java | 0 .../src/main/resources/changed_course.xml | 0 .../src/main/resources/conflict_student.xml | 0 .../src/main/resources/created_student.xml | 0 .../cxf-jaxrs-implementation/src/main/resources/logback.xml | 0 .../src/main/resources/non_existent_course.xml | 0 .../src/main/resources/unchanged_course.xml | 0 .../baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java | 0 {apache-cxf => apache-cxf-modules}/cxf-spring/.gitignore | 0 {apache-cxf => apache-cxf-modules}/cxf-spring/README.md | 0 {apache-cxf => apache-cxf-modules}/cxf-spring/pom.xml | 2 +- .../main/java/com/baeldung/cxf/spring/AppInitializer.java | 0 .../src/main/java/com/baeldung/cxf/spring/Baeldung.java | 0 .../src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java | 0 .../java/com/baeldung/cxf/spring/ClientConfiguration.java | 0 .../java/com/baeldung/cxf/spring/ServiceConfiguration.java | 0 .../src/main/java/com/baeldung/cxf/spring/Student.java | 0 .../cxf-spring/src/main/resources/logback.xml | 0 .../test/java/com/baeldung/cxf/spring/StudentLiveTest.java | 0 {apache-cxf => apache-cxf-modules}/pom.xml | 2 +- {apache-cxf => apache-cxf-modules}/sse-jaxrs/README.md | 0 {apache-cxf => apache-cxf-modules}/sse-jaxrs/pom.xml | 2 +- .../sse-jaxrs/sse-jaxrs-client/pom.xml | 0 .../java/com/baeldung/sse/jaxrs/client/SseClientApp.java | 0 .../baeldung/sse/jaxrs/client/SseClientBroadcastApp.java | 0 .../sse-jaxrs-client/src/main/resources/logback.xml | 0 .../sse-jaxrs/sse-jaxrs-server/pom.xml | 0 .../src/main/java/com/baeldung/sse/jaxrs/AppConfig.java | 0 .../src/main/java/com/baeldung/sse/jaxrs/SseResource.java | 0 .../src/main/java/com/baeldung/sse/jaxrs/Stock.java | 0 .../src/main/java/com/baeldung/sse/jaxrs/StockService.java | 0 .../sse-jaxrs-server/src/main/liberty/config/server.xml | 0 .../sse-jaxrs-server/src/main/resources/META-INF/beans.xml | 0 .../sse-jaxrs-server/src/main/resources/logback.xml | 0 .../sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml | 0 .../sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html | 0 .../sse-jaxrs-server/src/main/webapp/sse-broadcast.html | 0 .../sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html | 0 pom.xml | 6 +++--- 66 files changed, 9 insertions(+), 9 deletions(-) rename {apache-cxf => apache-cxf-modules}/README.md (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/README.md (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/pom.xml (93%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/Course.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepo.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/java/com/baeldung/cxf/aegis/CourseRepoImpl.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/Course.aegis.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/resources/com/baeldung/cxf/aegis/CourseRepo.aegis.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungIntegrationTest.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/README.md (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/pom.xml (96%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Baeldung.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/BaeldungImpl.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Server.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/Student.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentAdapter.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentImpl.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMap.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/java/com/baeldung/cxf/introduction/StudentMapAdapter.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/README.md (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/pom.xml (97%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Course.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Student.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/changed_course.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/conflict_student.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/created_student.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/non_existent_course.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/main/resources/unchanged_course.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/.gitignore (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/README.md (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/pom.xml (98%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/AppInitializer.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/ClientConfiguration.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/ServiceConfiguration.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentLiveTest.java (100%) rename {apache-cxf => apache-cxf-modules}/pom.xml (96%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/README.md (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/pom.xml (92%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-client/pom.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/pom.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html (100%) rename {apache-cxf => apache-cxf-modules}/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html (100%) 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/pom.xml b/pom.xml index e9942d77e8..1c267a49d8 100644 --- a/pom.xml +++ b/pom.xml @@ -337,7 +337,7 @@ annotations antlr - apache-cxf + apache-cxf-modules apache-kafka apache-libraries apache-olingo @@ -795,11 +795,11 @@ akka-http akka-streams - algorithms-modules + algorithms-modules annotations antlr - apache-cxf + apache-cxf-modules apache-kafka apache-libraries apache-olingo From aef4affc28b0f2949c841fe04dba79bddf31c6a5 Mon Sep 17 00:00:00 2001 From: Muhammad Abdullah Azam Khan Date: Wed, 1 Jun 2022 01:35:54 +0400 Subject: [PATCH 14/40] Expose GraphQL field with different name (#12289) --- spring-boot-modules/spring-boot-libraries/README.md | 1 + .../src/main/java/com/baeldung/graphql/PostResolver.java | 5 +++++ .../src/main/resources/graphql/post.graphqls | 1 + 3 files changed, 7 insertions(+) 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 { From fcdf53f3e459d7301105c7da2634426efbf99d93 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Wed, 1 Jun 2022 05:58:26 +0200 Subject: [PATCH 15/40] BAEL-5623 reverse list article (#12253) * reverse list article * fix the package --- .../list/reverse/ReverseArrayList.java | 23 ++++++++++ .../reverse/ReverseArrayListUnitTest.java | 46 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 core-java-modules/core-java-collections-list-4/src/main/java/com/baeldung/list/reverse/ReverseArrayList.java create mode 100644 core-java-modules/core-java-collections-list-4/src/test/java/com/baeldung/list/reverse/ReverseArrayListUnitTest.java 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 From 9fdde5c323c0f39052f959042a37ea448ac65759 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 1 Jun 2022 16:19:28 +0300 Subject: [PATCH 16/40] various fixes --- .../java/com/baeldung/lock/FileLocks.java | 4 +-- .../com/baeldung/keystore/JavaKeyStore.java | 9 ++++-- .../CharacterEncodingExamplesUnitTest.java | 3 +- .../IllegalCharacterUnitTest.java | 3 +- .../PropertyResourceUnitTest.java | 30 +++++++++++++++---- 5 files changed, 36 insertions(+), 13 deletions(-) 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); } } From ddf898fe0b64de04c088a2eb1d8d1118b6894b5e Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Wed, 1 Jun 2022 21:05:22 +0530 Subject: [PATCH 17/40] JAVA-12383 GitHub Issue: Incorrect results in Kadane Algorithm for Maximal Subarray --- .../algorithms/maximumsubarray/KadaneAlgorithm.java | 2 +- .../maximumsubarray/KadaneAlgorithmUnitTest.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 From de14b695a1b1171544dcffc36c43985862c492b2 Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 07:47:47 +0500 Subject: [PATCH 18/40] Created/Updated README.md added link back to the article: https://www.baeldung.com/feign-requestline --- spring-cloud/spring-cloud-openfeign/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-cloud/spring-cloud-openfeign/README.md diff --git a/spring-cloud/spring-cloud-openfeign/README.md b/spring-cloud/spring-cloud-openfeign/README.md new file mode 100644 index 0000000000..3aa8c20b24 --- /dev/null +++ b/spring-cloud/spring-cloud-openfeign/README.md @@ -0,0 +1,3 @@ + +### Relevant Articles: +- [RequestLine with Feign Client](https://www.baeldung.com/feign-requestline) From e667175a505458d0ebdad2d2d9e36e13acba867e Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 07:54:58 +0500 Subject: [PATCH 19/40] Updated README.md added link back to the article: https://www.baeldung.com/java-httpclient-timeout --- core-java-modules/core-java-networking-3/README.md | 1 + 1 file changed, 1 insertion(+) 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) From 79cab1d10b75c49abf246f9f271da2f251b7ecce Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:04:39 +0500 Subject: [PATCH 20/40] Updated README.md added link back to the article: https://www.baeldung.com/java-feign-request-headers --- feign/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From f7ebe34de0d78b6119932ad7a7d2880ee3420f7a Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:13:03 +0500 Subject: [PATCH 21/40] Created/Updated README.md added link back to the article: https://www.baeldung.com/java-play-sound --- javax-sound/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 javax-sound/README.md 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) From 2b5ce458b1d90a5b799f10b3c777c4959db3dd9a Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:15:18 +0500 Subject: [PATCH 22/40] Updated README.md added link back to the article: https://www.baeldung.com/spring-webserviceservertest --- spring-boot-modules/spring-boot-testing-2/README.md | 1 + 1 file changed, 1 insertion(+) 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) From 028bfb344518c08a75d1fcb610d1a4c5a08eb67a Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 08:22:40 +0500 Subject: [PATCH 23/40] Created/Updated README.md added link back to the article: https://www.baeldung.com/spring-cloud-sidecar-intro --- spring-cloud/spring-cloud-netflix-sidecar/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-cloud/spring-cloud-netflix-sidecar/README.md diff --git a/spring-cloud/spring-cloud-netflix-sidecar/README.md b/spring-cloud/spring-cloud-netflix-sidecar/README.md new file mode 100644 index 0000000000..7735faeb67 --- /dev/null +++ b/spring-cloud/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) From a8f1e1787d7fb71185155df6eeaff944032778f5 Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 11:18:09 +0500 Subject: [PATCH 24/40] Updated README.md added link back to the article: https://www.baeldung.com/spring-requestmapping-properties-file --- spring-web-modules/spring-mvc-basics-5/README.md | 1 + 1 file changed, 1 insertion(+) 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) From e06edd0e37c8b307c669b880668d027ea76ddcce Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 11:38:36 +0500 Subject: [PATCH 25/40] Updated README.md added link back to the article: https://www.baeldung.com/java-sort-list-by-date --- core-java-modules/core-java-collections-4/README.md | 1 + 1 file changed, 1 insertion(+) 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) From 2f82564ea3ba60ec745879bf4ac6fe726859980c Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Thu, 2 Jun 2022 12:07:25 +0500 Subject: [PATCH 26/40] Updated README.md added link back to the article: https://www.baeldung.com/java-reverse-arraylist --- core-java-modules/core-java-collections-list-4/README.md | 1 + 1 file changed, 1 insertion(+) 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..09b61fa9b2 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,5 @@ 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) - [[<-- Prev]](/core-java-modules/core-java-collections-list-3) From 23fab8f361766cd7770db767f214401196977351 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 2 Jun 2022 17:00:07 +0530 Subject: [PATCH 27/40] JAVA-12418 Moved pending files from spring-cloud to spring-cloud-modules (#12286) --- .../java/com/baeldung/cloud/openfeign/client/EmployeeClient.java | 0 .../baeldung/cloud/openfeign/controller/EmployeeController.java | 0 .../main/java/com/baeldung/cloud/openfeign/model/Employee.java | 0 .../src/main/java/com/baeldung/schema/Employee.java | 0 .../src/main/java/com/baeldung/schema/EmployeeKey.java | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {spring-cloud => spring-cloud-modules}/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/EmployeeClient.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/controller/EmployeeController.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/model/Employee.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/Employee.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-stream/spring-cloud-stream-kafka/src/main/java/com/baeldung/schema/EmployeeKey.java (100%) 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 From 82b0125fa411539bdb048f6cbd765e8f072abe22 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 2 Jun 2022 17:08:37 +0530 Subject: [PATCH 28/40] JAVA-12418 Moved pending files to spring-cloud-modules --- .../docker-compose-restart-policy-swarm-mode.yml | 0 .../docker-compose-restart-policy.yml | 0 .../spring-cloud-netflix-sidecar/README.md | 0 .../spring-cloud-netflix-sidecar/echo-demo/pom.xml | 0 .../java/com/baeldung/cloud/echo/EchoApplication.java | 0 .../echo-demo/src/main/resources/application.yml | 0 .../java/com/baeldung/cloud/echo/SpringContextTest.java | 0 .../spring-cloud-netflix-sidecar/pom.xml | 0 .../sidecar-demo/nodejs/hello.js | 0 .../spring-cloud-netflix-sidecar/sidecar-demo/pom.xml | 0 .../com/baeldung/cloud/sidecar/SidecarApplication.java | 0 .../sidecar-demo/src/main/resources/application.yml | 0 .../com/baeldung/cloud/sidecar/SpringContextTest.java | 0 spring-cloud-modules/spring-cloud-openfeign/README.md | 9 ++------- spring-cloud/spring-cloud-openfeign/README.md | 3 --- 15 files changed, 2 insertions(+), 10 deletions(-) rename {spring-cloud => spring-cloud-modules}/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-docker/docker-compose-restart-policy.yml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/README.md (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/echo-demo/pom.xml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/echo-demo/src/main/java/com/baeldung/cloud/echo/EchoApplication.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/echo-demo/src/main/resources/application.yml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/echo-demo/src/test/java/com/baeldung/cloud/echo/SpringContextTest.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/pom.xml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/sidecar-demo/nodejs/hello.js (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/sidecar-demo/pom.xml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/sidecar-demo/src/main/java/com/baeldung/cloud/sidecar/SidecarApplication.java (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/sidecar-demo/src/main/resources/application.yml (100%) rename {spring-cloud => spring-cloud-modules}/spring-cloud-netflix-sidecar/sidecar-demo/src/test/java/com/baeldung/cloud/sidecar/SpringContextTest.java (100%) delete mode 100644 spring-cloud/spring-cloud-openfeign/README.md diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml similarity index 100% rename from spring-cloud/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml rename to spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy-swarm-mode.yml diff --git a/spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml b/spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy.yml similarity index 100% rename from spring-cloud/spring-cloud-docker/docker-compose-restart-policy.yml rename to spring-cloud-modules/spring-cloud-docker/docker-compose-restart-policy.yml diff --git a/spring-cloud/spring-cloud-netflix-sidecar/README.md b/spring-cloud-modules/spring-cloud-netflix-sidecar/README.md similarity index 100% rename from spring-cloud/spring-cloud-netflix-sidecar/README.md rename to spring-cloud-modules/spring-cloud-netflix-sidecar/README.md 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..3aa8c20b24 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/README.md +++ b/spring-cloud-modules/spring-cloud-openfeign/README.md @@ -1,8 +1,3 @@ -### Relevant Articles: -- [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign) -- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign) -- [File Upload With Open Feign](https://www.baeldung.com/java-feign-file-upload) -- [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) +### Relevant Articles: +- [RequestLine with Feign Client](https://www.baeldung.com/feign-requestline) diff --git a/spring-cloud/spring-cloud-openfeign/README.md b/spring-cloud/spring-cloud-openfeign/README.md deleted file mode 100644 index 3aa8c20b24..0000000000 --- a/spring-cloud/spring-cloud-openfeign/README.md +++ /dev/null @@ -1,3 +0,0 @@ - -### Relevant Articles: -- [RequestLine with Feign Client](https://www.baeldung.com/feign-requestline) From d2e07395392d12e749b91e6e59301759ff2fa2bd Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 2 Jun 2022 17:11:50 +0530 Subject: [PATCH 29/40] Added missing articles --- spring-cloud-modules/spring-cloud-openfeign/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spring-cloud-modules/spring-cloud-openfeign/README.md b/spring-cloud-modules/spring-cloud-openfeign/README.md index 3aa8c20b24..77cd6d9f81 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/README.md +++ b/spring-cloud-modules/spring-cloud-openfeign/README.md @@ -1,3 +1,10 @@ ### Relevant Articles: + +- [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign) +- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign) +- [File Upload With Open Feign](https://www.baeldung.com/java-feign-file-upload) +- [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) From 5e168afb6948ca53ab1add14a3c0acbf38b4597d Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 2 Jun 2022 17:12:33 +0530 Subject: [PATCH 30/40] Update README.md --- spring-cloud-modules/spring-cloud-openfeign/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-cloud-modules/spring-cloud-openfeign/README.md b/spring-cloud-modules/spring-cloud-openfeign/README.md index 77cd6d9f81..a369da96da 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/README.md +++ b/spring-cloud-modules/spring-cloud-openfeign/README.md @@ -1,4 +1,3 @@ - ### Relevant Articles: - [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign) From 55867b720615b286bf5019993bfaf003089a598b Mon Sep 17 00:00:00 2001 From: Bhaskara Date: Thu, 2 Jun 2022 20:50:02 +0530 Subject: [PATCH 31/40] BAEL-5534 Configure JWT Authentication for OpenAPI (#12288) Co-authored-by: Bhaskara Navuluri --- .../spring-boot-springdoc/pom.xml | 17 ++- .../com/baeldung/jwt/AuthenticationApi.java | 86 ++++++++++++ .../baeldung/jwt/OpenAPI30Configuration.java | 52 ++++++++ .../baeldung/jwt/SecurityConfiguration.java | 124 ++++++++++++++++++ .../jwt/SecurityTokenApplication.java | 17 +++ .../src/main/java/com/baeldung/jwt/User.java | 56 ++++++++ .../main/java/com/baeldung/jwt/UserApi.java | 50 +++++++ .../src/main/resources/app.key | 28 ++++ .../src/main/resources/app.pub | 9 ++ .../src/main/resources/application.properties | 15 ++- .../jwt/OpenApiJwtIntegrationTest.java | 89 +++++++++++++ 11 files changed, 539 insertions(+), 4 deletions(-) create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/AuthenticationApi.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/OpenAPI30Configuration.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/User.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/UserApi.java create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/resources/app.key create mode 100644 spring-boot-modules/spring-boot-springdoc/src/main/resources/app.pub create mode 100644 spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-springdoc/pom.xml b/spring-boot-modules/spring-boot-springdoc/pom.xml index e7d4a35d97..88e616119d 100644 --- a/spring-boot-modules/spring-boot-springdoc/pom.xml +++ b/spring-boot-modules/spring-boot-springdoc/pom.xml @@ -32,6 +32,14 @@ com.h2database h2 + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + org.springframework.boot spring-boot-starter-test @@ -48,6 +56,11 @@ springdoc-openapi-data-rest ${springdoc.version} + + org.springdoc + springdoc-openapi-security + ${springdoc.version} + org.springframework.restdocs @@ -131,7 +144,7 @@ org.springdoc springdoc-openapi-maven-plugin - 0.2 + 1.4 integration-test @@ -152,7 +165,7 @@ - 1.6.4 + 1.6.8 1.5.6 ${project.build.directory}/generated-snippets diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/AuthenticationApi.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/AuthenticationApi.java new file mode 100644 index 0000000000..c53774129a --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/AuthenticationApi.java @@ -0,0 +1,86 @@ +package com.baeldung.jwt; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.oauth2.jwt.JwtClaimsSet; +import org.springframework.security.oauth2.jwt.JwtEncoder; +import org.springframework.security.oauth2.jwt.JwtEncoderParameters; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.Instant; +import java.util.stream.Collectors; + +/** + * REST APIs that contains all the operations that can be performed for authentication like login, registration etc + */ +@RequestMapping("/api/auth") +@RestController +@Tag(name = "Authentication", description = "The Authentication API. Contains operations like change password, forgot password, login, logout, etc.") +public class AuthenticationApi { + + private final UserDetailsService userDetailsService; + private final JwtEncoder encoder; + + public AuthenticationApi(UserDetailsService userDetailsService, JwtEncoder encoder) { + this.userDetailsService = userDetailsService; + this.encoder = encoder; + } + + /** + * API to Login + * + * @param user The login entity that contains username and password + * @return Returns the JWT token + * @see com.baeldung.jwt.User + */ + @Operation(summary = "User Authentication", description = "Authenticate the user and return a JWT token if the user is valid.") + @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @io.swagger.v3.oas.annotations.media.Content(mediaType = "application/json", examples = @io.swagger.v3.oas.annotations.media.ExampleObject(value = "{\n" + " \"username\": \"jane\",\n" + + " \"password\": \"password\"\n" + "}", summary = "User Authentication Example"))) + @PostMapping(value = "/login", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity login(@RequestBody User user) { + UserDetails userDetails = userDetailsService.loadUserByUsername(user.getUsername()); + if (user.getPassword().equalsIgnoreCase(userDetails.getPassword())) { + String token = generateToken(userDetails); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.set("X-AUTH-TOKEN", token); + return ResponseEntity.ok().headers(httpHeaders).contentType(MediaType.APPLICATION_JSON).body("{\"token\":\"" + token + "\"}"); + } else { + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).contentType(MediaType.APPLICATION_JSON).body("Invalid username or password"); + } + } + + /** + * Generates the JWT token with claims + * + * @param userDetails The user details + * @return Returns the JWT token + */ + private String generateToken(UserDetails userDetails) { + Instant now = Instant.now(); + long expiry = 36000L; + // @formatter:off + String scope = userDetails.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .collect(Collectors.joining(" ")); + JwtClaimsSet claims = JwtClaimsSet.builder() + .issuer("self") + .issuedAt(now) + .expiresAt(now.plusSeconds(expiry)) + .subject(userDetails.getUsername()) + .claim("scope", scope) + .build(); + // @formatter:on + return this.encoder.encode(JwtEncoderParameters.from(claims)).getTokenValue(); + } + +} diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/OpenAPI30Configuration.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/OpenAPI30Configuration.java new file mode 100644 index 0000000000..53f0b735fe --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/OpenAPI30Configuration.java @@ -0,0 +1,52 @@ +package com.baeldung.jwt; + +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Contact; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.info.License; +import io.swagger.v3.oas.annotations.servers.Server; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +//@formatter:off +@OpenAPIDefinition( + info = @Info(title = "User API", version = "${api.version}", + contact = @Contact(name = "Baeldung", email = "user-apis@baeldung.com", url = "https://www.baeldung.com"), + license = @License(name = "Apache 2.0", url = "https://www.apache.org/licenses/LICENSE-2.0"), termsOfService = "${tos.uri}", + description = "${api.description}"), + servers = { + @Server(url = "http://localhost:8080", description = "Development"), + @Server(url = "${api.server.url}", description = "Production")}) +//@formatter:on +public class OpenAPI30Configuration { + + /** + * Configure the OpenAPI components. + * + * @return Returns fully configure OpenAPI object + * @see OpenAPI + */ + @Bean + public OpenAPI customizeOpenAPI() { + //@formatter:off + final String securitySchemeName = "bearerAuth"; + return new OpenAPI() + .addSecurityItem(new SecurityRequirement() + .addList(securitySchemeName)) + .components(new Components() + .addSecuritySchemes(securitySchemeName, new SecurityScheme() + .name(securitySchemeName) + .type(SecurityScheme.Type.HTTP) + .scheme("bearer") + .description( + "Provide the JWT token. JWT token can be obtained from the Login API. For testing, use the credentials john/password") + .bearerFormat("JWT"))); + //@formatter:on + + } +} 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 new file mode 100644 index 0000000000..6b42a8f1bb --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityConfiguration.java @@ -0,0 +1,124 @@ +package com.baeldung.jwt; + +import com.nimbusds.jose.jwk.JWK; +import com.nimbusds.jose.jwk.JWKSet; +import com.nimbusds.jose.jwk.RSAKey; +import com.nimbusds.jose.jwk.source.ImmutableJWKSet; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.oauth2.jwt.JwtDecoder; +import org.springframework.security.oauth2.jwt.JwtEncoder; +import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; +import org.springframework.security.oauth2.jwt.NimbusJwtEncoder; +import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint; +import org.springframework.security.oauth2.server.resource.web.access.BearerTokenAccessDeniedHandler; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; +import org.springframework.security.web.SecurityFilterChain; + +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; + +import org.springframework.security.core.userdetails.User; + +/** + * This class is inspired from + * https://github.com/spring-projects/spring-security-samples/blob/5.7.x/servlet/spring-boot/java/jwt/login/src/main/java/example/RestConfig.java + */ +@EnableWebSecurity +@Configuration +public class SecurityConfiguration { + + @Value("${jwt.public.key}") + RSAPublicKey publicKey; + + @Value("${jwt.private.key}") + RSAPrivateKey privateKey; + + /** + * This bean is used to configure the JWT token. Configure the URLs that should not be protected by the JWT token. + * + * @param http the HttpSecurity object + * @return the HttpSecurity object + * @throws Exception if an error occurs + */ + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + //@formatter:off + return http + .authorizeHttpRequests(authorizeRequests -> authorizeRequests + .antMatchers("/api/auth/**", "/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", + "/swagger-ui/index.html") + .permitAll() + .anyRequest() + .authenticated()) + .cors().disable() + .csrf().disable() + .formLogin().disable() + .httpBasic().disable() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt) + .exceptionHandling(exceptions -> exceptions + .authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint()) + .accessDeniedHandler(new BearerTokenAccessDeniedHandler()) + .and()) + .build(); + //@formatter:on + } + + /** + * For demonstration/example, we use the InMemoryUserDetailsManager. + * + * @return Returns the UserDetailsService with pre-configure credentials. + * @see InMemoryUserDetailsManager + */ + @Bean + UserDetailsService allUsers() { + // @formatter:off + InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager(); + manager + .createUser(User.builder() + .passwordEncoder(password -> password) + .username("john") + .password("password") + .authorities("USER") + .roles("USER").build()); + manager + .createUser(User.builder() + .passwordEncoder(password -> password) + .username("jane") + .password("password") + .authorities("USER") + .roles("USER").build()); + return manager; + // @formatter:on + } + + /** + * This bean is used to decode the JWT token. + * + * @return Returns the JwtDecoder bean to decode JWT tokens. + */ + @Bean + JwtDecoder jwtDecoder() { + return NimbusJwtDecoder.withPublicKey(this.publicKey).build(); + } + + /** + * This bean is used to encode the JWT token. + * + * @return Returns the JwtEncoder bean to encode JWT tokens. + */ + @Bean + JwtEncoder jwtEncoder() { + JWK jwk = new RSAKey.Builder(this.publicKey).privateKey(this.privateKey).build(); + return new NimbusJwtEncoder(new ImmutableJWKSet<>(new JWKSet(jwk))); + } +} + 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 new file mode 100644 index 0000000000..4c0c4f01d8 --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/SecurityTokenApplication.java @@ -0,0 +1,17 @@ +package com.baeldung.jwt; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SecurityTokenApplication { + + /** + * The bootstrap method + * @param args + */ + public static void main(String[] args) { + SpringApplication.run(SecurityTokenApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/User.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/User.java new file mode 100644 index 0000000000..43427c609f --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/User.java @@ -0,0 +1,56 @@ +package com.baeldung.jwt; + + +import java.io.Serializable; + +public class User implements Serializable { + + private static final long serialVersionUID = 3317686311392412458L; + private String username; + private String password; + private String role; + private String email; + + public User(String username, String password, String role) { + this.username = username; + this.password = password; + this.role = role; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "User [username=" + username + ", password=" + password + ", role=" + role + "]"; + } +} diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/UserApi.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/UserApi.java new file mode 100644 index 0000000000..d2d17978ba --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/jwt/UserApi.java @@ -0,0 +1,50 @@ +package com.baeldung.jwt; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.MessageFormat; + +/** + * REST APIs that contain all the operations that can be performed on a User + */ +@RequestMapping("/api/user") +@RestController +@Tag(name = "User", description = "The User API. Contains all the operations that can be performed on a user.") +public class UserApi { + + private final UserDetailsService userDetailsService; + + public UserApi(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } + + /** + * API to get the current user. Returns the user details for the provided JWT token + * @param authentication The authentication object that contains the JWT token + * @return Returns the user details for the provided JWT token + */ + @Operation(summary = "Get user details", description = "Get the user details. The operation returns the details of the user that is associated " + "with the provided JWT token.") + @GetMapping + public UserDetails getUser(Authentication authentication) { + return userDetailsService.loadUserByUsername(authentication.getName()); + } + + /** + * API to delete the current user. + * @param authentication The authentication object that contains the JWT token + * @return Returns a success message on deletion of the user + */ + @Operation(summary = "Delete user details", description = "Delete user details. The operation deletes the details of the user that is " + "associated with the provided JWT token.") + @DeleteMapping + public String deleteUser(Authentication authentication) { + return MessageFormat.format("User {0} deleted successfully", authentication.getName()); + } +} diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.key b/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.key new file mode 100644 index 0000000000..53510079ac --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDcWWomvlNGyQhA +iB0TcN3sP2VuhZ1xNRPxr58lHswC9Cbtdc2hiSbe/sxAvU1i0O8vaXwICdzRZ1JM +g1TohG9zkqqjZDhyw1f1Ic6YR/OhE6NCpqERy97WMFeW6gJd1i5inHj/W19GAbqK +LhSHGHqIjyo0wlBf58t+qFt9h/EFBVE/LAGQBsg/jHUQCxsLoVI2aSELGIw2oSDF +oiljwLaQl0n9khX5ZbiegN3OkqodzCYHwWyu6aVVj8M1W9RIMiKmKr09s/gf31Nc +3WjvjqhFo1rTuurWGgKAxJLL7zlJqAKjGWbIT4P6h/1Kwxjw6X23St3OmhsG6HIn ++jl1++MrAgMBAAECggEBAMf820wop3pyUOwI3aLcaH7YFx5VZMzvqJdNlvpg1jbE +E2Sn66b1zPLNfOIxLcBG8x8r9Ody1Bi2Vsqc0/5o3KKfdgHvnxAB3Z3dPh2WCDek +lCOVClEVoLzziTuuTdGO5/CWJXdWHcVzIjPxmK34eJXioiLaTYqN3XKqKMdpD0ZG +mtNTGvGf+9fQ4i94t0WqIxpMpGt7NM4RHy3+Onggev0zLiDANC23mWrTsUgect/7 +62TYg8g1bKwLAb9wCBT+BiOuCc2wrArRLOJgUkj/F4/gtrR9ima34SvWUyoUaKA0 +bi4YBX9l8oJwFGHbU9uFGEMnH0T/V0KtIB7qetReywkCgYEA9cFyfBIQrYISV/OA ++Z0bo3vh2aL0QgKrSXZ924cLt7itQAHNZ2ya+e3JRlTczi5mnWfjPWZ6eJB/8MlH +Gpn12o/POEkU+XjZZSPe1RWGt5g0S3lWqyx9toCS9ACXcN9tGbaqcFSVI73zVTRA +8J9grR0fbGn7jaTlTX2tnlOTQ60CgYEA5YjYpEq4L8UUMFkuj+BsS3u0oEBnzuHd +I9LEHmN+CMPosvabQu5wkJXLuqo2TxRnAznsA8R3pCLkdPGoWMCiWRAsCn979TdY +QbqO2qvBAD2Q19GtY7lIu6C35/enQWzJUMQE3WW0OvjLzZ0l/9mA2FBRR+3F9A1d +rBdnmv0c3TcCgYEAi2i+ggVZcqPbtgrLOk5WVGo9F1GqUBvlgNn30WWNTx4zIaEk +HSxtyaOLTxtq2odV7Kr3LGiKxwPpn/T+Ief+oIp92YcTn+VfJVGw4Z3BezqbR8lA +Uf/+HF5ZfpMrVXtZD4Igs3I33Duv4sCuqhEvLWTc44pHifVloozNxYfRfU0CgYBN +HXa7a6cJ1Yp829l62QlJKtx6Ymj95oAnQu5Ez2ROiZMqXRO4nucOjGUP55Orac1a +FiGm+mC/skFS0MWgW8evaHGDbWU180wheQ35hW6oKAb7myRHtr4q20ouEtQMdQIF +snV39G1iyqeeAsf7dxWElydXpRi2b68i3BIgzhzebQKBgQCdUQuTsqV9y/JFpu6H +c5TVvhG/ubfBspI5DhQqIGijnVBzFT//UfIYMSKJo75qqBEyP2EJSmCsunWsAFsM +TszuiGTkrKcZy9G0wJqPztZZl2F2+bJgnA6nBEV7g5PA4Af+QSmaIhRwqGDAuROR +47jndeyIaMTNETEmOnms+as17g== +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.pub b/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.pub new file mode 100644 index 0000000000..0b2ee7b336 --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/main/resources/app.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3FlqJr5TRskIQIgdE3Dd +7D9lboWdcTUT8a+fJR7MAvQm7XXNoYkm3v7MQL1NYtDvL2l8CAnc0WdSTINU6IRv +c5Kqo2Q4csNX9SHOmEfzoROjQqahEcve1jBXluoCXdYuYpx4/1tfRgG6ii4Uhxh6 +iI8qNMJQX+fLfqhbfYfxBQVRPywBkAbIP4x1EAsbC6FSNmkhCxiMNqEgxaIpY8C2 +kJdJ/ZIV+WW4noDdzpKqHcwmB8FsrumlVY/DNVvUSDIipiq9PbP4H99TXN1o746o +RaNa07rq1hoCgMSSy+85SagCoxlmyE+D+of9SsMY8Ol9t0rdzpobBuhyJ/o5dfvj +KwIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/resources/application.properties b/spring-boot-modules/spring-boot-springdoc/src/main/resources/application.properties index 733e716e76..a668601a7d 100644 --- a/spring-boot-modules/spring-boot-springdoc/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-springdoc/src/main/resources/application.properties @@ -1,6 +1,5 @@ # custom path for swagger-ui springdoc.swagger-ui.path=/swagger-ui-custom.html -springdoc.swagger-ui.operationsSorter=method # custom path for api docs springdoc.api-docs.path=/api-docs @@ -10,4 +9,16 @@ spring.datasource.url=jdbc:h2:mem:springdoc ## for com.baeldung.restdocopenapi ## springdoc.version=@springdoc.version@ -spring.jpa.hibernate.ddl-auto=none \ No newline at end of file +spring.jpa.hibernate.ddl-auto=none + +## for com.baeldung.jwt ## +jwt.private.key=classpath:app.key +jwt.public.key=classpath:app.pub + + +api.version=1.0-SNAPSHOT +tos.uri=terms-of-service +api.server.url=https://www.baeldung.com +api.description=The User API is used to create, update, and delete users. Users can be created with or without an associated account. If an account is created, the user will be granted the ROLE_USER role. If an account is not created, the user will be granted the ROLE_USER role. +springdoc.swagger-ui.operationsSorter=alpha +springdoc.swagger-ui.tagsSorter=alpha \ No newline at end of file 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 new file mode 100644 index 0000000000..1ea88d14fa --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/test/java/com/baeldung/jwt/OpenApiJwtIntegrationTest.java @@ -0,0 +1,89 @@ +package com.baeldung.jwt; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@DisplayName("OpenAPI JWT Live Tests") +class OpenApiJwtIntegrationTest +{ + @LocalServerPort + private int port; + @Autowired + private AuthenticationApi authenticationApi; + @Autowired + private TestRestTemplate restTemplate; + + @Test + @DisplayName("LiveTest - Render Swagger UI") + void whenInvokeSwagger_thenRenderIndexPage() + { + assertNotNull(authenticationApi); + + String response = this.restTemplate.getForObject("http://localhost:" + port + "/swagger-ui.html", String.class); + + assertNotNull(response); + assertTrue(response.contains("Swagger UI")); + assertTrue(response.contains("
")); + } + + @Test + @DisplayName("LiveTest - Check Headers") + void whenInvokeOpenApi_thenCheckHeaders() + { + assertNotNull(authenticationApi); + + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/v3/api-docs", + String.class); + + assertNotNull(response); + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertNotNull(response.getHeaders().get("Content-Type")); + assertEquals(1, response.getHeaders().get("Content-Type").size()); + assertEquals("application/json", response.getHeaders().get("Content-Type").get(0)); + } + + @Test + @DisplayName("LiveTest - Verify OpenAPI Document") + void whenInvokeOpenApi_thenVerifyOpenApiDoc() + { + assertNotNull(authenticationApi); + + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/v3/api-docs", + String.class); + + assertNotNull(response); + assertNotNull(response.getBody()); + assertTrue(response.getBody().contains("\"openapi\":")); + assertTrue(response.getBody().contains("User API")); + assertTrue(response.getBody().contains("\"post\"")); + } + + @Test + @DisplayName("LiveTest - Verify OpenAPI Security Section") + void whenInvokeOpenApi_thenCheckSecurityConfig() + { + assertNotNull(authenticationApi); + + ResponseEntity response = this.restTemplate.getForEntity("http://localhost:" + port + "/v3/api-docs", + String.class); + + assertNotNull(response); + assertNotNull(response.getBody()); + assertTrue(response.getBody().contains("\"securitySchemes\"")); + assertTrue(response.getBody().contains("\"bearerFormat\":\"JWT\"")); + assertTrue(response.getBody().contains("\"scheme\":\"bearer\"")); + } + +} + From 89f020387fc2e51b5b0dc0371379dcfed1f294a1 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 3 Jun 2022 17:47:09 +0530 Subject: [PATCH 32/40] JAVA-12420 Renamed docker to docker-modules --- {docker => docker-modules}/README.md | 0 .../docker-caching/multi-module-caching/Dockerfile | 0 .../multi-module-caching/Dockerfile-Buildkit | 0 .../multi-module-caching/core/pom.xml | 0 .../java/com/baeldung/maven_caching/CoreClass.java | 0 .../docker-caching/multi-module-caching/pom.xml | 0 .../multi-module-caching/runner/pom.xml | 0 .../maven_caching/MavenCachingApplication.java | 0 .../docker-caching/single-module-caching/Dockerfile | 0 .../single-module-caching/Dockerfile-Buildkit | 0 .../docker-caching/single-module-caching/pom.xml | 0 .../baeldung/maven_caching/MavenCachingMain.java | 0 {docker => docker-modules}/docker-compose.yml | 0 .../projects/config/Dockerfile | 0 .../projects/config/nginx.conf | 0 .../projects/sample-site/docker/Dockerfile | 0 .../sample-site/docker/Dockerfile-from-base | 0 .../projects/sample-site/docker/Dockerfile-script | 0 .../projects/sample-site/docker/build-docker.sh | 0 .../projects/sample-site/html/index.html | 0 .../docker-internal-dto/pom.xml | 2 +- .../java/com/baeldung/docker/dto/VariableDto.java | 0 .../docker-push-to-private-repo/.gitignore | 0 .../docker-push-to-private-repo/Dockerfile | 0 .../docker-push-to-private-repo/README.md | 0 .../docker-push-to-private-repo/pom.xml | 2 +- .../baeldung/docker/push/HelloWorldController.java | 0 .../docker/push/PushToPrivateRepoApplication.java | 0 .../src/main/resources/application.properties | 0 .../docker-sample-app/Dockerfile | 0 .../docker-sample-app/README.md | 0 .../docker-compose-build-image.yaml | 0 .../docker-compose-with-image.yaml | 0 .../docker-sample-app/pom.xml | 2 +- .../com/baeldung/docker/app/DockAppApplication.java | 0 .../baeldung/docker/app/endpoint/MyController.java | 0 .../src/main/resources/application.properties | 0 .../docker/app/DockAppApplicationUnitTest.java | 0 .../docker-spring-boot-postgres/.gitignore | 0 .../.mvn/wrapper/MavenWrapperDownloader.java | 0 .../.mvn/wrapper/maven-wrapper.jar | Bin .../.mvn/wrapper/maven-wrapper.properties | 0 .../docker-spring-boot-postgres/mvnw | 0 .../docker-spring-boot-postgres/mvnw.cmd | 0 .../docker-spring-boot-postgres/pom.xml | 0 .../src/main/docker/Dockerfile | 0 .../src/main/docker/docker-compose.yml | 0 .../src/main/java/com/baeldung/docker/Customer.java | 0 .../com/baeldung/docker/CustomerRepository.java | 0 .../java/com/baeldung/docker/DemoApplication.java | 0 .../src/main/resources/application.properties | 0 .../com/baeldung/docker/DemoApplicationTests.java | 0 .../docker-spring-boot/README.md | 0 .../docker-spring-boot/pom.xml | 2 +- .../docker-spring-boot/src/layers.xml | 0 .../docker-spring-boot/src/main/docker/Dockerfile | 0 .../src/main/docker/springprofile/Dockerfile | 0 .../docker/springprofile/docker-compose-prod.yml | 0 .../docker/springprofile/docker-compose-test.yml | 0 .../com/baeldung/docker/spring/DemoApplication.java | 0 .../com/baeldung/docker/spring/HelloController.java | 0 .../src/main/resources/application.properties | 0 .../dockerfile-with-git/.gitmodules | 0 .../dockerfile-with-git/Dockerfile | 0 {docker => docker-modules}/heap-sizing/Dockerfile | 0 {docker => docker-modules}/heap-sizing/pom.xml | 0 .../docker/heapsizing/HeapSizingApplication.java | 0 .../com/baeldung/docker/heapsizing/PrintXmxXms.java | 0 {docker => docker-modules}/pom.xml | 4 ++-- pom.xml | 8 ++++---- 70 files changed, 10 insertions(+), 10 deletions(-) rename {docker => docker-modules}/README.md (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/Dockerfile (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/Dockerfile-Buildkit (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/core/pom.xml (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/core/src/main/java/com/baeldung/maven_caching/CoreClass.java (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/pom.xml (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/runner/pom.xml (100%) rename {docker => docker-modules}/docker-caching/multi-module-caching/runner/src/main/java/com/baeldung/maven_caching/MavenCachingApplication.java (100%) rename {docker => docker-modules}/docker-caching/single-module-caching/Dockerfile (100%) rename {docker => docker-modules}/docker-caching/single-module-caching/Dockerfile-Buildkit (100%) rename {docker => docker-modules}/docker-caching/single-module-caching/pom.xml (100%) rename {docker => docker-modules}/docker-caching/single-module-caching/src/main/java/com/baeldung/maven_caching/MavenCachingMain.java (100%) rename {docker => docker-modules}/docker-compose.yml (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/config/Dockerfile (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/config/nginx.conf (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-from-base (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/sample-site/docker/Dockerfile-script (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/sample-site/docker/build-docker.sh (100%) rename {docker => docker-modules}/docker-include-outside-build-context/projects/sample-site/html/index.html (100%) rename {docker => docker-modules}/docker-internal-dto/pom.xml (91%) rename {docker => docker-modules}/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java (100%) rename {docker => docker-modules}/docker-push-to-private-repo/.gitignore (100%) rename {docker => docker-modules}/docker-push-to-private-repo/Dockerfile (100%) rename {docker => docker-modules}/docker-push-to-private-repo/README.md (100%) rename {docker => docker-modules}/docker-push-to-private-repo/pom.xml (96%) rename {docker => docker-modules}/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/HelloWorldController.java (100%) rename {docker => docker-modules}/docker-push-to-private-repo/src/main/java/com/baeldung/docker/push/PushToPrivateRepoApplication.java (100%) rename {docker => docker-modules}/docker-push-to-private-repo/src/main/resources/application.properties (100%) rename {docker => docker-modules}/docker-sample-app/Dockerfile (100%) rename {docker => docker-modules}/docker-sample-app/README.md (100%) rename {docker => docker-modules}/docker-sample-app/docker-compose-build-image.yaml (100%) rename {docker => docker-modules}/docker-sample-app/docker-compose-with-image.yaml (100%) rename {docker => docker-modules}/docker-sample-app/pom.xml (96%) rename {docker => docker-modules}/docker-sample-app/src/main/java/com/baeldung/docker/app/DockAppApplication.java (100%) rename {docker => docker-modules}/docker-sample-app/src/main/java/com/baeldung/docker/app/endpoint/MyController.java (100%) rename {docker => docker-modules}/docker-sample-app/src/main/resources/application.properties (100%) rename {docker => docker-modules}/docker-sample-app/src/test/java/com/baeldung/docker/app/DockAppApplicationUnitTest.java (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/.gitignore (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/.mvn/wrapper/MavenWrapperDownloader.java (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.jar (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/.mvn/wrapper/maven-wrapper.properties (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/mvnw (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/mvnw.cmd (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/pom.xml (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/docker/Dockerfile (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/docker/docker-compose.yml (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/Customer.java (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/CustomerRepository.java (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/java/com/baeldung/docker/DemoApplication.java (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/main/resources/application.properties (100%) rename {docker => docker-modules}/docker-spring-boot-postgres/src/test/java/com/baeldung/docker/DemoApplicationTests.java (100%) rename {docker => docker-modules}/docker-spring-boot/README.md (100%) rename {docker => docker-modules}/docker-spring-boot/pom.xml (97%) rename {docker => docker-modules}/docker-spring-boot/src/layers.xml (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/docker/Dockerfile (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/docker/springprofile/Dockerfile (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/docker/springprofile/docker-compose-prod.yml (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/docker/springprofile/docker-compose-test.yml (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java (100%) rename {docker => docker-modules}/docker-spring-boot/src/main/resources/application.properties (100%) rename {docker => docker-modules}/dockerfile-with-git/.gitmodules (100%) rename {docker => docker-modules}/dockerfile-with-git/Dockerfile (100%) rename {docker => docker-modules}/heap-sizing/Dockerfile (100%) rename {docker => docker-modules}/heap-sizing/pom.xml (100%) rename {docker => docker-modules}/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/HeapSizingApplication.java (100%) rename {docker => docker-modules}/heap-sizing/src/main/java/com/baeldung/docker/heapsizing/PrintXmxXms.java (100%) rename {docker => docker-modules}/pom.xml (93%) 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/pom.xml b/pom.xml index 8fa7c1e2b4..098dcb328a 100644 --- a/pom.xml +++ b/pom.xml @@ -372,7 +372,7 @@ cloud-foundry-uaa code-generation - core-groovy-modules + core-groovy-modules core-java-modules @@ -832,7 +832,7 @@ code-generation core-groovy-modules - + core-java-modules couchbase @@ -1297,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 @@ -1365,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 From db663d20335ba1f2b7c49c7a30714fba8e6ed89b Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 3 Jun 2022 18:00:47 +0530 Subject: [PATCH 33/40] JAVA-12421 Renamed graphql to graphql-modules --- {graphql => graphql-modules}/graphql-dgs/README.md | 0 {graphql => graphql-modules}/graphql-dgs/pom.xml | 2 +- .../src/main/java/com/bealdung/graphqlDGS/Album.java | 0 .../java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java | 0 .../main/java/com/bealdung/graphqlDGS/Application.java | 0 .../graphql-dgs/src/main/resources/application.properties | 0 .../graphql-dgs/src/main/resources/schema/schema.graphqls | 0 .../graphql-error-handling/README.md | 0 .../graphql-error-handling/pom.xml | 2 +- .../error/handling/GraphQLErrorHandlerApplication.java | 0 .../baeldung/graphql/error/handling/domain/Location.java | 0 .../baeldung/graphql/error/handling/domain/Vehicle.java | 0 .../handling/exception/AbstractGraphQLException.java | 0 .../error/handling/exception/GraphQLErrorAdapter.java | 0 .../error/handling/exception/InvalidInputException.java | 0 .../exception/VehicleAlreadyPresentException.java | 0 .../handling/exception/VehicleNotFoundException.java | 0 .../error/handling/repository/InventoryRepository.java | 0 .../error/handling/repository/LocationRepository.java | 0 .../graphql/error/handling/resolver/Mutation.java | 0 .../baeldung/graphql/error/handling/resolver/Query.java | 0 .../graphql/error/handling/service/InventoryService.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/graphql/inventory.graphqls | 0 .../graphql-error-handling/src/main/resources/import.sql | 0 .../GraphQLErrorHandlerApplicationIntegrationTest.java | 0 .../com/baeldung/graphql/error/handling/TestUtils.java | 0 ...error_request_non_null_fields_partial_response.graphql | 0 .../request/request_error_invalid_request_syntax.graphql | 0 .../request/request_error_unknown_operation.graphql | 0 ...ld_error_request_non_null_fields_partial_response.json | 0 .../response/request_error_invalid_request_syntax.json | 0 .../graphql/response/request_error_unknown_operation.json | 0 .../src/test/resources/init_script.sql | 0 {graphql => graphql-modules}/graphql-java/README.md | 0 .../graphql-java/payload-examples/createUser.json | 0 .../graphql-java/payload-examples/deleteUser.json | 0 .../graphql-java/payload-examples/listUsers.json | 0 .../graphql-java/payload-examples/retrieveUser.json | 0 .../graphql-java/payload-examples/searchName.json | 0 .../graphql-java/payload-examples/updateUser.json | 0 {graphql => graphql-modules}/graphql-java/pom.xml | 3 ++- .../src/main/java/com/baeldung/graphql/Application.java | 0 .../baeldung/graphql/clients/AmericanExpressNodes.java | 0 .../com/baeldung/graphql/clients/ApacheHttpClient.java | 0 .../src/main/java/com/baeldung/graphql/data/Author.java | 0 .../src/main/java/com/baeldung/graphql/data/Book.java | 0 .../java/com/baeldung/graphql/data/BookRepository.java | 0 .../src/main/java/com/baeldung/graphql/data/Data.java | 0 .../src/main/java/com/baeldung/graphql/data/Response.java | 0 .../src/main/java/com/baeldung/graphql/entity/User.java | 0 .../java/com/baeldung/graphql/handler/UserHandler.java | 0 .../java/com/baeldung/graphql/mutation/UserMutation.java | 0 .../main/java/com/baeldung/graphql/query/UserQuery.java | 0 .../main/java/com/baeldung/graphql/schema/UserSchema.java | 0 .../java/com/baeldung/graphql/server/GraphQLEndpoint.java | 0 .../java/com/baeldung/graphql/server/GraphQLQuery.java | 0 .../main/java/com/baeldung/graphql/utils/SchemaUtils.java | 0 .../java/com/baeldung/graphqlreturnmap/AppHandler.java | 0 .../graphqlreturnmap/ExtendedGraphQLScalarType.java | 0 .../com/baeldung/graphqlreturnmap/GraphqlReturnMap.java | 0 .../com/baeldung/graphqlreturnmap/entity/Attribute.java | 0 .../com/baeldung/graphqlreturnmap/entity/Product.java | 0 .../graphqlreturnmap/model/AttributeKeyValueModel.java | 0 .../graphqlreturnmap/repository/ProductRepository.java | 0 .../repository/impl/ProductRepositoryImpl.java | 0 .../graphqlreturnmap/resolver/ProductResolver.java | 0 .../com/baeldung/graphqlreturnmap/resolver/Query.java | 0 .../graphql-java/src/main/resources/logback.xml | 0 .../graphql-java/src/main/resources/schema.graphqls | 0 .../test/java/com/baeldung/graphql/GraphQLMockServer.java | 0 .../graphql/clients/AmericanExpressNodesUnitTest.java | 0 .../graphql/clients/ApacheHttpClientUnitTest.java | 0 {graphql => graphql-modules}/graphql-spqr/README.md | 0 {graphql => graphql-modules}/graphql-spqr/pom.xml | 2 +- .../src/main/java/com/baeldung/SpringBootApp.java | 0 .../src/main/java/com/baeldung/spqr/Book.java | 0 .../src/main/java/com/baeldung/spqr/BookService.java | 0 .../src/main/java/com/baeldung/spqr/IBookService.java | 0 {graphql => graphql-modules}/pom.xml | 6 +++--- pom.xml | 8 ++++---- 81 files changed, 12 insertions(+), 11 deletions(-) rename {graphql => graphql-modules}/graphql-dgs/README.md (100%) rename {graphql => graphql-modules}/graphql-dgs/pom.xml (98%) rename {graphql => graphql-modules}/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Album.java (100%) rename {graphql => graphql-modules}/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/AlbumsDataFetcher.java (100%) rename {graphql => graphql-modules}/graphql-dgs/src/main/java/com/bealdung/graphqlDGS/Application.java (100%) rename {graphql => graphql-modules}/graphql-dgs/src/main/resources/application.properties (100%) rename {graphql => graphql-modules}/graphql-dgs/src/main/resources/schema/schema.graphqls (100%) rename {graphql => graphql-modules}/graphql-error-handling/README.md (100%) rename {graphql => graphql-modules}/graphql-error-handling/pom.xml (98%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplication.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Location.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/domain/Vehicle.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/AbstractGraphQLException.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/GraphQLErrorAdapter.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/InvalidInputException.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleNotFoundException.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/InventoryRepository.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/repository/LocationRepository.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Mutation.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/resolver/Query.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/service/InventoryService.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/resources/application.yml (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/resources/graphql/inventory.graphqls (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/main/resources/import.sql (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/GraphQLErrorHandlerApplicationIntegrationTest.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/java/com/baeldung/graphql/error/handling/TestUtils.java (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/request/field_error_request_non_null_fields_partial_response.graphql (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/request/request_error_invalid_request_syntax.graphql (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/request/request_error_unknown_operation.graphql (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/response/field_error_request_non_null_fields_partial_response.json (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/response/request_error_invalid_request_syntax.json (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/graphql/response/request_error_unknown_operation.json (100%) rename {graphql => graphql-modules}/graphql-error-handling/src/test/resources/init_script.sql (100%) rename {graphql => graphql-modules}/graphql-java/README.md (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/createUser.json (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/deleteUser.json (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/listUsers.json (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/retrieveUser.json (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/searchName.json (100%) rename {graphql => graphql-modules}/graphql-java/payload-examples/updateUser.json (100%) rename {graphql => graphql-modules}/graphql-java/pom.xml (99%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/Application.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/clients/AmericanExpressNodes.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/clients/ApacheHttpClient.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/data/Author.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/data/Book.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/data/BookRepository.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/data/Data.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/data/Response.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLEndpoint.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/server/GraphQLQuery.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/AppHandler.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/ExtendedGraphQLScalarType.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/GraphqlReturnMap.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Attribute.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/entity/Product.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/model/AttributeKeyValueModel.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/ProductRepository.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/repository/impl/ProductRepositoryImpl.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/ProductResolver.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/java/com/baeldung/graphqlreturnmap/resolver/Query.java (100%) rename {graphql => graphql-modules}/graphql-java/src/main/resources/logback.xml (100%) rename {graphql => graphql-modules}/graphql-java/src/main/resources/schema.graphqls (100%) rename {graphql => graphql-modules}/graphql-java/src/test/java/com/baeldung/graphql/GraphQLMockServer.java (100%) rename {graphql => graphql-modules}/graphql-java/src/test/java/com/baeldung/graphql/clients/AmericanExpressNodesUnitTest.java (100%) rename {graphql => graphql-modules}/graphql-java/src/test/java/com/baeldung/graphql/clients/ApacheHttpClientUnitTest.java (100%) rename {graphql => graphql-modules}/graphql-spqr/README.md (100%) rename {graphql => graphql-modules}/graphql-spqr/pom.xml (95%) rename {graphql => graphql-modules}/graphql-spqr/src/main/java/com/baeldung/SpringBootApp.java (100%) rename {graphql => graphql-modules}/graphql-spqr/src/main/java/com/baeldung/spqr/Book.java (100%) rename {graphql => graphql-modules}/graphql-spqr/src/main/java/com/baeldung/spqr/BookService.java (100%) rename {graphql => graphql-modules}/graphql-spqr/src/main/java/com/baeldung/spqr/IBookService.java (100%) rename {graphql => graphql-modules}/pom.xml (90%) 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/pom.xml b/pom.xml index 8fa7c1e2b4..86980874fa 100644 --- a/pom.xml +++ b/pom.xml @@ -372,7 +372,7 @@ cloud-foundry-uaa code-generation - core-groovy-modules + core-groovy-modules core-java-modules @@ -402,7 +402,7 @@ - graphql + graphql-modules grpc gson guava-modules @@ -832,7 +832,7 @@ code-generation core-groovy-modules - + core-java-modules couchbase @@ -861,7 +861,7 @@ - graphql + graphql-modules grpc gson guava-modules From fbe0593ceda35fd8bb9d89f70fdbd7fae529d484 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Fri, 3 Jun 2022 19:46:16 +0200 Subject: [PATCH 34/40] BAEL-5625 bigdecimal =0 article (#12266) --- .../BigDecimalZeroChkUnitTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 java-numbers-4/src/test/java/com/baeldung/bigdecimalzero/BigDecimalZeroChkUnitTest.java 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); + } +} From 908387dbfb1f42d679bd8d8df7d201568947eb0a Mon Sep 17 00:00:00 2001 From: Palaniappan Arunachalam Date: Sat, 4 Jun 2022 10:49:26 +0530 Subject: [PATCH 35/40] BAEL-5524: Mock HttpServletRequest + tests (#12242) * BAEL-5524: Mock HttpServletRequest + tests * BAEL-5524: Fixed JUnit tests + dependency * BAEL-5524: Updated test parameters --- javax-servlets-2/pom.xml | 29 + .../com/baeldung/servlets/UserServlet.java | 24 + .../java/com/baeldung/servlets/TestUtil.java | 678 ++++++++++++++++++ .../servlets/UserServletUnitTest.java | 93 +++ 4 files changed, 824 insertions(+) create mode 100644 javax-servlets-2/src/main/java/com/baeldung/servlets/UserServlet.java create mode 100644 javax-servlets-2/src/test/java/com/baeldung/servlets/TestUtil.java create mode 100644 javax-servlets-2/src/test/java/com/baeldung/servlets/UserServletUnitTest.java 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"); + } + +} From 7f97acf36116b21c6b1077aae0f768f9257d795c Mon Sep 17 00:00:00 2001 From: Azhwani <13301425+azhwani@users.noreply.github.com> Date: Sun, 5 Jun 2022 17:26:59 +0200 Subject: [PATCH 36/40] BAEL-4469: Update Introduction to Mockito AdditionalAnswers (#12267) * init commit * improve test cases --- .../BookServiceUnitTest.java | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) 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); + } + } From 4c8b4485a4933f1a1ee9139e00a65239a90c5455 Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Mon, 6 Jun 2022 10:58:48 +0500 Subject: [PATCH 37/40] Updated README.md added link back to the article: https://www.baeldung.com/java-sort-list-alphabetically --- core-java-modules/core-java-collections-list-4/README.md | 1 + 1 file changed, 1 insertion(+) 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 09b61fa9b2..4c020969e3 100644 --- a/core-java-modules/core-java-collections-list-4/README.md +++ b/core-java-modules/core-java-collections-list-4/README.md @@ -5,4 +5,5 @@ 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) From be9d239af268781ae7dca7f1198ce256b7cbbd0f Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:30:14 +0500 Subject: [PATCH 38/40] Updated README.md added link back to the article: https://www.baeldung.com/ops/docker-compose-restart-policies --- spring-cloud-modules/spring-cloud-docker/README.md | 1 + 1 file changed, 1 insertion(+) 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) From 29a83bcc4a00b22504b8bbea3a45379eb32366af Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:40:36 +0500 Subject: [PATCH 39/40] Updated README.md added link back to the article: https://www.baeldung.com/java-bigdecimal-zero --- java-numbers-4/README.md | 1 + 1 file changed, 1 insertion(+) 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) From 164cfa7630242b96c3d7ec9ac16fc517d806b759 Mon Sep 17 00:00:00 2001 From: Asjad J <97493880+Asjad-J@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:45:42 +0500 Subject: [PATCH 40/40] Updated README.md added link back to the article: https://www.baeldung.com/java-httpservletrequest-mock --- javax-servlets-2/README.md | 1 + 1 file changed, 1 insertion(+) 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)