From 36be6908fe524b05ee79e491673483e9a3298cfb Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Thu, 12 Dec 2019 22:41:02 -0500 Subject: [PATCH 01/52] :construction: Gradle 6 - Publish Gradle Module Metadata --- gradle-6/.gitignore | 18 ++ gradle-6/build.gradle.kts | 15 ++ gradle-6/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58702 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + gradle-6/gradlew | 183 ++++++++++++++++++ gradle-6/gradlew.bat | 100 ++++++++++ gradle-6/settings.gradle.kts | 1 + .../java/com/baeldung/gradle/HelloWorld.java | 8 + 8 files changed, 330 insertions(+) create mode 100644 gradle-6/.gitignore create mode 100644 gradle-6/build.gradle.kts create mode 100644 gradle-6/gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle-6/gradle/wrapper/gradle-wrapper.properties create mode 100755 gradle-6/gradlew create mode 100644 gradle-6/gradlew.bat create mode 100644 gradle-6/settings.gradle.kts create mode 100644 gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java diff --git a/gradle-6/.gitignore b/gradle-6/.gitignore new file mode 100644 index 0000000000..75efe642c0 --- /dev/null +++ b/gradle-6/.gitignore @@ -0,0 +1,18 @@ + +# Gradle + +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + diff --git a/gradle-6/build.gradle.kts b/gradle-6/build.gradle.kts new file mode 100644 index 0000000000..8933572db7 --- /dev/null +++ b/gradle-6/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + `java-library` + `maven-publish` +} + +group = "com.baeldung" +version = "1.0.0" + +publishing { + publications { + register("mavenJava", MavenPublication::class) { + from(components["java"]) + } + } +} \ No newline at end of file diff --git a/gradle-6/gradle/wrapper/gradle-wrapper.jar b/gradle-6/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..cc4fdc293d0e50b0ad9b65c16e7ddd1db2f6025b GIT binary patch literal 58702 zcma&OV~}W3vL#%;<*Hk@ZQHhO+qTVHwr$(CZQFL$+?np4n10i5zVAmKMC6WrGGd+F zD|4@NHj-D$z)bJV;MYNJ&!D%)v-fQ%q0JG$_z5GVUJTPg0MHPf1TvicY#6DXYBBQ4M`$iC~gA;06+%@0HFQPLj-JXogAJ1j+fRqw^4M` zcW^RxAfl%+w9SiS>QwBUTAfuFAjPXc2DHf6*sr+V+jLQj^m@DQgHTPmAb@F z8%GyCfcQkhWWlT31%4$PtV4tV*LI?J#C4orYI~WU(cSR{aEs^ycxY`1>j1po>yDMi zh4W$pMaecV*mCsOsPLxQ#Xc!RXhpXy*p3S2Hl8t}H7x#p5V6G5va4jV;5^S^+>+x&#zzv4!R}wB;)TyU zE_N~}nN>DTG+uZns%_eI=DL1E#<--Sccx30gvMT}^eu`2-u|{qQZ58(rA2aBYE*ZD zm|*12zg*@J$n|tbH%Mp|d|O9W%VT~xG})R=Ld5z<(z%DOO6=MF3Xh-aF%9Hf$?1N9%8Pkev{wun$jZ2 z^i*EhRt8Ve<7`Wyz~iMZDye+XVn}O%qbhV`wHL+%P+n)K&-UMuZw^RRfeQ)%K=k*m zq5l7mf`4K_WkV5B73~MxajljrjGiJqpiV#>0FkyyrB)@HY!;Ln(7JJ*W(>d5#^ubU zVAkTMs*CHzzvUa^nRu0*f-(ek+VZw+@P~}a;;(K=|!9Mhv(~y-mlW);J zb&bB=vySHG`u?j&_6dh^*se*l_B3avjlE|!!Cb0pXyEXRbLy*@WEQ4|)M<`p8Q!rfDJ2RI!u1hPzNjy&)(kcY~GaD6?)7#dCbm`NFh?Y_g$#!+Qrie7%<7P}<-+W@{sxi4JYI{iY zk0(>m$DxOI=~-&eXf2bfh^&(U@o)>(iA1_wJ%B(+nFH+ceib%HEck32QL=J(BNFh`f>St1%llF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D613UA literal 0 HcmV?d00001 diff --git a/gradle-6/gradle/wrapper/gradle-wrapper.properties b/gradle-6/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..94920145f3 --- /dev/null +++ b/gradle-6/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradle-6/gradlew b/gradle-6/gradlew new file mode 100755 index 0000000000..2fe81a7d95 --- /dev/null +++ b/gradle-6/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradle-6/gradlew.bat b/gradle-6/gradlew.bat new file mode 100644 index 0000000000..24467a141f --- /dev/null +++ b/gradle-6/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/gradle-6/settings.gradle.kts b/gradle-6/settings.gradle.kts new file mode 100644 index 0000000000..8866408745 --- /dev/null +++ b/gradle-6/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "gradle-6" diff --git a/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java b/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java new file mode 100644 index 0000000000..4f947330eb --- /dev/null +++ b/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java @@ -0,0 +1,8 @@ +package com.baeldung.gradle; + +public class HelloWorld { + + public String sayHello() { + return "Hello, world!"; + } +} From f95a1a2011faca59d810c88cec07e7a3b710eb1f Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Tue, 17 Dec 2019 20:46:47 -0500 Subject: [PATCH 02/52] :construction: Gradle 6 - Dependency constraints --- gradle-6/build.gradle.kts | 29 ++++++++++++++++++- .../java/com/baeldung/gradle/HelloWorld.java | 8 ----- .../com/baeldung/gradle/RxHelloWorld.java | 18 ++++++++++++ .../baeldung/gradle/RxHelloWorldUnitTest.java | 14 +++++++++ 4 files changed, 60 insertions(+), 9 deletions(-) delete mode 100644 gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java create mode 100644 gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java create mode 100644 gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java diff --git a/gradle-6/build.gradle.kts b/gradle-6/build.gradle.kts index 8933572db7..d9876dfe28 100644 --- a/gradle-6/build.gradle.kts +++ b/gradle-6/build.gradle.kts @@ -6,9 +6,36 @@ plugins { group = "com.baeldung" version = "1.0.0" +repositories { + mavenCentral() +} + +dependencies { + api("io.reactivex.rxjava2:rxjava:2.2.16") + implementation("com.google.guava:guava") { + version { + require("2.0") + prefer("28.1-jre") + because("Only uses ImmutableList type, so any version since 2.0 will do, but tested with 28.1-jre") + } + } + + testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") +} + +tasks.compileJava { + sourceCompatibility = "1.8" + targetCompatibility = "1.8" +} + +tasks.test { + useJUnitPlatform() +} + publishing { publications { - register("mavenJava", MavenPublication::class) { + register("mavenJava") { from(components["java"]) } } diff --git a/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java b/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java deleted file mode 100644 index 4f947330eb..0000000000 --- a/gradle-6/src/main/java/com/baeldung/gradle/HelloWorld.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.gradle; - -public class HelloWorld { - - public String sayHello() { - return "Hello, world!"; - } -} diff --git a/gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java b/gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java new file mode 100644 index 0000000000..efb0ca3197 --- /dev/null +++ b/gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java @@ -0,0 +1,18 @@ +package com.baeldung.gradle; + +import com.google.common.collect.ImmutableList; +import io.reactivex.Observable; +import java.util.List; + +/** Demonstrates a library type that returns an RxJava type. */ +public class RxHelloWorld { + + /** @return an {@link Observable} that emits events "hello" and "world" before completing. */ + public static Observable hello() { + // Guava ImmutableList class is an implementation detail. + List values = ImmutableList.of("hello", "world"); + return Observable.fromIterable(values); + } + + private RxHelloWorld() {} +} diff --git a/gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java b/gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java new file mode 100644 index 0000000000..bc64148c64 --- /dev/null +++ b/gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.gradle; + +import static com.baeldung.gradle.RxHelloWorld.hello; + +import org.junit.jupiter.api.Test; + +/** Unit test for {@link RxHelloWorld}. */ +final class RxHelloWorldUnitTest { + + @Test + void it_emits_hello_world_values() { + hello().test().assertValues("hello", "world").assertComplete(); + } +} From 0c2d3121869be7ab0411fb5dbbbf9e1b777156fe Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Tue, 17 Dec 2019 21:18:54 -0500 Subject: [PATCH 03/52] :construction: Gradle 6 - Platforms --- gradle-6/.gitignore | 2 +- gradle-6/build.gradle.kts | 43 ++----------------- .../dependency-constraints/build.gradle.kts | 29 +++++++++++++ .../com/baeldung/gradle/RxHelloWorld.java | 0 .../baeldung/gradle/RxHelloWorldUnitTest.java | 0 gradle-6/httpclient-platform/build.gradle.kts | 11 +++++ .../build.gradle.kts | 12 ++++++ gradle-6/person-rest-client/build.gradle.kts | 8 ++++ gradle-6/settings.gradle.kts | 6 +++ gradle-6/widget-rest-client/build.gradle.kts | 8 ++++ 10 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 gradle-6/dependency-constraints/build.gradle.kts rename gradle-6/{ => dependency-constraints}/src/main/java/com/baeldung/gradle/RxHelloWorld.java (100%) rename gradle-6/{ => dependency-constraints}/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java (100%) create mode 100644 gradle-6/httpclient-platform/build.gradle.kts create mode 100644 gradle-6/module-metadata-publishing/build.gradle.kts create mode 100644 gradle-6/person-rest-client/build.gradle.kts create mode 100644 gradle-6/widget-rest-client/build.gradle.kts diff --git a/gradle-6/.gitignore b/gradle-6/.gitignore index 75efe642c0..6987887957 100644 --- a/gradle-6/.gitignore +++ b/gradle-6/.gitignore @@ -2,7 +2,7 @@ # Gradle .gradle -/build/ +build # Ignore Gradle GUI config gradle-app.setting diff --git a/gradle-6/build.gradle.kts b/gradle-6/build.gradle.kts index d9876dfe28..fb3c3f88a2 100644 --- a/gradle-6/build.gradle.kts +++ b/gradle-6/build.gradle.kts @@ -1,42 +1,5 @@ -plugins { - `java-library` - `maven-publish` -} - -group = "com.baeldung" -version = "1.0.0" - -repositories { - mavenCentral() -} - -dependencies { - api("io.reactivex.rxjava2:rxjava:2.2.16") - implementation("com.google.guava:guava") { - version { - require("2.0") - prefer("28.1-jre") - because("Only uses ImmutableList type, so any version since 2.0 will do, but tested with 28.1-jre") - } - } - - testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") -} - -tasks.compileJava { - sourceCompatibility = "1.8" - targetCompatibility = "1.8" -} - -tasks.test { - useJUnitPlatform() -} - -publishing { - publications { - register("mavenJava") { - from(components["java"]) - } +subprojects { + repositories { + mavenCentral() } } \ No newline at end of file diff --git a/gradle-6/dependency-constraints/build.gradle.kts b/gradle-6/dependency-constraints/build.gradle.kts new file mode 100644 index 0000000000..41336d3c91 --- /dev/null +++ b/gradle-6/dependency-constraints/build.gradle.kts @@ -0,0 +1,29 @@ +plugins { + `java-library` +} + +group = "com.baeldung" +version = "1.0.0" + +dependencies { + api("io.reactivex.rxjava2:rxjava:2.2.16") + implementation("com.google.guava:guava") { + version { + require("10.0") + prefer("28.1-jre") + because("Only uses ImmutableList type, so any version since 2.0 will do, but tested with 28.1-jre") + } + } + + testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") +} + +tasks.compileJava { + sourceCompatibility = "1.8" + targetCompatibility = "1.8" +} + +tasks.test { + useJUnitPlatform() +} diff --git a/gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java b/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java similarity index 100% rename from gradle-6/src/main/java/com/baeldung/gradle/RxHelloWorld.java rename to gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java diff --git a/gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java b/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java similarity index 100% rename from gradle-6/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java rename to gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java diff --git a/gradle-6/httpclient-platform/build.gradle.kts b/gradle-6/httpclient-platform/build.gradle.kts new file mode 100644 index 0000000000..a021bff013 --- /dev/null +++ b/gradle-6/httpclient-platform/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + `java-platform` +} + +dependencies { + constraints { + api("org.apache.httpcomponents:fluent-hc:4.5.10") + api("org.apache.httpcomponents:httpclient:4.5.10") + runtime("commons-logging:commons-logging:1.2") + } +} \ No newline at end of file diff --git a/gradle-6/module-metadata-publishing/build.gradle.kts b/gradle-6/module-metadata-publishing/build.gradle.kts new file mode 100644 index 0000000000..9812c72f6f --- /dev/null +++ b/gradle-6/module-metadata-publishing/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + java + `maven-publish` +} + +publishing { + publications { + register("mavenJava") { + from(components["java"]) + } + } +} \ No newline at end of file diff --git a/gradle-6/person-rest-client/build.gradle.kts b/gradle-6/person-rest-client/build.gradle.kts new file mode 100644 index 0000000000..c562b3e164 --- /dev/null +++ b/gradle-6/person-rest-client/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + `java-library` +} + +dependencies { + api(platform(project(":httpclient-platform"))) + implementation("org.apache.httpcomponents:fluent-hc") +} \ No newline at end of file diff --git a/gradle-6/settings.gradle.kts b/gradle-6/settings.gradle.kts index 8866408745..d84d0ff54e 100644 --- a/gradle-6/settings.gradle.kts +++ b/gradle-6/settings.gradle.kts @@ -1 +1,7 @@ rootProject.name = "gradle-6" + +include("dependency-constraints") +include("httpclient-platform") +include("module-metadata-publishing") +include("person-rest-client") +include("widget-rest-client") \ No newline at end of file diff --git a/gradle-6/widget-rest-client/build.gradle.kts b/gradle-6/widget-rest-client/build.gradle.kts new file mode 100644 index 0000000000..e1af4b7f71 --- /dev/null +++ b/gradle-6/widget-rest-client/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + `java-library` +} + +dependencies { + api(platform(project(":httpclient-platform"))) + implementation("org.apache.httpcomponents:httpclient") +} \ No newline at end of file From 99e94be7d0e4462735eeda36ea3e44265fa0be3a Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Tue, 17 Dec 2019 22:09:33 -0500 Subject: [PATCH 04/52] :construction: Gradle 6 - Test Fixtures --- gradle-6/fibonacci-recursive/build.gradle.kts | 17 ++++++++++ .../fibonacci/impl/RecursiveFibonacci.java | 20 ++++++++++++ .../impl/RecursiveFibonacciUnitTest.java | 16 ++++++++++ gradle-6/fibonacci-spi/build.gradle.kts | 13 ++++++++ .../fibonacci/FibonacciSequenceGenerator.java | 11 +++++++ .../FibonacciSequenceGeneratorFixture.java | 31 +++++++++++++++++++ gradle-6/gradle.properties | 1 + gradle-6/settings.gradle.kts | 2 ++ 8 files changed, 111 insertions(+) create mode 100644 gradle-6/fibonacci-recursive/build.gradle.kts create mode 100644 gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java create mode 100644 gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java create mode 100644 gradle-6/fibonacci-spi/build.gradle.kts create mode 100644 gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java create mode 100644 gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java create mode 100644 gradle-6/gradle.properties diff --git a/gradle-6/fibonacci-recursive/build.gradle.kts b/gradle-6/fibonacci-recursive/build.gradle.kts new file mode 100644 index 0000000000..0872a52472 --- /dev/null +++ b/gradle-6/fibonacci-recursive/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + `java-library` +} + +dependencies { + api(project(":fibonacci-spi")) + compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc6") + annotationProcessor("com.google.auto.service:auto-service:1.0-rc6") + + testImplementation(testFixtures(project(":fibonacci-spi"))) + testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") +} + +tasks.test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java new file mode 100644 index 0000000000..97eccde054 --- /dev/null +++ b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java @@ -0,0 +1,20 @@ +package com.baeldung.fibonacci.impl; + +import com.baeldung.fibonacci.FibonacciSequenceGenerator; +import com.google.auto.service.AutoService; + +/** Recursive implementation of the {@link FibonacciSequenceGenerator}. */ +@AutoService(FibonacciSequenceGenerator.class) +public final class RecursiveFibonacci implements FibonacciSequenceGenerator { + + @Override + public int generate(int nth) { + if (nth < 0) { + throw new IllegalArgumentException("sequence number must be 0 or greater"); + } + if (nth <= 1) { + return nth; + } + return generate(nth - 1) + generate(nth - 2); + } +} diff --git a/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java new file mode 100644 index 0000000000..1e46e75106 --- /dev/null +++ b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java @@ -0,0 +1,16 @@ +package com.baeldung.fibonacci.impl; + +import com.baeldung.fibonacci.FibonacciSequenceGenerator; +import com.baeldung.fibonacci.FibonacciSequenceGeneratorFixture; + +/** + * Unit test which reuses the {@link FibonacciSequenceGeneratorFixture} test mix-in exported from + * the fibonacci-spi project. + */ +final class RecursiveFibonacciUnitTest implements FibonacciSequenceGeneratorFixture { + + @Override + public FibonacciSequenceGenerator provide() { + return new RecursiveFibonacci(); + } +} diff --git a/gradle-6/fibonacci-spi/build.gradle.kts b/gradle-6/fibonacci-spi/build.gradle.kts new file mode 100644 index 0000000000..e571f329a9 --- /dev/null +++ b/gradle-6/fibonacci-spi/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + `java-library` + `java-test-fixtures` +} + +dependencies { + testFixturesApi("org.junit.jupiter:junit-jupiter-api:5.5.2") + testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.5.2") +} + +tasks.test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java new file mode 100644 index 0000000000..1e9de21257 --- /dev/null +++ b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java @@ -0,0 +1,11 @@ +package com.baeldung.fibonacci; + +/** Describes an SPI for a Fibonacci sequence generator function. */ +public interface FibonacciSequenceGenerator { + + /** + * @param nth the index of the number in the fibonacci sequence + * @return the nth number in the fibonacci sequence + */ + int generate(int nth); +} diff --git a/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java new file mode 100644 index 0000000000..0b7988f640 --- /dev/null +++ b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java @@ -0,0 +1,31 @@ +package com.baeldung.fibonacci; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +/** + * Reusable test fixture for {@link FibonacciSequenceGenerator} implementations. Tests will be + * skipped if no such implementation exists. + */ +public interface FibonacciSequenceGeneratorFixture { + + /** @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null */ + FibonacciSequenceGenerator provide(); + + @Test + default void when_sequence_index_is_negative_then_throws() { + final FibonacciSequenceGenerator generator = provide(); + assertThrows(IllegalArgumentException.class, () -> generator.generate(-1)); + } + + @Test + default void when_given_index_then_generates_fibonacci_number() { + final FibonacciSequenceGenerator generator = provide(); + final int[] sequence = {0, 1, 1, 2, 3, 5, 8}; + for (int i = 0; i < sequence.length; i++) { + assertEquals(sequence[i], generator.generate(i)); + } + } +} diff --git a/gradle-6/gradle.properties b/gradle-6/gradle.properties new file mode 100644 index 0000000000..f97ebb7d33 --- /dev/null +++ b/gradle-6/gradle.properties @@ -0,0 +1 @@ +org.gradle.parallel=true diff --git a/gradle-6/settings.gradle.kts b/gradle-6/settings.gradle.kts index d84d0ff54e..babe431175 100644 --- a/gradle-6/settings.gradle.kts +++ b/gradle-6/settings.gradle.kts @@ -1,6 +1,8 @@ rootProject.name = "gradle-6" include("dependency-constraints") +include("fibonacci-spi") +include("fibonacci-recursive") include("httpclient-platform") include("module-metadata-publishing") include("person-rest-client") From dfb9147fc91d6a8b565a4f4075b6624b9870b315 Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Fri, 20 Dec 2019 09:50:52 -0500 Subject: [PATCH 05/52] :construction: Gradle 6 - Task Configuration Avoidance --- .../configuration-avoidance/build.gradle.kts | 37 +++++++++++++++++++ gradle-6/gradle.properties | 1 + gradle-6/settings.gradle.kts | 1 + 3 files changed, 39 insertions(+) create mode 100644 gradle-6/configuration-avoidance/build.gradle.kts diff --git a/gradle-6/configuration-avoidance/build.gradle.kts b/gradle-6/configuration-avoidance/build.gradle.kts new file mode 100644 index 0000000000..e84f08bf93 --- /dev/null +++ b/gradle-6/configuration-avoidance/build.gradle.kts @@ -0,0 +1,37 @@ +plugins { + base +} + +description = """ + Demonstrates Gradle Configuraiton Avoidance API. Creates a new configuration "extralibs" to + which we add dependencies. The custom task "copyExtraLibs" copies those dependencies to a new + build directory "extra-libs". This build uses the Task Configuraion Avoidance APIs which have + been marked stable in Gradle 6.0 +""".trimIndent() + +// extraLibs is a NamedDomainObjectProvider - the Configuration object will not be +// realized until it is needed. In the meantime, the build may reference it by name +val extralibs by configurations.registering + +dependencies { + // we can call extralibs.name without causing the extralibs to be realized + add(extralibs.name, "junit:junit:4.12") +} + +// extraLibsDir is a Provider - the Directory object will not be realized until it is +// needed +val extraLibsDir = project.layout.buildDirectory.dir("extra-libs") + +// copyExtraLibs is a TaskProvider - the task will not be realized until it is needed +val copyExtraLibs by tasks.registering(Copy::class) { + // the copy task's "from" and "into" APIs accept Provider types to support configuration + // avoidance + from(extralibs) + into(extraLibsDir) +} + +// configures the "build" task only if it needs to be +tasks.build { + // dependsOn accepts a TaskProvider to avoid realizing the copyExtraLibs needlessly + dependsOn(copyExtraLibs) +} diff --git a/gradle-6/gradle.properties b/gradle-6/gradle.properties index f97ebb7d33..7da8b3d72a 100644 --- a/gradle-6/gradle.properties +++ b/gradle-6/gradle.properties @@ -1 +1,2 @@ org.gradle.parallel=true +org.gradle.configureondemand=true diff --git a/gradle-6/settings.gradle.kts b/gradle-6/settings.gradle.kts index babe431175..88cf74c4d7 100644 --- a/gradle-6/settings.gradle.kts +++ b/gradle-6/settings.gradle.kts @@ -1,5 +1,6 @@ rootProject.name = "gradle-6" +include("configuration-avoidance") include("dependency-constraints") include("fibonacci-spi") include("fibonacci-recursive") From 3a26ab34603c4617d2fabd4cc5b7e26a0b04cb94 Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Fri, 20 Dec 2019 12:23:13 -0500 Subject: [PATCH 06/52] :art: Gradle 6 - Format code --- .../com/baeldung/gradle/RxHelloWorld.java | 16 ++++++---- .../baeldung/gradle/RxHelloWorldUnitTest.java | 11 +++---- .../fibonacci/impl/RecursiveFibonacci.java | 20 ++++++------ .../impl/RecursiveFibonacciUnitTest.java | 8 ++--- .../fibonacci/FibonacciSequenceGenerator.java | 10 +++--- .../FibonacciSequenceGeneratorFixture.java | 32 +++++++++---------- 6 files changed, 46 insertions(+), 51 deletions(-) diff --git a/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java b/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java index efb0ca3197..1c4e71541d 100644 --- a/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java +++ b/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java @@ -2,17 +2,19 @@ package com.baeldung.gradle; import com.google.common.collect.ImmutableList; import io.reactivex.Observable; + import java.util.List; /** Demonstrates a library type that returns an RxJava type. */ public class RxHelloWorld { - /** @return an {@link Observable} that emits events "hello" and "world" before completing. */ - public static Observable hello() { - // Guava ImmutableList class is an implementation detail. - List values = ImmutableList.of("hello", "world"); - return Observable.fromIterable(values); - } + /** @return an {@link Observable} that emits events "hello" and "world" before completing. */ + public static Observable hello() { + // Guava ImmutableList class is an implementation detail. + List values = ImmutableList.of("hello", "world"); + return Observable.fromIterable(values); + } - private RxHelloWorld() {} + private RxHelloWorld() { + } } diff --git a/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java b/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java index bc64148c64..232c7d7e02 100644 --- a/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java +++ b/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java @@ -1,14 +1,13 @@ package com.baeldung.gradle; -import static com.baeldung.gradle.RxHelloWorld.hello; - import org.junit.jupiter.api.Test; +import static com.baeldung.gradle.RxHelloWorld.hello; + /** Unit test for {@link RxHelloWorld}. */ final class RxHelloWorldUnitTest { - @Test - void it_emits_hello_world_values() { - hello().test().assertValues("hello", "world").assertComplete(); - } + @Test void it_emits_hello_world_values() { + hello().test().assertValues("hello", "world").assertComplete(); + } } diff --git a/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java index 97eccde054..764f4ad12c 100644 --- a/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java +++ b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java @@ -4,17 +4,15 @@ import com.baeldung.fibonacci.FibonacciSequenceGenerator; import com.google.auto.service.AutoService; /** Recursive implementation of the {@link FibonacciSequenceGenerator}. */ -@AutoService(FibonacciSequenceGenerator.class) -public final class RecursiveFibonacci implements FibonacciSequenceGenerator { +@AutoService(FibonacciSequenceGenerator.class) public final class RecursiveFibonacci implements FibonacciSequenceGenerator { - @Override - public int generate(int nth) { - if (nth < 0) { - throw new IllegalArgumentException("sequence number must be 0 or greater"); + @Override public int generate(int nth) { + if (nth < 0) { + throw new IllegalArgumentException("sequence number must be 0 or greater"); + } + if (nth <= 1) { + return nth; + } + return generate(nth - 1) + generate(nth - 2); } - if (nth <= 1) { - return nth; - } - return generate(nth - 1) + generate(nth - 2); - } } diff --git a/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java index 1e46e75106..0703c97848 100644 --- a/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java +++ b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java @@ -8,9 +8,7 @@ import com.baeldung.fibonacci.FibonacciSequenceGeneratorFixture; * the fibonacci-spi project. */ final class RecursiveFibonacciUnitTest implements FibonacciSequenceGeneratorFixture { - - @Override - public FibonacciSequenceGenerator provide() { - return new RecursiveFibonacci(); - } + @Override public FibonacciSequenceGenerator provide() { + return new RecursiveFibonacci(); + } } diff --git a/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java index 1e9de21257..e152b7b515 100644 --- a/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java +++ b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java @@ -3,9 +3,9 @@ package com.baeldung.fibonacci; /** Describes an SPI for a Fibonacci sequence generator function. */ public interface FibonacciSequenceGenerator { - /** - * @param nth the index of the number in the fibonacci sequence - * @return the nth number in the fibonacci sequence - */ - int generate(int nth); + /** + * @param nth the index of the number in the fibonacci sequence + * @return the nth number in the fibonacci sequence + */ + int generate(int nth); } diff --git a/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java index 0b7988f640..e5bfe8117b 100644 --- a/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java +++ b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java @@ -1,31 +1,29 @@ package com.baeldung.fibonacci; +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.jupiter.api.Test; - /** * Reusable test fixture for {@link FibonacciSequenceGenerator} implementations. Tests will be * skipped if no such implementation exists. */ public interface FibonacciSequenceGeneratorFixture { - /** @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null */ - FibonacciSequenceGenerator provide(); + /** @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null */ + FibonacciSequenceGenerator provide(); - @Test - default void when_sequence_index_is_negative_then_throws() { - final FibonacciSequenceGenerator generator = provide(); - assertThrows(IllegalArgumentException.class, () -> generator.generate(-1)); - } - - @Test - default void when_given_index_then_generates_fibonacci_number() { - final FibonacciSequenceGenerator generator = provide(); - final int[] sequence = {0, 1, 1, 2, 3, 5, 8}; - for (int i = 0; i < sequence.length; i++) { - assertEquals(sequence[i], generator.generate(i)); + @Test default void when_sequence_index_is_negative_then_throws() { + final FibonacciSequenceGenerator generator = provide(); + assertThrows(IllegalArgumentException.class, () -> generator.generate(-1)); + } + + @Test default void when_given_index_then_generates_fibonacci_number() { + final FibonacciSequenceGenerator generator = provide(); + final int[] sequence = { 0, 1, 1, 2, 3, 5, 8 }; + for (int i = 0; i < sequence.length; i++) { + assertEquals(sequence[i], generator.generate(i)); + } } - } } From b9331afc8fad2e55c0051643e1fc3684da0cf15c Mon Sep 17 00:00:00 2001 From: Johnathan Gilday Date: Tue, 31 Dec 2019 11:17:56 -0500 Subject: [PATCH 07/52] :art: Gradle-6 Format JavaDoc --- .../src/main/java/com/baeldung/gradle/RxHelloWorld.java | 8 ++++++-- .../java/com/baeldung/gradle/RxHelloWorldUnitTest.java | 5 +++-- .../com/baeldung/fibonacci/impl/RecursiveFibonacci.java | 4 +++- .../fibonacci/impl/RecursiveFibonacciUnitTest.java | 3 +-- .../baeldung/fibonacci/FibonacciSequenceGenerator.java | 4 +++- .../fibonacci/FibonacciSequenceGeneratorFixture.java | 7 ++++--- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java b/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java index 1c4e71541d..e4ebd9ba6b 100644 --- a/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java +++ b/gradle-6/dependency-constraints/src/main/java/com/baeldung/gradle/RxHelloWorld.java @@ -5,10 +5,14 @@ import io.reactivex.Observable; import java.util.List; -/** Demonstrates a library type that returns an RxJava type. */ +/** + * Demonstrates a library type that returns an RxJava type. + */ public class RxHelloWorld { - /** @return an {@link Observable} that emits events "hello" and "world" before completing. */ + /** + * @return an {@link Observable} that emits events "hello" and "world" before completing. + */ public static Observable hello() { // Guava ImmutableList class is an implementation detail. List values = ImmutableList.of("hello", "world"); diff --git a/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java b/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java index 232c7d7e02..8a05fcfda3 100644 --- a/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java +++ b/gradle-6/dependency-constraints/src/test/java/com/baeldung/gradle/RxHelloWorldUnitTest.java @@ -4,9 +4,10 @@ import org.junit.jupiter.api.Test; import static com.baeldung.gradle.RxHelloWorld.hello; -/** Unit test for {@link RxHelloWorld}. */ +/** + * Unit test for {@link RxHelloWorld}. + */ final class RxHelloWorldUnitTest { - @Test void it_emits_hello_world_values() { hello().test().assertValues("hello", "world").assertComplete(); } diff --git a/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java index 764f4ad12c..def79521bd 100644 --- a/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java +++ b/gradle-6/fibonacci-recursive/src/main/java/com/baeldung/fibonacci/impl/RecursiveFibonacci.java @@ -3,7 +3,9 @@ package com.baeldung.fibonacci.impl; import com.baeldung.fibonacci.FibonacciSequenceGenerator; import com.google.auto.service.AutoService; -/** Recursive implementation of the {@link FibonacciSequenceGenerator}. */ +/** + * Recursive implementation of the {@link FibonacciSequenceGenerator}. + */ @AutoService(FibonacciSequenceGenerator.class) public final class RecursiveFibonacci implements FibonacciSequenceGenerator { @Override public int generate(int nth) { diff --git a/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java index 0703c97848..766f3b251b 100644 --- a/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java +++ b/gradle-6/fibonacci-recursive/src/test/java/com/baeldung/fibonacci/impl/RecursiveFibonacciUnitTest.java @@ -4,8 +4,7 @@ import com.baeldung.fibonacci.FibonacciSequenceGenerator; import com.baeldung.fibonacci.FibonacciSequenceGeneratorFixture; /** - * Unit test which reuses the {@link FibonacciSequenceGeneratorFixture} test mix-in exported from - * the fibonacci-spi project. + * Unit test which reuses the {@link FibonacciSequenceGeneratorFixture} test mix-in exported from the fibonacci-spi project. */ final class RecursiveFibonacciUnitTest implements FibonacciSequenceGeneratorFixture { @Override public FibonacciSequenceGenerator provide() { diff --git a/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java index e152b7b515..5fd99100fc 100644 --- a/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java +++ b/gradle-6/fibonacci-spi/src/main/java/com/baeldung/fibonacci/FibonacciSequenceGenerator.java @@ -1,6 +1,8 @@ package com.baeldung.fibonacci; -/** Describes an SPI for a Fibonacci sequence generator function. */ +/** + * Describes an SPI for a Fibonacci sequence generator function. + */ public interface FibonacciSequenceGenerator { /** diff --git a/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java index e5bfe8117b..5394590c03 100644 --- a/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java +++ b/gradle-6/fibonacci-spi/src/testFixtures/java/com/baeldung/fibonacci/FibonacciSequenceGeneratorFixture.java @@ -6,12 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; /** - * Reusable test fixture for {@link FibonacciSequenceGenerator} implementations. Tests will be - * skipped if no such implementation exists. + * Reusable test fixture for {@link FibonacciSequenceGenerator} implementations. Tests will be skipped if no such implementation exists. */ public interface FibonacciSequenceGeneratorFixture { - /** @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null */ + /** + * @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null + */ FibonacciSequenceGenerator provide(); @Test default void when_sequence_index_is_negative_then_throws() { From bd581da50b95708f61371db6094fa48b7b0c0725 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 26 Jan 2020 17:43:33 +0200 Subject: [PATCH 08/52] BAEL-3502 Arrays.deepEquals examples. --- .../arrays/ArraysDeepEqualsUnitTest.java | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java diff --git a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java new file mode 100644 index 0000000000..4998886215 --- /dev/null +++ b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java @@ -0,0 +1,97 @@ +package com.baeldung.arrays; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Objects; + +import org.junit.jupiter.api.Test; + +public class ArraysDeepEqualsUnitTest { + + class Person { + private int id; + private String name; + private int age; + + Person(int id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Person)) + return false; + Person person = (Person) obj; + return id == person.id && name.equals(person.name) && age == person.age; + } + + @Override + public int hashCode() { + return Objects.hash(id, name, age); + } + } + + @Test + void givenTwoUnidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", "string2", "string3" }; + Object[] anotherArray = new Object[] { "string1", "string2", "string3" }; + + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNullElements_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", null, "string3" }; + Object[] anotherArray = new Object[] { "string1", null, "string3" }; + + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNestedElements_whenUsingEqualsAndDeepEquals_thenShouldReturnDifferently() { + Object[] anArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + Object[] anotherArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoMultidimensionalPrimitiveTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + int[][] anArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + int[][] anotherArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + + assertFalse(Arrays.equals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } + + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + + assertTrue(Objects.deepEquals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } +} From a1837550e83c26bbcf3ea754732404c2955ee8ef Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Mon, 27 Jan 2020 20:40:24 +0200 Subject: [PATCH 09/52] BAEL-3777: First setup --- ddd/pom.xml | 8 ++++++- .../configuration/CassandraConfiguration.java | 10 ++++++++ .../configuration/MongoDBConfiguration.java | 4 ++-- .../CassandraDbOrderRepository.java | 23 +++++++++++++++++++ .../repository/MongoDbOrderRepository.java | 4 ++-- .../SpringDataCassandraOrderRepository.java | 11 +++++++++ ...va => SpringDataMongoOrderRepository.java} | 2 +- ddd/src/main/resources/ddd-layers.properties | 8 ++++++- .../MongoDbOrderRepositoryUnitTest.java | 4 ++-- .../dddhexagonalspring/docker-compose.yml | 7 +++++- 10 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{SpringDataOrderRepository.java => SpringDataMongoOrderRepository.java} (76%) diff --git a/ddd/pom.xml b/ddd/pom.xml index 9a0523a4c6..0893523c3b 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -20,14 +20,20 @@ org.springframework.boot spring-boot-starter-data-mongodb + + org.springframework.boot + spring-boot-starter-data-cassandra + org.junit.jupiter junit-jupiter-api + 5.6.0 test org.junit.jupiter junit-jupiter-engine + 5.6.0 test @@ -35,7 +41,7 @@ org.junit.platform junit-platform-launcher - ${junit-platform.version} + 1.6.0 test diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java new file mode 100644 index 0000000000..76d7ad1aee --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java @@ -0,0 +1,10 @@ +package com.baeldung.dddhexagonalspring.infrastracture.configuration; + +import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories; + +import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataCassandraOrderRepository; + +@EnableCassandraRepositories(basePackageClasses = SpringDataCassandraOrderRepository.class) +public class CassandraConfiguration { + +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java index fd76b2eb0e..e0f5e77671 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java @@ -1,8 +1,8 @@ package com.baeldung.dddhexagonalspring.infrastracture.configuration; -import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataOrderRepository; +import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataMongoOrderRepository; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -@EnableMongoRepositories(basePackageClasses = SpringDataOrderRepository.class) +@EnableMongoRepositories(basePackageClasses = SpringDataMongoOrderRepository.class) public class MongoDBConfiguration { } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java new file mode 100644 index 0000000000..f16a546576 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java @@ -0,0 +1,23 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import java.util.Optional; +import java.util.UUID; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; + +public class CassandraDbOrderRepository implements OrderRepository { + + @Override + public Optional findById(UUID id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void save(Order order) { + // TODO Auto-generated method stub + + } + +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java index 3123ef3e2f..bde0007ced 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java @@ -11,10 +11,10 @@ import java.util.UUID; @Component public class MongoDbOrderRepository implements OrderRepository { - private final SpringDataOrderRepository orderRepository; + private final SpringDataMongoOrderRepository orderRepository; @Autowired - public MongoDbOrderRepository(final SpringDataOrderRepository orderRepository) { + public MongoDbOrderRepository(final SpringDataMongoOrderRepository orderRepository) { this.orderRepository = orderRepository; } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java new file mode 100644 index 0000000000..9df128f035 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import java.util.UUID; + +import org.springframework.data.cassandra.repository.CassandraRepository; + +import com.baeldung.dddhexagonalspring.domain.Order; + +public interface SpringDataCassandraOrderRepository extends CassandraRepository{ + +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java similarity index 76% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java index 0279a5ce4a..620ecb34af 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java @@ -7,5 +7,5 @@ import org.springframework.stereotype.Repository; import java.util.UUID; @Repository -public interface SpringDataOrderRepository extends MongoRepository { +public interface SpringDataMongoOrderRepository extends MongoRepository { } diff --git a/ddd/src/main/resources/ddd-layers.properties b/ddd/src/main/resources/ddd-layers.properties index 0479996b17..3b2aa35efe 100644 --- a/ddd/src/main/resources/ddd-layers.properties +++ b/ddd/src/main/resources/ddd-layers.properties @@ -2,4 +2,10 @@ spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 spring.data.mongodb.database=order-database spring.data.mongodb.username=order -spring.data.mongodb.password=order \ No newline at end of file +spring.data.mongodb.password=order + +spring.data.cassandra.keyspaceName=order-database +spring.data.cassandra.username=cassandra +spring.data.cassandra.password=cassandra +spring.data.cassandra.contactPoints=localhost +spring.data.cassandra.port=9042 \ No newline at end of file diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java index 8f7e8260a3..8247d7c7bd 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java @@ -14,12 +14,12 @@ import static org.mockito.Mockito.*; class MongoDbOrderRepositoryUnitTest { - private SpringDataOrderRepository springDataOrderRepository; + private SpringDataMongoOrderRepository springDataOrderRepository; private MongoDbOrderRepository tested; @BeforeEach void setUp(){ - springDataOrderRepository = mock(SpringDataOrderRepository.class); + springDataOrderRepository = mock(SpringDataMongoOrderRepository.class); tested = new MongoDbOrderRepository(springDataOrderRepository); } diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml index d85ddf4a0e..dfad875a2b 100644 --- a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml @@ -11,4 +11,9 @@ services: MONGO_INITDB_ROOT_PASSWORD: admin MONGO_INITDB_DATABASE: order-database volumes: - - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro \ No newline at end of file + - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro + order-cassandra-database: + image: cassandra:3.11.5 + restart: always + ports: + - 9042:9042 \ No newline at end of file From 8144040512b45445879570c4ac2b7a331e24b287 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Mon, 27 Jan 2020 21:14:55 +0200 Subject: [PATCH 10/52] BAEL-3777: Fixed some spring init issues --- .../repository/CassandraDbOrderRepository.java | 11 +++++++++++ .../repository/MongoDbOrderRepository.java | 2 ++ .../SpringDataCassandraOrderRepository.java | 2 ++ ddd/src/main/resources/ddd-layers.properties | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java index f16a546576..a648a1f041 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java @@ -3,11 +3,22 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository; import java.util.Optional; import java.util.UUID; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +@Component public class CassandraDbOrderRepository implements OrderRepository { + private final SpringDataCassandraOrderRepository orderRepository; + + @Autowired + public CassandraDbOrderRepository(SpringDataCassandraOrderRepository orderRepository) { + this.orderRepository = orderRepository; + } + @Override public Optional findById(UUID id) { // TODO Auto-generated method stub diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java index bde0007ced..cf1d900821 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java @@ -3,12 +3,14 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import java.util.Optional; import java.util.UUID; @Component +@Primary public class MongoDbOrderRepository implements OrderRepository { private final SpringDataMongoOrderRepository orderRepository; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java index 9df128f035..dd7c7dbc81 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java @@ -3,9 +3,11 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository; import java.util.UUID; import org.springframework.data.cassandra.repository.CassandraRepository; +import org.springframework.stereotype.Repository; import com.baeldung.dddhexagonalspring.domain.Order; +@Repository public interface SpringDataCassandraOrderRepository extends CassandraRepository{ } diff --git a/ddd/src/main/resources/ddd-layers.properties b/ddd/src/main/resources/ddd-layers.properties index 3b2aa35efe..d0ad343b66 100644 --- a/ddd/src/main/resources/ddd-layers.properties +++ b/ddd/src/main/resources/ddd-layers.properties @@ -4,7 +4,7 @@ spring.data.mongodb.database=order-database spring.data.mongodb.username=order spring.data.mongodb.password=order -spring.data.cassandra.keyspaceName=order-database +spring.data.cassandra.keyspaceName=order_database spring.data.cassandra.username=cassandra spring.data.cassandra.password=cassandra spring.data.cassandra.contactPoints=localhost From 1981d10ffdf1f6cf0c10547de0014274a437bdf3 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Thu, 30 Jan 2020 18:55:50 +0200 Subject: [PATCH 11/52] BAEL-3777: Bumped spring boot version --- ddd/pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ddd/pom.xml b/ddd/pom.xml index 0893523c3b..817e3b8899 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -27,13 +27,11 @@ org.junit.jupiter junit-jupiter-api - 5.6.0 test org.junit.jupiter junit-jupiter-engine - 5.6.0 test @@ -41,7 +39,6 @@ org.junit.platform junit-platform-launcher - 1.6.0 test @@ -96,7 +93,7 @@ 1.0.1 - 2.0.6.RELEASE + 2.2.4.RELEASE \ No newline at end of file From b05d42a6ea2246d803414d73a2d79dc46480bd4c Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Fri, 31 Jan 2020 23:32:37 +0200 Subject: [PATCH 12/52] BAEL-3777: Working version --- .../dddhexagonalspring/domain/Order.java | 17 +++++ .../CassandraDbOrderRepository.java | 15 ++-- .../repository/MongoDbOrderRepository.java | 1 - .../repository/OrderEntity.java | 75 +++++++++++++++++++ .../repository/OrderItemEntity.java | 44 +++++++++++ .../SpringDataCassandraOrderRepository.java | 2 +- ...andraDbOrderRepositoryIntegrationTest.java | 55 ++++++++++++++ ...MongoDbOrderRepositoryIntegrationTest.java | 54 +++++++++++++ .../baeldung/dddhexagonalspring/cassandra.cql | 12 +++ .../test/resources/ddd-layers-test.properties | 12 +++ 10 files changed, 280 insertions(+), 7 deletions(-) create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java create mode 100644 ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java create mode 100644 ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java create mode 100644 ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql create mode 100644 ddd/src/test/resources/ddd-layers-test.properties diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java index 7d40007411..5ddc0f3500 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.UUID; public class Order { @@ -77,6 +78,22 @@ public class Order { return Collections.unmodifiableList(orderItems); } + + @Override + public int hashCode() { + return Objects.hash(id, orderItems, price, status); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!(obj instanceof Order)) + return false; + Order other = (Order) obj; + return Objects.equals(id, other.id) && Objects.equals(orderItems, other.orderItems) && Objects.equals(price, other.price) && status == other.status; + } + private Order() { } } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java index a648a1f041..c0aff0e11f 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java @@ -4,16 +4,18 @@ import java.util.Optional; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; @Component +@Primary public class CassandraDbOrderRepository implements OrderRepository { private final SpringDataCassandraOrderRepository orderRepository; - + @Autowired public CassandraDbOrderRepository(SpringDataCassandraOrderRepository orderRepository) { this.orderRepository = orderRepository; @@ -21,14 +23,17 @@ public class CassandraDbOrderRepository implements OrderRepository { @Override public Optional findById(UUID id) { - // TODO Auto-generated method stub - return null; + Optional orderEntity = orderRepository.findById(id); + if (orderEntity.isPresent()) { + return Optional.of(orderEntity.get().toOrder()); + } else { + return Optional.empty(); + } } @Override public void save(Order order) { - // TODO Auto-generated method stub - + orderRepository.save(new OrderEntity(order)); } } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java index cf1d900821..61ab93b707 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java @@ -10,7 +10,6 @@ import java.util.Optional; import java.util.UUID; @Component -@Primary public class MongoDbOrderRepository implements OrderRepository { private final SpringDataMongoOrderRepository orderRepository; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java new file mode 100644 index 0000000000..30c162a8ab --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java @@ -0,0 +1,75 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import java.math.BigDecimal; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.springframework.data.cassandra.core.mapping.PrimaryKey; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.OrderItem; +import com.baeldung.dddhexagonalspring.domain.OrderStatus; +import com.baeldung.dddhexagonalspring.domain.Product; + +public class OrderEntity { + + @PrimaryKey + private UUID id; + private OrderStatus status; + private List orderItemEntities; + private BigDecimal price; + + public OrderEntity(UUID id, OrderStatus status, List orderItemEntities, BigDecimal price) { + this.id = id; + this.status = status; + this.orderItemEntities = orderItemEntities; + this.price = price; + } + + public OrderEntity() { + } + + public OrderEntity(Order order) { + this.id = order.getId(); + this.price = order.getPrice(); + this.status = order.getStatus(); + this.orderItemEntities = order.getOrderItems() + .stream() + .map(OrderItemEntity::new) + .collect(Collectors.toList()); + + } + + public Order toOrder() { + List orderItems = orderItemEntities.stream() + .map(OrderItemEntity::toOrderItem) + .collect(Collectors.toList()); + List namelessProducts = orderItems.stream() + .map(orderItem -> new Product(orderItem.getProductId(), orderItem.getPrice(), "")) + .collect(Collectors.toList()); + Order order = new Order(id, namelessProducts.remove(0)); + namelessProducts.forEach(product -> order.addOrder(product)); + if (status == OrderStatus.COMPLETED) { + order.complete(); + } + return order; + } + + public UUID getId() { + return id; + } + + public OrderStatus getStatus() { + return status; + } + + public List getOrderItems() { + return orderItemEntities; + } + + public BigDecimal getPrice() { + return price; + } + +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java new file mode 100644 index 0000000000..44af65b842 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java @@ -0,0 +1,44 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import java.math.BigDecimal; +import java.util.UUID; + +import org.springframework.data.cassandra.core.mapping.UserDefinedType; + +import com.baeldung.dddhexagonalspring.domain.OrderItem; +import com.baeldung.dddhexagonalspring.domain.Product; + +@UserDefinedType +public class OrderItemEntity { + + private UUID productId; + private BigDecimal price; + + public OrderItemEntity() { + } + + public OrderItemEntity(final OrderItem orderItem) { + this.productId = orderItem.getProductId(); + this.price = orderItem.getPrice(); + } + + public OrderItem toOrderItem() { + return new OrderItem(new Product(productId, price, "")); + } + + public UUID getProductId() { + return productId; + } + + public void setProductId(UUID productId) { + this.productId = productId; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java index dd7c7dbc81..eed265e877 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java @@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository; import com.baeldung.dddhexagonalspring.domain.Order; @Repository -public interface SpringDataCassandraOrderRepository extends CassandraRepository{ +public interface SpringDataCassandraOrderRepository extends CassandraRepository{ } diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java new file mode 100644 index 0000000000..aa1c8af43d --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java @@ -0,0 +1,55 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.Optional; +import java.util.UUID; + +import org.junit.After; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; + +@SpringJUnitConfig +@SpringBootTest +@TestPropertySource("classpath:ddd-layers-test.properties") +class CassandraDbOrderRepositoryIntegrationTest { + + @Autowired + private SpringDataCassandraOrderRepository cassandraOrderRepository; + + @Autowired + private OrderRepository orderRepository; + + @After + void cleanUp(){ + cassandraOrderRepository.deleteAll(); + } + + @Test + void shouldFindById_thenReturnOrder() { + + // given + final UUID id = UUID.randomUUID(); + final Order order = createOrder(id); + order.complete(); + + // when + orderRepository.save(order); + + final Optional result = orderRepository.findById(id); + + assertEquals(order, result.get()); + } + + private Order createOrder(UUID id) { + return new Order(id, new Product(UUID.randomUUID(), BigDecimal.TEN, "product")); + } +} \ No newline at end of file diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java new file mode 100644 index 0000000000..538fff0b51 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java @@ -0,0 +1,54 @@ +package com.baeldung.dddhexagonalspring.infrastracture.repository; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.Optional; +import java.util.UUID; + +import org.junit.After; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; + +@SpringJUnitConfig +@SpringBootTest +@TestPropertySource("classpath:ddd-layers-test.properties") +class MongoDbOrderRepositoryIntegrationTest { + + @Autowired + private SpringDataMongoOrderRepository mongoOrderRepository; + + @Autowired + private OrderRepository orderRepository; + + @After + void cleanUp(){ + mongoOrderRepository.deleteAll(); + } + + @Test + void shouldFindById_thenReturnOrder() { + + // given + final UUID id = UUID.randomUUID(); + final Order order = createOrder(id); + + // when + orderRepository.save(order); + + final Optional result = orderRepository.findById(id); + + assertEquals(order, result.get()); + } + + private Order createOrder(UUID id) { + return new Order(id, new Product(UUID.randomUUID(), BigDecimal.TEN, "product")); + } +} \ No newline at end of file diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql new file mode 100644 index 0000000000..7adeda0a51 --- /dev/null +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql @@ -0,0 +1,12 @@ +CREATE KEYSPACE IF NOT exists order_database +WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}; + +CREATE TYPE order_database.orderitementity (productid uuid, price decimal); + +CREATE TABLE order_database.orderentity( + id uuid, + status text, + orderitementities list>, + price decimal, + primary key(id) +); diff --git a/ddd/src/test/resources/ddd-layers-test.properties b/ddd/src/test/resources/ddd-layers-test.properties new file mode 100644 index 0000000000..32307581aa --- /dev/null +++ b/ddd/src/test/resources/ddd-layers-test.properties @@ -0,0 +1,12 @@ +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration +spring.data.mongodb.host=127.0.0.1 +spring.data.mongodb.port=27017 +spring.data.mongodb.database=order-database +spring.data.mongodb.username=order +spring.data.mongodb.password=order + +spring.data.cassandra.keyspaceName=order_database +spring.data.cassandra.username=cassandra +spring.data.cassandra.password=cassandra +spring.data.cassandra.contactPoints=127.0.0.1 +spring.data.cassandra.port=9042 \ No newline at end of file From 8b49858bfe0de80b946a9666bb43f865f160cdc0 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 11:47:00 +0200 Subject: [PATCH 13/52] BAEL-3777: Fixed formatting --- .../dddhexagonalspring/domain/Order.java | 15 ++++++--------- .../configuration/CassandraConfiguration.java | 2 +- .../configuration/MongoDBConfiguration.java | 3 ++- .../CassandraDbOrderRepository.java | 2 +- .../repository/{ => cassandra}/OrderEntity.java | 2 +- .../{ => cassandra}/OrderItemEntity.java | 2 +- .../SpringDataCassandraOrderRepository.java | 2 +- .../{ => mongo}/MongoDbOrderRepository.java | 2 +- .../SpringDataMongoOrderRepository.java | 2 +- ...assandraDbOrderRepositoryIntegrationTest.java | 16 +++++++++------- .../MongoDbOrderRepositoryIntegrationTest.java | 15 ++++++++------- .../MongoDbOrderRepositoryUnitTest.java | 5 ++++- 12 files changed, 36 insertions(+), 32 deletions(-) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => cassandra}/CassandraDbOrderRepository.java (98%) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => cassandra}/OrderEntity.java (99%) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => cassandra}/OrderItemEntity.java (98%) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => cassandra}/SpringDataCassandraOrderRepository.java (96%) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => mongo}/MongoDbOrderRepository.java (99%) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{ => mongo}/SpringDataMongoOrderRepository.java (97%) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java index 5ddc0f3500..a8745eadbe 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/domain/Order.java @@ -41,13 +41,11 @@ public class Order { } private OrderItem getOrderItem(final UUID id) { - return orderItems - .stream() - .filter(orderItem -> orderItem - .getProductId() - .equals(id)) - .findFirst() - .orElseThrow(() -> new DomainException("Product with " + id + " doesn't exist.")); + return orderItems.stream() + .filter(orderItem -> orderItem.getProductId() + .equals(id)) + .findFirst() + .orElseThrow(() -> new DomainException("Product with " + id + " doesn't exist.")); } private void validateState() { @@ -78,7 +76,6 @@ public class Order { return Collections.unmodifiableList(orderItems); } - @Override public int hashCode() { return Objects.hash(id, orderItems, price, status); @@ -93,7 +90,7 @@ public class Order { Order other = (Order) obj; return Objects.equals(id, other.id) && Objects.equals(orderItems, other.orderItems) && Objects.equals(price, other.price) && status == other.status; } - + private Order() { } } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java index 76d7ad1aee..3b5911979a 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/CassandraConfiguration.java @@ -2,7 +2,7 @@ package com.baeldung.dddhexagonalspring.infrastracture.configuration; import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories; -import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataCassandraOrderRepository; +import com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra.SpringDataCassandraOrderRepository; @EnableCassandraRepositories(basePackageClasses = SpringDataCassandraOrderRepository.class) public class CassandraConfiguration { diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java index e0f5e77671..8ec6daf370 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/configuration/MongoDBConfiguration.java @@ -1,8 +1,9 @@ package com.baeldung.dddhexagonalspring.infrastracture.configuration; -import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataMongoOrderRepository; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; +import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository; + @EnableMongoRepositories(basePackageClasses = SpringDataMongoOrderRepository.class) public class MongoDBConfiguration { } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java similarity index 98% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java index c0aff0e11f..98a69cbc88 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra; import java.util.Optional; import java.util.UUID; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java similarity index 99% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java index 30c162a8ab..b9841a4433 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderEntity.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderEntity.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra; import java.math.BigDecimal; import java.util.List; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java similarity index 98% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java index 44af65b842..2cf8ac7845 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/OrderItemEntity.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/OrderItemEntity.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra; import java.math.BigDecimal; import java.util.UUID; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java similarity index 96% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java index eed265e877..ca460fb2c7 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataCassandraOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra; import java.util.UUID; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java similarity index 99% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java index 61ab93b707..f5d7b8f6c1 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java similarity index 97% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java index 620ecb34af..73aa74e7d7 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/SpringDataMongoOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/SpringDataMongoOrderRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.infrastracture.repository; +package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo; import com.baeldung.dddhexagonalspring.domain.Order; import org.springframework.data.mongodb.repository.MongoRepository; diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java index aa1c8af43d..668d1e5e34 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java @@ -6,7 +6,7 @@ import java.math.BigDecimal; import java.util.Optional; import java.util.UUID; -import org.junit.After; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.Product; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +import com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra.SpringDataCassandraOrderRepository; @SpringJUnitConfig @SpringBootTest @@ -24,23 +25,24 @@ class CassandraDbOrderRepositoryIntegrationTest { @Autowired private SpringDataCassandraOrderRepository cassandraOrderRepository; - + @Autowired private OrderRepository orderRepository; - - @After - void cleanUp(){ + + @AfterEach + void cleanUp() { cassandraOrderRepository.deleteAll(); } @Test void shouldFindById_thenReturnOrder() { - + // given final UUID id = UUID.randomUUID(); final Order order = createOrder(id); + order.addOrder(new Product(UUID.randomUUID(), BigDecimal.TEN, "second")); order.complete(); - + // when orderRepository.save(order); diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java index 538fff0b51..9a7736c419 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java @@ -6,7 +6,7 @@ import java.math.BigDecimal; import java.util.Optional; import java.util.UUID; -import org.junit.After; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.Product; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; +import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository; @SpringJUnitConfig @SpringBootTest @@ -24,22 +25,22 @@ class MongoDbOrderRepositoryIntegrationTest { @Autowired private SpringDataMongoOrderRepository mongoOrderRepository; - + @Autowired private OrderRepository orderRepository; - - @After - void cleanUp(){ + + @AfterEach + void cleanUp() { mongoOrderRepository.deleteAll(); } @Test void shouldFindById_thenReturnOrder() { - + // given final UUID id = UUID.randomUUID(); final Order order = createOrder(id); - + // when orderRepository.save(order); diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java index 8247d7c7bd..4c75daaa4d 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryUnitTest.java @@ -2,6 +2,9 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.MongoDbOrderRepository; +import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -18,7 +21,7 @@ class MongoDbOrderRepositoryUnitTest { private MongoDbOrderRepository tested; @BeforeEach - void setUp(){ + void setUp() { springDataOrderRepository = mock(SpringDataMongoOrderRepository.class); tested = new MongoDbOrderRepository(springDataOrderRepository); From ef3570baaf9356a41867d353392caf6d37514009 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 12:47:34 +0200 Subject: [PATCH 14/52] BAEL-3777: Fixed init of cassandra --- .../{cassandra.cql => cassandra-init.cql} | 4 ++-- .../baeldung/dddhexagonalspring/docker-compose.yml | 13 ++++++++++++- ddd/src/test/resources/ddd-layers-test.properties | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) rename ddd/src/test/resources/com/baeldung/dddhexagonalspring/{cassandra.cql => cassandra-init.cql} (61%) diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql similarity index 61% rename from ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql rename to ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql index 7adeda0a51..cbb22d2525 100644 --- a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra.cql +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/cassandra-init.cql @@ -1,9 +1,9 @@ CREATE KEYSPACE IF NOT exists order_database WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}; -CREATE TYPE order_database.orderitementity (productid uuid, price decimal); +CREATE TYPE IF NOT EXISTS order_database.orderitementity (productid uuid, price decimal); -CREATE TABLE order_database.orderentity( +CREATE TABLE IF NOT EXISTS order_database.orderentity( id uuid, status text, orderitementities list>, diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml index dfad875a2b..7de0d30d43 100644 --- a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/docker-compose.yml @@ -3,6 +3,7 @@ version: '3' services: order-mongo-database: image: mongo:3.4.13 + container_name: order-mongo-db restart: always ports: - 27017:27017 @@ -14,6 +15,16 @@ services: - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro order-cassandra-database: image: cassandra:3.11.5 + container_name: order-cassandra-db restart: always ports: - - 9042:9042 \ No newline at end of file + - 9042:9042 + order-cassandra-init: + image: cassandra:3.11.5 + container_name: order-cassandra-db-init + depends_on: + - order-cassandra-database + volumes: + - ./cassandra-init.cql:/cassandra-init.cql:ro + command: bin/bash -c "echo Initializing cassandra schema... && sleep 30 && cqlsh -u cassandra -p cassandra -f cassandra-init.cql order-cassandra-db" + \ No newline at end of file diff --git a/ddd/src/test/resources/ddd-layers-test.properties b/ddd/src/test/resources/ddd-layers-test.properties index 32307581aa..d41689d91b 100644 --- a/ddd/src/test/resources/ddd-layers-test.properties +++ b/ddd/src/test/resources/ddd-layers-test.properties @@ -1,4 +1,4 @@ -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration spring.data.mongodb.host=127.0.0.1 spring.data.mongodb.port=27017 spring.data.mongodb.database=order-database From 92640684d8e9d74f21d9b4c63cba895bbd7debd0 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 13:02:43 +0200 Subject: [PATCH 15/52] BAEL-3777: Cleanup --- .../SpringDataCassandraOrderRepository.java | 2 -- .../repository/mongo/MongoDbOrderRepository.java | 12 ++++++------ ddd/src/main/resources/ddd-layers.properties | 1 + .../com/baeldung/dddhexagonalspring/README.md | 4 +++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java index ca460fb2c7..3c89bd1b23 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java @@ -5,8 +5,6 @@ import java.util.UUID; import org.springframework.data.cassandra.repository.CassandraRepository; import org.springframework.stereotype.Repository; -import com.baeldung.dddhexagonalspring.domain.Order; - @Repository public interface SpringDataCassandraOrderRepository extends CassandraRepository{ diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java index f5d7b8f6c1..e14cb88f5a 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java @@ -1,14 +1,14 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo; -import com.baeldung.dddhexagonalspring.domain.Order; -import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; - import java.util.Optional; import java.util.UUID; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.dddhexagonalspring.domain.Order; +import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; + @Component public class MongoDbOrderRepository implements OrderRepository { diff --git a/ddd/src/main/resources/ddd-layers.properties b/ddd/src/main/resources/ddd-layers.properties index d0ad343b66..412c24eef7 100644 --- a/ddd/src/main/resources/ddd-layers.properties +++ b/ddd/src/main/resources/ddd-layers.properties @@ -1,3 +1,4 @@ +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 spring.data.mongodb.database=order-database diff --git a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md index e0337498fc..1355514a3d 100644 --- a/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md +++ b/ddd/src/test/resources/com/baeldung/dddhexagonalspring/README.md @@ -4,4 +4,6 @@ To run this project, follow these steps: * Run the application database by executing `docker-compose up` in this directory. * Launch the Spring Boot Application (DomainLayerApplication). -* By default, application will connect to this database (configuration in *ddd-layers.properties*) \ No newline at end of file +* By default, the application will connect to the one of the two databases (configuration in *ddd-layers.properties*) + * check `CassandraDbOrderRepository.java` and `MongoDbOrderRepository.java` + * switch between the databases by making one of the above beans primary using the `@Primary` annotation \ No newline at end of file From a8617b62fa2d6eec253a87ed23b2736fecbc2135 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 15:50:49 +0200 Subject: [PATCH 16/52] BAEL-3777: Included CLI mode --- .../DomainLayerApplication.java | 40 ++++++++++++++++++- .../application/cli/CliOrderController.java | 38 ++++++++++++++++++ .../RestOrderController.java} | 6 +-- .../cassandra/CassandraDbOrderRepository.java | 1 - .../mongo/MongoDbOrderRepository.java | 2 + 5 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java rename ddd/src/main/java/com/baeldung/dddhexagonalspring/application/{controller/OrderController.java => rest/RestOrderController.java} (91%) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java index 988f96042b..10fbc9c2f5 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java @@ -1,13 +1,49 @@ package com.baeldung.dddhexagonalspring; +import java.math.BigDecimal; +import java.util.UUID; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.PropertySource; +import com.baeldung.dddhexagonalspring.application.cli.CliOrderController; +import com.baeldung.dddhexagonalspring.domain.Product; + @SpringBootApplication @PropertySource(value = { "classpath:ddd-layers.properties" }) -public class DomainLayerApplication { +public class DomainLayerApplication implements CommandLineRunner { + private static final Logger LOG = LoggerFactory.getLogger(DomainLayerApplication.class); + public static void main(final String[] args) { - SpringApplication.run(DomainLayerApplication.class, args); + SpringApplication application = new SpringApplication(DomainLayerApplication.class); + // uncomment to run just the console application + // application.setWebApplicationType(WebApplicationType.NONE); + application.run(args); + } + + @Autowired + public CliOrderController orderController; + + @Autowired + public ConfigurableApplicationContext context; + + @Override + public void run(String... args) throws Exception { + LOG.info("Placing a new CLI order with two products"); + Product mobilePhone = new Product(UUID.randomUUID(), BigDecimal.valueOf(200), "mobile"); + Product razor = new Product(UUID.randomUUID(), BigDecimal.valueOf(50), "razor"); + LOG.info("Creating order with mobile phone"); + UUID orderId = orderController.createOrder(mobilePhone); + LOG.info("Adding a razor to the order"); + orderController.addProduct(orderId, razor); + LOG.info("Completing order"); + orderController.completeOrder(orderId); + LOG.info("Order placement complete"); } } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java new file mode 100644 index 0000000000..cf073f61c8 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java @@ -0,0 +1,38 @@ +package com.baeldung.dddhexagonalspring.application.cli; + +import java.util.UUID; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.dddhexagonalspring.domain.Product; +import com.baeldung.dddhexagonalspring.domain.service.OrderService; + +@Component +public class CliOrderController{ + + private final OrderService orderService; + + @Autowired + public CliOrderController(OrderService orderService) { + this.orderService = orderService; + } + + public UUID createOrder(Product product) { + return orderService.createOrder(product); + } + + public void addProduct(UUID orderId, Product product) { + orderService.addProduct(orderId, product); + } + + public void deleteProduct(UUID orderId, UUID productId) { + orderService.deleteProduct(orderId, productId); + + } + + public void completeOrder(UUID orderId) { + orderService.completeOrder(orderId); + } + +} diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java similarity index 91% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java index 80ba36d01b..9fcec44a30 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/controller/OrderController.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java @@ -1,4 +1,4 @@ -package com.baeldung.dddhexagonalspring.application.controller; +package com.baeldung.dddhexagonalspring.application.rest; import com.baeldung.dddhexagonalspring.application.request.AddProductRequest; import com.baeldung.dddhexagonalspring.application.request.CreateOrderRequest; @@ -12,12 +12,12 @@ import java.util.UUID; @RestController @RequestMapping("/orders") -public class OrderController { +public class RestOrderController { private final OrderService orderService; @Autowired - public OrderController(OrderService orderService) { + public RestOrderController(OrderService orderService) { this.orderService = orderService; } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java index 98a69cbc88..c14792ce75 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java @@ -11,7 +11,6 @@ import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; @Component -@Primary public class CassandraDbOrderRepository implements OrderRepository { private final SpringDataCassandraOrderRepository orderRepository; diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java index e14cb88f5a..b48b738cbd 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/mongo/MongoDbOrderRepository.java @@ -4,12 +4,14 @@ import java.util.Optional; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import com.baeldung.dddhexagonalspring.domain.Order; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; @Component +@Primary public class MongoDbOrderRepository implements OrderRepository { private final SpringDataMongoOrderRepository orderRepository; From 783e5d9b72b44757620b1f391703abe0dab81605 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 15:58:48 +0200 Subject: [PATCH 17/52] BAEL-3777: Fixed formatting --- .../repository/cassandra/CassandraDbOrderRepository.java | 4 ++-- .../cassandra/SpringDataCassandraOrderRepository.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java index c14792ce75..686fc428e7 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/CassandraDbOrderRepository.java @@ -4,7 +4,6 @@ import java.util.Optional; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import com.baeldung.dddhexagonalspring.domain.Order; @@ -24,7 +23,8 @@ public class CassandraDbOrderRepository implements OrderRepository { public Optional findById(UUID id) { Optional orderEntity = orderRepository.findById(id); if (orderEntity.isPresent()) { - return Optional.of(orderEntity.get().toOrder()); + return Optional.of(orderEntity.get() + .toOrder()); } else { return Optional.empty(); } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java index 3c89bd1b23..93cd7ab83f 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/infrastracture/repository/cassandra/SpringDataCassandraOrderRepository.java @@ -6,6 +6,5 @@ import org.springframework.data.cassandra.repository.CassandraRepository; import org.springframework.stereotype.Repository; @Repository -public interface SpringDataCassandraOrderRepository extends CassandraRepository{ - +public interface SpringDataCassandraOrderRepository extends CassandraRepository { } From eec738467d66dd4af0fb5b3fe3ff0da08d1677d3 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 16:00:10 +0200 Subject: [PATCH 18/52] BAEL-3777: Fixed formatting --- .../dddhexagonalspring/application/cli/CliOrderController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java index cf073f61c8..7f070a3415 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java @@ -28,7 +28,6 @@ public class CliOrderController{ public void deleteProduct(UUID orderId, UUID productId) { orderService.deleteProduct(orderId, productId); - } public void completeOrder(UUID orderId) { From c0415f763975450ef60bb38510a5aa6df09fee71 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 1 Feb 2020 22:57:12 +0200 Subject: [PATCH 19/52] BAEL-3777: Improved CLI example --- .../DomainLayerApplication.java | 22 +++-------- .../application/cli/CliOrderController.java | 38 ++++++++++++------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java index 10fbc9c2f5..235021b03e 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/DomainLayerApplication.java @@ -1,24 +1,18 @@ package com.baeldung.dddhexagonalspring; -import java.math.BigDecimal; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.PropertySource; import com.baeldung.dddhexagonalspring.application.cli.CliOrderController; -import com.baeldung.dddhexagonalspring.domain.Product; @SpringBootApplication @PropertySource(value = { "classpath:ddd-layers.properties" }) public class DomainLayerApplication implements CommandLineRunner { - private static final Logger LOG = LoggerFactory.getLogger(DomainLayerApplication.class); public static void main(final String[] args) { SpringApplication application = new SpringApplication(DomainLayerApplication.class); @@ -35,15 +29,9 @@ public class DomainLayerApplication implements CommandLineRunner { @Override public void run(String... args) throws Exception { - LOG.info("Placing a new CLI order with two products"); - Product mobilePhone = new Product(UUID.randomUUID(), BigDecimal.valueOf(200), "mobile"); - Product razor = new Product(UUID.randomUUID(), BigDecimal.valueOf(50), "razor"); - LOG.info("Creating order with mobile phone"); - UUID orderId = orderController.createOrder(mobilePhone); - LOG.info("Adding a razor to the order"); - orderController.addProduct(orderId, razor); - LOG.info("Completing order"); - orderController.completeOrder(orderId); - LOG.info("Order placement complete"); + orderController.createCompleteOrder(); + orderController.createIncompleteOrder(); + // uncomment to stop the context when execution is done + // context.close(); } } diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java index 7f070a3415..3d595533f3 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/cli/CliOrderController.java @@ -1,7 +1,10 @@ package com.baeldung.dddhexagonalspring.application.cli; +import java.math.BigDecimal; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -9,7 +12,9 @@ import com.baeldung.dddhexagonalspring.domain.Product; import com.baeldung.dddhexagonalspring.domain.service.OrderService; @Component -public class CliOrderController{ +public class CliOrderController { + + private static final Logger LOG = LoggerFactory.getLogger(CliOrderController.class); private final OrderService orderService; @@ -18,20 +23,25 @@ public class CliOrderController{ this.orderService = orderService; } - public UUID createOrder(Product product) { - return orderService.createOrder(product); - } - - public void addProduct(UUID orderId, Product product) { - orderService.addProduct(orderId, product); - } - - public void deleteProduct(UUID orderId, UUID productId) { - orderService.deleteProduct(orderId, productId); - } - - public void completeOrder(UUID orderId) { + public void createCompleteOrder() { + LOG.info("<>"); + UUID orderId = createOrder(); orderService.completeOrder(orderId); } + public void createIncompleteOrder() { + LOG.info("<>"); + UUID orderId = createOrder(); + } + + private UUID createOrder() { + LOG.info("Placing a new order with two products"); + Product mobilePhone = new Product(UUID.randomUUID(), BigDecimal.valueOf(200), "mobile"); + Product razor = new Product(UUID.randomUUID(), BigDecimal.valueOf(50), "razor"); + LOG.info("Creating order with mobile phone"); + UUID orderId = orderService.createOrder(mobilePhone); + LOG.info("Adding a razor to the order"); + orderService.addProduct(orderId, razor); + return orderId; + } } From f5f29086ba72da0cc85f4299898ff44baa234332 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Tue, 4 Feb 2020 21:27:35 +0200 Subject: [PATCH 20/52] BAEL-3777: Revert naming for REST OrderController --- .../rest/{RestOrderController.java => OrderController.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/{RestOrderController.java => OrderController.java} (94%) diff --git a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java similarity index 94% rename from ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java rename to ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java index 9fcec44a30..12bb8ddea4 100644 --- a/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/RestOrderController.java +++ b/ddd/src/main/java/com/baeldung/dddhexagonalspring/application/rest/OrderController.java @@ -12,12 +12,12 @@ import java.util.UUID; @RestController @RequestMapping("/orders") -public class RestOrderController { +public class OrderController { private final OrderService orderService; @Autowired - public RestOrderController(OrderService orderService) { + public OrderController(OrderService orderService) { this.orderService = orderService; } From 124cae5760baef28cc57ec36bfb053dd89fc93b2 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sat, 8 Feb 2020 00:20:48 +0200 Subject: [PATCH 21/52] BAEL-3502 Change destination package for ArraysDeepEqualsUnitTest.java. --- .../arrays/{ => deepequals}/ArraysDeepEqualsUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/{ => deepequals}/ArraysDeepEqualsUnitTest.java (98%) diff --git a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java similarity index 98% rename from core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java rename to core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java index 4998886215..5e01d3f9b5 100644 --- a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/ArraysDeepEqualsUnitTest.java +++ b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.arrays; +package com.baeldung.arrays.deepequals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; From d7fd1e24933eae103697cc113b56a419dac68e16 Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 13 Feb 2020 08:50:05 +0100 Subject: [PATCH 22/52] Java-112 Merge duplicate Java read from file articles --- core-java-modules/core-java-io/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-io/README.md b/core-java-modules/core-java-io/README.md index 2c6c3363cb..b8bec7aa5e 100644 --- a/core-java-modules/core-java-io/README.md +++ b/core-java-modules/core-java-io/README.md @@ -3,7 +3,7 @@ This module contains articles about core Java input and output (IO) ### Relevant Articles: -- [How to Read a File in Java](https://www.baeldung.com/reading-file-in-java) +- [Java – Read from File](https://www.baeldung.com/java-read-file) - [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) - [Java – Directory Size](https://www.baeldung.com/java-folder-size) - [File Size in Java](https://www.baeldung.com/java-file-size) From b155b71c4b7df70993b9fbfc48bbe757339b178e Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 13 Feb 2020 09:16:08 +0100 Subject: [PATCH 23/52] Java-112 Merge duplicate Java read from file articles --- .../readfile/FileOperationsManualTest.java | 134 ------------------ .../readfile/JavaReadFromFileUnitTest.java | 125 ++++++++++++++-- .../src/test/resources/test_read9.in | 1 + 3 files changed, 118 insertions(+), 142 deletions(-) delete mode 100644 core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/FileOperationsManualTest.java create mode 100644 core-java-modules/core-java-io/src/test/resources/test_read9.in diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/FileOperationsManualTest.java b/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/FileOperationsManualTest.java deleted file mode 100644 index b837c6b4dd..0000000000 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/FileOperationsManualTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.baeldung.readfile; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.hamcrest.CoreMatchers; -import org.hamcrest.Matchers; -import org.junit.Test; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -public class FileOperationsManualTest { - - @Test - public void givenFileName_whenUsingClassloader_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; - - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource("fileTest.txt").getFile()); - InputStream inputStream = new FileInputStream(file); - String data = readFromInputStream(inputStream); - - assertEquals(expectedData, data.trim()); - } - - @Test - public void givenFileNameAsAbsolutePath_whenUsingClasspath_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; - - Class clazz = FileOperationsManualTest.class; - InputStream inputStream = clazz.getResourceAsStream("/fileTest.txt"); - String data = readFromInputStream(inputStream); - - assertEquals(expectedData, data.trim()); - } - - @Test - public void givenFileName_whenUsingJarFile_thenFileData() throws IOException { - String expectedData = "MIT License"; - - Class clazz = Matchers.class; - InputStream inputStream = clazz.getResourceAsStream("/LICENSE.txt"); - String data = readFromInputStream(inputStream); - - assertThat(data.trim(), CoreMatchers.containsString(expectedData)); - } - - @Test - public void givenURLName_whenUsingURL_thenFileData() throws IOException { - String expectedData = "Example Domain"; - - URL urlObject = new URL("http://www.example.com/"); - - URLConnection urlConnection = urlObject.openConnection(); - - InputStream inputStream = urlConnection.getInputStream(); - String data = readFromInputStream(inputStream); - - assertThat(data.trim(), CoreMatchers.containsString(expectedData)); - } - - @Test - public void givenFileName_whenUsingFileUtils_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; - - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource("fileTest.txt").getFile()); - String data = FileUtils.readFileToString(file, "UTF-8"); - - assertEquals(expectedData, data.trim()); - } - - @Test - public void givenFilePath_whenUsingFilesReadAllBytes_thenFileData() throws IOException, URISyntaxException { - String expectedData = "Hello World from fileTest.txt!!!"; - - Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); - - byte[] fileBytes = Files.readAllBytes(path); - String data = new String(fileBytes); - - assertEquals(expectedData, data.trim()); - } - - @Test - public void givenFilePath_whenUsingFilesLines_thenFileData() throws IOException, URISyntaxException { - String expectedData = "Hello World from fileTest.txt!!!"; - - Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); - - Stream lines = Files.lines(path); - String data = lines.collect(Collectors.joining("\n")); - lines.close(); - - assertEquals(expectedData, data.trim()); - } - - private String readFromInputStream(InputStream inputStream) throws IOException { - StringBuilder resultStringBuilder = new StringBuilder(); - try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) { - String line; - while ((line = bufferedReader.readLine()) != null) { - resultStringBuilder.append(line).append("\n"); - } - } - - return resultStringBuilder.toString(); - } - - @Test - public void givenFileName_whenUsingIOUtils_thenFileData() throws IOException { - String expectedData = "This is a content of the file"; - - FileInputStream fis = new FileInputStream("src/test/resources/fileToRead.txt"); - String data = IOUtils.toString(fis, "UTF-8"); - - assertEquals(expectedData, data.trim()); - } -} \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java b/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java index a4ccaad594..4cacac91fb 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java +++ b/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java @@ -1,11 +1,15 @@ package com.baeldung.readfile; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.hamcrest.CoreMatchers; +import org.hamcrest.Matchers; import org.junit.Test; -import org.junit.Ignore; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.*; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; @@ -13,14 +17,15 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Scanner; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class JavaReadFromFileUnitTest { - private static final Logger LOG = LoggerFactory.getLogger(JavaReadFromFileUnitTest.class); - @Test public void whenReadWithBufferedReader_thenCorrect() throws IOException { final String expected_value = "Hello world"; @@ -32,6 +37,100 @@ public class JavaReadFromFileUnitTest { assertEquals(expected_value, currentLine); } + @Test + public void givenFileName_whenUsingClassloader_thenFileData() throws IOException { + String expectedData = "Hello World from fileTest.txt!!!"; + + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource("fileTest.txt").getFile()); + InputStream inputStream = new FileInputStream(file); + String data = readFromInputStream(inputStream); + + assertEquals(expectedData, data.trim()); + } + + @Test + public void givenFileNameAsAbsolutePath_whenUsingClasspath_thenFileData() throws IOException { + String expectedData = "Hello World from fileTest.txt!!!"; + + Class clazz = JavaReadFromFileUnitTest.class; + InputStream inputStream = clazz.getResourceAsStream("/fileTest.txt"); + String data = readFromInputStream(inputStream); + + assertEquals(expectedData, data.trim()); + } + + @Test + public void givenFileName_whenUsingJarFile_thenFileData() throws IOException { + String expectedData = "BSD License"; + + Class clazz = Matchers.class; + InputStream inputStream = clazz.getResourceAsStream("/LICENSE.txt"); + String data = readFromInputStream(inputStream); + + assertThat(data.trim(), CoreMatchers.containsString(expectedData)); + } + + @Test + public void givenURLName_whenUsingURL_thenFileData() throws IOException { + String expectedData = "Example Domain"; + + URL urlObject = new URL("http://www.example.com/"); + + URLConnection urlConnection = urlObject.openConnection(); + + InputStream inputStream = urlConnection.getInputStream(); + String data = readFromInputStream(inputStream); + + assertThat(data.trim(), CoreMatchers.containsString(expectedData)); + } + + @Test + public void givenFileName_whenUsingFileUtils_thenFileData() throws IOException { + String expectedData = "Hello World from fileTest.txt!!!"; + + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource("fileTest.txt").getFile()); + String data = FileUtils.readFileToString(file, "UTF-8"); + + assertEquals(expectedData, data.trim()); + } + + @Test + public void givenFilePath_whenUsingFilesReadAllBytes_thenFileData() throws IOException, URISyntaxException { + String expectedData = "Hello World from fileTest.txt!!!"; + + Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); + + byte[] fileBytes = Files.readAllBytes(path); + String data = new String(fileBytes); + + assertEquals(expectedData, data.trim()); + } + + @Test + public void givenFilePath_whenUsingFilesLines_thenFileData() throws IOException, URISyntaxException { + String expectedData = "Hello World from fileTest.txt!!!"; + + Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); + + Stream lines = Files.lines(path); + String data = lines.collect(Collectors.joining("\n")); + lines.close(); + + assertEquals(expectedData, data.trim()); + } + + @Test + public void givenFileName_whenUsingIOUtils_thenFileData() throws IOException { + String expectedData = "This is a content of the file"; + + FileInputStream fis = new FileInputStream("src/test/resources/test_read9.in"); + String data = IOUtils.toString(fis, "UTF-8"); + + assertEquals(expectedData, data.trim()); + } + @Test public void whenReadWithScanner_thenCorrect() throws IOException { final Scanner scanner = new Scanner(new File("src/test/resources/test_read1.in")); @@ -106,14 +205,12 @@ public class JavaReadFromFileUnitTest { } @Test - @Ignore // TODO public void whenReadUTFEncodedFile_thenCorrect() throws IOException { final String expected_value = "青空"; final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8")); final String currentLine = reader.readLine(); reader.close(); - LOG.debug(currentLine); - + assertEquals(expected_value, currentLine); } @@ -171,4 +268,16 @@ public class JavaReadFromFileUnitTest { assertEquals(expected_value, line); } + private String readFromInputStream(InputStream inputStream) throws IOException { + StringBuilder resultStringBuilder = new StringBuilder(); + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + while ((line = bufferedReader.readLine()) != null) { + resultStringBuilder.append(line).append("\n"); + } + } + + return resultStringBuilder.toString(); + } + } diff --git a/core-java-modules/core-java-io/src/test/resources/test_read9.in b/core-java-modules/core-java-io/src/test/resources/test_read9.in new file mode 100644 index 0000000000..7be79c9761 --- /dev/null +++ b/core-java-modules/core-java-io/src/test/resources/test_read9.in @@ -0,0 +1 @@ +This is a content of the file From 522e076018d76333f21c05ed5f2aaac54c1013a8 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 15 Feb 2020 20:26:00 +0100 Subject: [PATCH 24/52] Java-72 Rename Spring Security LDAP module --- spring-security-modules/pom.xml | 3 +-- .../README.md | 0 .../pom.xml | 4 ++-- .../src/main/java/org/baeldung/SampleLDAPApplication.java | 0 .../src/main/java/org/baeldung/controller/MyController.java | 0 .../src/main/java/org/baeldung/security/SecurityConfig.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/static/css/bootstrap.min.css | 0 .../src/main/resources/templates/error.html | 0 .../src/main/resources/templates/home.html | 0 .../src/main/resources/templates/login.html | 0 .../src/main/resources/users.ldif | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/test/java/org/baeldung/SpringContextTest.java | 0 .../src/test/resources/.gitignore | 0 15 files changed, 3 insertions(+), 4 deletions(-) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/README.md (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/pom.xml (95%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/java/org/baeldung/SampleLDAPApplication.java (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/java/org/baeldung/controller/MyController.java (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/java/org/baeldung/security/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/static/css/bootstrap.min.css (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/templates/error.html (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/templates/home.html (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/templates/login.html (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/users.ldif (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/test/java/org/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-ldap => spring-security-ldap}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index 7de3009f47..85b86f00fc 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -25,13 +25,12 @@ spring-security-mvc-custom spring-security-mvc-digest-auth spring-security-mvc-jsonview - spring-security-mvc-ldap + spring-security-ldap spring-security-mvc-login spring-security-mvc-persisted-remember-me spring-security-mvc-socket spring-security-oidc spring-security-react - spring-security-rest spring-security-rest-basic-auth spring-security-rest-custom diff --git a/spring-security-modules/spring-security-mvc-ldap/README.md b/spring-security-modules/spring-security-ldap/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/README.md rename to spring-security-modules/spring-security-ldap/README.md diff --git a/spring-security-modules/spring-security-mvc-ldap/pom.xml b/spring-security-modules/spring-security-ldap/pom.xml similarity index 95% rename from spring-security-modules/spring-security-mvc-ldap/pom.xml rename to spring-security-modules/spring-security-ldap/pom.xml index 2f227d7908..f5e8856648 100644 --- a/spring-security-modules/spring-security-mvc-ldap/pom.xml +++ b/spring-security-modules/spring-security-ldap/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-ldap + spring-security-ldap 0.1-SNAPSHOT - spring-security-mvc-ldap + spring-security-ldap war diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java b/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java rename to spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java b/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/controller/MyController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/controller/MyController.java diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java b/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/security/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/java/org/baeldung/security/SecurityConfig.java rename to spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/security/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/logback.xml b/spring-security-modules/spring-security-ldap/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/logback.xml rename to spring-security-modules/spring-security-ldap/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css b/spring-security-modules/spring-security-ldap/src/main/resources/static/css/bootstrap.min.css similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/static/css/bootstrap.min.css rename to spring-security-modules/spring-security-ldap/src/main/resources/static/css/bootstrap.min.css diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/error.html b/spring-security-modules/spring-security-ldap/src/main/resources/templates/error.html similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/error.html rename to spring-security-modules/spring-security-ldap/src/main/resources/templates/error.html diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/home.html b/spring-security-modules/spring-security-ldap/src/main/resources/templates/home.html similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/home.html rename to spring-security-modules/spring-security-ldap/src/main/resources/templates/home.html diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/login.html b/spring-security-modules/spring-security-ldap/src/main/resources/templates/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-ldap/src/main/resources/templates/login.html diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/users.ldif b/spring-security-modules/spring-security-ldap/src/main/resources/users.ldif similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/users.ldif rename to spring-security-modules/spring-security-ldap/src/main/resources/users.ldif diff --git a/spring-security-modules/spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-ldap/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-ldap/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-ldap/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-ldap/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-ldap/src/test/resources/.gitignore b/spring-security-modules/spring-security-ldap/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-ldap/src/test/resources/.gitignore rename to spring-security-modules/spring-security-ldap/src/test/resources/.gitignore From fea250ee5d56ce54a3ca5d047a608e97eb580b4d Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 15 Feb 2020 21:34:31 +0100 Subject: [PATCH 25/52] Java-41 Fix pom for blade module --- blade/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blade/pom.xml b/blade/pom.xml index 6d73913e25..f463c7f077 100644 --- a/blade/pom.xml +++ b/blade/pom.xml @@ -106,7 +106,7 @@ java -jar - sample-blade-app.jar + blade.jar From 9c505d2ac152d11a5e07acc0f522c70790cd7b60 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 00:29:50 +0200 Subject: [PATCH 26/52] BAEL-3502 Remove ArraysDeepEqualsUnitTest file from core-java-arrays-2 module. --- .../deepequals/ArraysDeepEqualsUnitTest.java | 97 ------------------- 1 file changed, 97 deletions(-) delete mode 100644 core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java diff --git a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java deleted file mode 100644 index 5e01d3f9b5..0000000000 --- a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.baeldung.arrays.deepequals; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.Objects; - -import org.junit.jupiter.api.Test; - -public class ArraysDeepEqualsUnitTest { - - class Person { - private int id; - private String name; - private int age; - - Person(int id, String name, int age) { - this.id = id; - this.name = name; - this.age = age; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof Person)) - return false; - Person person = (Person) obj; - return id == person.id && name.equals(person.name) && age == person.age; - } - - @Override - public int hashCode() { - return Objects.hash(id, name, age); - } - } - - @Test - void givenTwoUnidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { - Object[] anArray = new Object[] { "string1", "string2", "string3" }; - Object[] anotherArray = new Object[] { "string1", "string2", "string3" }; - - assertTrue(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } - - @Test - void givenTwoUnidimensionalObjectTypeArraysWithNullElements_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { - Object[] anArray = new Object[] { "string1", null, "string3" }; - Object[] anotherArray = new Object[] { "string1", null, "string3" }; - - assertTrue(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } - - @Test - void givenTwoUnidimensionalObjectTypeArraysWithNestedElements_whenUsingEqualsAndDeepEquals_thenShouldReturnDifferently() { - Object[] anArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; - Object[] anotherArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; - - assertFalse(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } - - @Test - void givenTwoMultidimensionalPrimitiveTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { - int[][] anArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; - int[][] anotherArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; - - assertFalse(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } - - @Test - void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { - Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - - assertFalse(Arrays.equals(personArray1, personArray2)); - assertTrue(Arrays.deepEquals(personArray1, personArray2)); - } - - @Test - void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() { - Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - - assertTrue(Objects.deepEquals(personArray1, personArray2)); - assertTrue(Arrays.deepEquals(personArray1, personArray2)); - } -} From 319fbc12c57942f2c2141dd7ef77c5f8abfcb08c Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 00:33:19 +0200 Subject: [PATCH 27/52] BAEL-3502 Add ArraysDeepEqualsUnitTest.java inside new core-java-arrays-3 module. --- .../core-java-arrays-3/README.md | 5 + core-java-modules/core-java-arrays-3/pom.xml | 31 ++++++ .../deepequals/ArraysDeepEqualsUnitTest.java | 100 ++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 core-java-modules/core-java-arrays-3/README.md create mode 100644 core-java-modules/core-java-arrays-3/pom.xml create mode 100644 core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java diff --git a/core-java-modules/core-java-arrays-3/README.md b/core-java-modules/core-java-arrays-3/README.md new file mode 100644 index 0000000000..9f2885a2ce --- /dev/null +++ b/core-java-modules/core-java-arrays-3/README.md @@ -0,0 +1,5 @@ +## Core Java Arrays (Part 3) + +This module contains articles about Java arrays + +## Relevant Articles diff --git a/core-java-modules/core-java-arrays-3/pom.xml b/core-java-modules/core-java-arrays-3/pom.xml new file mode 100644 index 0000000000..b39a9af653 --- /dev/null +++ b/core-java-modules/core-java-arrays-3/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + core-java-arrays-3 + 0.1.0-SNAPSHOT + core-java-arrays-3 + jar + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + 3.14.0 + + + \ No newline at end of file diff --git a/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java b/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java new file mode 100644 index 0000000000..aa577ea7bd --- /dev/null +++ b/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java @@ -0,0 +1,100 @@ +package com.baeldung.arrays.deepequals; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Objects; +import org.junit.jupiter.api.Test; + +public class ArraysDeepEqualsUnitTest { + + class Person { + private int id; + private String name; + private int age; + + Person(int id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Person)) + return false; + Person person = (Person) obj; + return id == person.id && name.equals(person.name) && age == person.age; + } + + @Override + public int hashCode() { + return Objects.hash(id, name, age); + } + } + + @Test + void givenTwoUnidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", "string2", "string3" }; + Object[] anotherArray = new Object[] { "string1", "string2", "string3" }; + + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNullElements_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", null, "string3" }; + Object[] anotherArray = new Object[] { "string1", null, "string3" }; + + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNestedElements_whenUsingEqualsAndDeepEquals_thenShouldReturnDifferently() { + Object[] anArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + Object[] anotherArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoMultidimensionalPrimitiveTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + int[][] anArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + int[][] anotherArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } + + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, + { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, + { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + + assertFalse(Arrays.equals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } + + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, + { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, + { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + + assertTrue(Objects.deepEquals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } +} From af1fd4e1b0df9085378aca2127721d1a554f7a8f Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 00:33:48 +0200 Subject: [PATCH 28/52] BAEL-3502 Bind core-java-arrays-3 module to parent module. --- core-java-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 904cec2815..771d5a5d61 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -31,6 +31,7 @@ core-java-annotations core-java-arrays core-java-arrays-2 + core-java-arrays-3 core-java-collections core-java-collections-2 From 394711c03efcca7dd6ae7e896c4c9aa6737cab4f Mon Sep 17 00:00:00 2001 From: Priyesh Mashelkar Date: Sat, 15 Feb 2020 23:16:12 +0000 Subject: [PATCH 29/52] BAEL-3499 Fixed integration test --- .../spring-boot-properties/src/main/resources/build.properties | 3 ++- .../buildproperties/BuildInfoServiceIntegrationTest.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/build.properties b/spring-boot-modules/spring-boot-properties/src/main/resources/build.properties index f3d2e9b15b..5bd0a50a17 100644 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/build.properties +++ b/spring-boot-modules/spring-boot-properties/src/main/resources/build.properties @@ -1 +1,2 @@ -application-version=@project.version@ \ No newline at end of file +application-version=@project.version@ +application-description=@project.description@ \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/buildproperties/BuildInfoServiceIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/buildproperties/BuildInfoServiceIntegrationTest.java index cb056fe56d..2cb27e1844 100644 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/buildproperties/BuildInfoServiceIntegrationTest.java +++ b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/buildproperties/BuildInfoServiceIntegrationTest.java @@ -18,7 +18,7 @@ class BuildInfoServiceIntegrationTest { @Test void whenGetApplicationDescription_thenSuccess() { - assertThat(service.getApplicationDescription(), Matchers.is("This is simple boot application for Spring boot actuator test")); + assertThat(service.getApplicationDescription(), Matchers.is("Spring Boot Properties Module")); assertThat(service.getApplicationVersion(), Matchers.is("0.0.1-SNAPSHOT")); } } From dcccf21e0d2e08547d071817b9a109f3490fcd99 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 17:34:31 +0200 Subject: [PATCH 30/52] BAEL-3502 Apply correct formatter. --- core-java-modules/core-java-arrays-3/pom.xml | 48 ++--- .../deepequals/ArraysDeepEqualsUnitTest.java | 142 ++++++------- core-java-modules/pom.xml | 199 +++++++++--------- 3 files changed, 191 insertions(+), 198 deletions(-) diff --git a/core-java-modules/core-java-arrays-3/pom.xml b/core-java-modules/core-java-arrays-3/pom.xml index b39a9af653..516d9b2b37 100644 --- a/core-java-modules/core-java-arrays-3/pom.xml +++ b/core-java-modules/core-java-arrays-3/pom.xml @@ -1,31 +1,31 @@ - 4.0.0 - core-java-arrays-3 - 0.1.0-SNAPSHOT - core-java-arrays-3 - jar + 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 + core-java-arrays-3 + 0.1.0-SNAPSHOT + core-java-arrays-3 + jar - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../../parent-java - + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + - - - org.assertj - assertj-core - ${assertj.version} - test - - + + + org.assertj + assertj-core + ${assertj.version} + test + + - - 3.14.0 - + + 3.14.0 + \ No newline at end of file diff --git a/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java b/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java index aa577ea7bd..a9b8ed7e3f 100644 --- a/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java +++ b/core-java-modules/core-java-arrays-3/src/test/java/com/baeldung/arrays/deepequals/ArraysDeepEqualsUnitTest.java @@ -9,92 +9,88 @@ import org.junit.jupiter.api.Test; public class ArraysDeepEqualsUnitTest { - class Person { - private int id; - private String name; - private int age; + class Person { + private int id; + private String name; + private int age; - Person(int id, String name, int age) { - this.id = id; - this.name = name; - this.age = age; - } + Person(int id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof Person)) - return false; - Person person = (Person) obj; - return id == person.id && name.equals(person.name) && age == person.age; - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Person)) + return false; + Person person = (Person) obj; + return id == person.id && name.equals(person.name) && age == person.age; + } - @Override - public int hashCode() { - return Objects.hash(id, name, age); - } - } + @Override + public int hashCode() { + return Objects.hash(id, name, age); + } + } - @Test - void givenTwoUnidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { - Object[] anArray = new Object[] { "string1", "string2", "string3" }; - Object[] anotherArray = new Object[] { "string1", "string2", "string3" }; + @Test + void givenTwoUnidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", "string2", "string3" }; + Object[] anotherArray = new Object[] { "string1", "string2", "string3" }; - assertTrue(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } - @Test - void givenTwoUnidimensionalObjectTypeArraysWithNullElements_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { - Object[] anArray = new Object[] { "string1", null, "string3" }; - Object[] anotherArray = new Object[] { "string1", null, "string3" }; + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNullElements_whenUsingEqualsAndDeepEquals_thenBothShouldReturnTrue() { + Object[] anArray = new Object[] { "string1", null, "string3" }; + Object[] anotherArray = new Object[] { "string1", null, "string3" }; - assertTrue(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } + assertTrue(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } - @Test - void givenTwoUnidimensionalObjectTypeArraysWithNestedElements_whenUsingEqualsAndDeepEquals_thenShouldReturnDifferently() { - Object[] anArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; - Object[] anotherArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + @Test + void givenTwoUnidimensionalObjectTypeArraysWithNestedElements_whenUsingEqualsAndDeepEquals_thenShouldReturnDifferently() { + Object[] anArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; + Object[] anotherArray = new Object[] { "string1", null, new String[] { "nestedString1", "nestedString2" } }; - assertFalse(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } - @Test - void givenTwoMultidimensionalPrimitiveTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { - int[][] anArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; - int[][] anotherArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + @Test + void givenTwoMultidimensionalPrimitiveTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + int[][] anArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; + int[][] anotherArray = { { 1, 2, 3 }, { 4, 5, 6, 9 }, { 7 } }; - assertFalse(Arrays.equals(anArray, anotherArray)); - assertTrue(Arrays.deepEquals(anArray, anotherArray)); - } + assertFalse(Arrays.equals(anArray, anotherArray)); + assertTrue(Arrays.deepEquals(anArray, anotherArray)); + } - @Test - void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { - Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, - { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, - { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - assertFalse(Arrays.equals(personArray1, personArray2)); - assertTrue(Arrays.deepEquals(personArray1, personArray2)); - } + assertFalse(Arrays.equals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } - @Test - void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() { - Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, - { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, - { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + @Test + void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() { + Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; + Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } }; - assertTrue(Objects.deepEquals(personArray1, personArray2)); - assertTrue(Arrays.deepEquals(personArray1, personArray2)); - } + assertTrue(Objects.deepEquals(personArray1, personArray2)); + assertTrue(Arrays.deepEquals(personArray1, personArray2)); + } } diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 771d5a5d61..60e1dbf3ef 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -1,124 +1,121 @@ - - 4.0.0 - com.baeldung.core-java-modules - core-java-modules - core-java-modules - pom + + 4.0.0 + com.baeldung.core-java-modules + core-java-modules + core-java-modules + pom - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - core-java - - - - - core-java-8 - core-java-8-2 + + core-java + + + + + core-java-8 + core-java-8-2 - - - - - + + + + + - core-java-annotations - core-java-arrays - core-java-arrays-2 + core-java-annotations + core-java-arrays + core-java-arrays-2 core-java-arrays-3 - core-java-collections - core-java-collections-2 - core-java-collections-3 - core-java-collections-array-list - core-java-collections-list - core-java-collections-list-2 - core-java-collections-list-3 - core-java-collections-set + core-java-collections + core-java-collections-2 + core-java-collections-3 + core-java-collections-array-list + core-java-collections-list + core-java-collections-list-2 + core-java-collections-list-3 + core-java-collections-set - core-java-concurrency-2 - core-java-concurrency-advanced - core-java-concurrency-advanced-2 - core-java-concurrency-advanced-3 - core-java-concurrency-basic - core-java-concurrency-basic-2 - core-java-concurrency-collections + core-java-concurrency-2 + core-java-concurrency-advanced + core-java-concurrency-advanced-2 + core-java-concurrency-advanced-3 + core-java-concurrency-basic + core-java-concurrency-basic-2 + core-java-concurrency-collections - - core-java-date-operations-2 - - + + core-java-date-operations-2 + + - core-java-exceptions - core-java-exceptions-2 + core-java-exceptions + core-java-exceptions-2 - core-java-function + core-java-function - core-java-io - core-java-io-2 - core-java-io-apis - core-java-io-conversions + core-java-io + core-java-io-2 + core-java-io-apis + core-java-io-conversions - core-java-jar - core-java-jndi - - core-java-jvm + core-java-jar + core-java-jndi + + core-java-jvm - core-java-lambdas - core-java-lang - core-java-lang-2 - core-java-lang-math - core-java-lang-oop - core-java-lang-oop-2 - core-java-lang-oop-3 - core-java-lang-oop-4 - core-java-lang-operators - core-java-lang-syntax - core-java-lang-syntax-2 + core-java-lambdas + core-java-lang + core-java-lang-2 + core-java-lang-math + core-java-lang-oop + core-java-lang-oop-2 + core-java-lang-oop-3 + core-java-lang-oop-4 + core-java-lang-operators + core-java-lang-syntax + core-java-lang-syntax-2 - core-java-networking - core-java-networking-2 - core-java-nio - core-java-nio-2 + core-java-networking + core-java-networking-2 + core-java-nio + core-java-nio-2 - core-java-optional - + core-java-optional + - core-java-perf + core-java-perf - core-java-reflection + core-java-reflection - core-java-security - core-java-streams - core-java-streams-2 - core-java-streams-3 - core-java-string-algorithms - core-java-string-algorithms-2 - core-java-string-algorithms-3 - core-java-string-apis - core-java-string-conversions - core-java-string-conversions-2 - core-java-string-operations - core-java-string-operations-2 - core-java-strings - core-java-sun + core-java-security + core-java-streams + core-java-streams-2 + core-java-streams-3 + core-java-string-algorithms + core-java-string-algorithms-2 + core-java-string-algorithms-3 + core-java-string-apis + core-java-string-conversions + core-java-string-conversions-2 + core-java-string-operations + core-java-string-operations-2 + core-java-strings + core-java-sun - core-java-text - + core-java-text + - - pre-jpms - + + pre-jpms + From 347a2b2b4f75e8ee32dc3fc65632d3c0967659f6 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 17:43:28 +0200 Subject: [PATCH 31/52] BAEL-3502 - Format pom.xml file. --- core-java-modules/pom.xml | 199 +++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 98 deletions(-) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 60e1dbf3ef..771d5a5d61 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -1,121 +1,124 @@ - - 4.0.0 - com.baeldung.core-java-modules - core-java-modules - core-java-modules - pom + + 4.0.0 + com.baeldung.core-java-modules + core-java-modules + core-java-modules + pom - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - core-java - - - - - core-java-8 - core-java-8-2 + + core-java + + + + + core-java-8 + core-java-8-2 - - - - - + + + + + - core-java-annotations - core-java-arrays - core-java-arrays-2 + core-java-annotations + core-java-arrays + core-java-arrays-2 core-java-arrays-3 - core-java-collections - core-java-collections-2 - core-java-collections-3 - core-java-collections-array-list - core-java-collections-list - core-java-collections-list-2 - core-java-collections-list-3 - core-java-collections-set + core-java-collections + core-java-collections-2 + core-java-collections-3 + core-java-collections-array-list + core-java-collections-list + core-java-collections-list-2 + core-java-collections-list-3 + core-java-collections-set - core-java-concurrency-2 - core-java-concurrency-advanced - core-java-concurrency-advanced-2 - core-java-concurrency-advanced-3 - core-java-concurrency-basic - core-java-concurrency-basic-2 - core-java-concurrency-collections + core-java-concurrency-2 + core-java-concurrency-advanced + core-java-concurrency-advanced-2 + core-java-concurrency-advanced-3 + core-java-concurrency-basic + core-java-concurrency-basic-2 + core-java-concurrency-collections - - core-java-date-operations-2 - - + + core-java-date-operations-2 + + - core-java-exceptions - core-java-exceptions-2 + core-java-exceptions + core-java-exceptions-2 - core-java-function + core-java-function - core-java-io - core-java-io-2 - core-java-io-apis - core-java-io-conversions + core-java-io + core-java-io-2 + core-java-io-apis + core-java-io-conversions - core-java-jar - core-java-jndi - - core-java-jvm + core-java-jar + core-java-jndi + + core-java-jvm - core-java-lambdas - core-java-lang - core-java-lang-2 - core-java-lang-math - core-java-lang-oop - core-java-lang-oop-2 - core-java-lang-oop-3 - core-java-lang-oop-4 - core-java-lang-operators - core-java-lang-syntax - core-java-lang-syntax-2 + core-java-lambdas + core-java-lang + core-java-lang-2 + core-java-lang-math + core-java-lang-oop + core-java-lang-oop-2 + core-java-lang-oop-3 + core-java-lang-oop-4 + core-java-lang-operators + core-java-lang-syntax + core-java-lang-syntax-2 - core-java-networking - core-java-networking-2 - core-java-nio - core-java-nio-2 + core-java-networking + core-java-networking-2 + core-java-nio + core-java-nio-2 - core-java-optional - + core-java-optional + - core-java-perf + core-java-perf - core-java-reflection + core-java-reflection - core-java-security - core-java-streams - core-java-streams-2 - core-java-streams-3 - core-java-string-algorithms - core-java-string-algorithms-2 - core-java-string-algorithms-3 - core-java-string-apis - core-java-string-conversions - core-java-string-conversions-2 - core-java-string-operations - core-java-string-operations-2 - core-java-strings - core-java-sun + core-java-security + core-java-streams + core-java-streams-2 + core-java-streams-3 + core-java-string-algorithms + core-java-string-algorithms-2 + core-java-string-algorithms-3 + core-java-string-apis + core-java-string-conversions + core-java-string-conversions-2 + core-java-string-operations + core-java-string-operations-2 + core-java-strings + core-java-sun - core-java-text - + core-java-text + - - pre-jpms - + + pre-jpms + From 70799d694fc50e6dc941130665d94fc888754ff2 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Sun, 16 Feb 2020 17:45:08 +0200 Subject: [PATCH 32/52] BAEL-3502 - Format core-java-modules pom.xml file. --- core-java-modules/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 771d5a5d61..2850983028 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -31,7 +31,7 @@ core-java-annotations core-java-arrays core-java-arrays-2 - core-java-arrays-3 + core-java-arrays-3 core-java-collections core-java-collections-2 From 46d322855101ada2497f3b42c8196c231481c8cf Mon Sep 17 00:00:00 2001 From: mikr Date: Sun, 16 Feb 2020 18:32:53 +0100 Subject: [PATCH 33/52] Java-112 Update unit tests for article merge --- .../readfile/JavaReadFromFileUnitTest.java | 91 ++++++++---------- .../src/test/resources/fileTest.txt | 2 +- .../{test_read3.in => fileTestTokenizer.txt} | 0 .../{test_read7.in => fileTestUtf8.txt} | 0 .../src/test/resources/test_read1.in | 1 - .../src/test/resources/test_read2.in | 1 - .../src/test/resources/test_read4.in | Bin 7 -> 0 bytes .../src/test/resources/test_read8.in | 2 - .../src/test/resources/test_read9.in | 1 - 9 files changed, 40 insertions(+), 58 deletions(-) rename core-java-modules/core-java-io/src/test/resources/{test_read3.in => fileTestTokenizer.txt} (100%) rename core-java-modules/core-java-io/src/test/resources/{test_read7.in => fileTestUtf8.txt} (100%) delete mode 100644 core-java-modules/core-java-io/src/test/resources/test_read1.in delete mode 100644 core-java-modules/core-java-io/src/test/resources/test_read2.in delete mode 100644 core-java-modules/core-java-io/src/test/resources/test_read4.in delete mode 100644 core-java-modules/core-java-io/src/test/resources/test_read8.in delete mode 100644 core-java-modules/core-java-io/src/test/resources/test_read9.in diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java b/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java index 4cacac91fb..aa37a22e1f 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java +++ b/core-java-modules/core-java-io/src/test/java/com/baeldung/readfile/JavaReadFromFileUnitTest.java @@ -28,9 +28,9 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadWithBufferedReader_thenCorrect() throws IOException { - final String expected_value = "Hello world"; + final String expected_value = "Hello, world!"; - final BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/test_read.in")); + final BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/fileTest.txt")); final String currentLine = reader.readLine(); reader.close(); @@ -39,7 +39,7 @@ public class JavaReadFromFileUnitTest { @Test public void givenFileName_whenUsingClassloader_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; + String expectedData = "Hello, world!"; ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileTest.txt").getFile()); @@ -51,7 +51,7 @@ public class JavaReadFromFileUnitTest { @Test public void givenFileNameAsAbsolutePath_whenUsingClasspath_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; + String expectedData = "Hello, world!"; Class clazz = JavaReadFromFileUnitTest.class; InputStream inputStream = clazz.getResourceAsStream("/fileTest.txt"); @@ -87,7 +87,7 @@ public class JavaReadFromFileUnitTest { @Test public void givenFileName_whenUsingFileUtils_thenFileData() throws IOException { - String expectedData = "Hello World from fileTest.txt!!!"; + String expectedData = "Hello, world!"; ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileTest.txt").getFile()); @@ -98,7 +98,7 @@ public class JavaReadFromFileUnitTest { @Test public void givenFilePath_whenUsingFilesReadAllBytes_thenFileData() throws IOException, URISyntaxException { - String expectedData = "Hello World from fileTest.txt!!!"; + String expectedData = "Hello, world!"; Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); @@ -110,7 +110,7 @@ public class JavaReadFromFileUnitTest { @Test public void givenFilePath_whenUsingFilesLines_thenFileData() throws IOException, URISyntaxException { - String expectedData = "Hello World from fileTest.txt!!!"; + String expectedData = "Hello, world!"; Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); @@ -123,9 +123,9 @@ public class JavaReadFromFileUnitTest { @Test public void givenFileName_whenUsingIOUtils_thenFileData() throws IOException { - String expectedData = "This is a content of the file"; + String expectedData = "Hello, world!"; - FileInputStream fis = new FileInputStream("src/test/resources/test_read9.in"); + FileInputStream fis = new FileInputStream("src/test/resources/fileTest.txt"); String data = IOUtils.toString(fis, "UTF-8"); assertEquals(expectedData, data.trim()); @@ -133,34 +133,32 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadWithScanner_thenCorrect() throws IOException { - final Scanner scanner = new Scanner(new File("src/test/resources/test_read1.in")); + final Scanner scanner = new Scanner(new File("src/test/resources/fileTest.txt")); scanner.useDelimiter(" "); assertTrue(scanner.hasNext()); - assertEquals("Hello", scanner.next()); - assertEquals("world", scanner.next()); - assertEquals(1, scanner.nextInt()); + assertEquals("Hello,", scanner.next()); + assertEquals("world!", scanner.next()); scanner.close(); - } @Test public void whenReadWithScannerTwoDelimiters_thenCorrect() throws IOException { - final Scanner scanner = new Scanner(new File("src/test/resources/test_read2.in")); - scanner.useDelimiter(",| "); + final Scanner scanner = new Scanner(new File("src/test/resources/fileTest.txt")); + scanner.useDelimiter("\\s|,"); - assertTrue(scanner.hasNextInt()); - assertEquals(2, scanner.nextInt()); - assertEquals(3, scanner.nextInt()); - assertEquals(4, scanner.nextInt()); + assertTrue(scanner.hasNext()); + assertEquals("Hello", scanner.next()); + assertEquals("", scanner.next()); + assertEquals("world!", scanner.next()); scanner.close(); } @Test public void whenReadWithStreamTokenizer_thenCorrectTokens() throws IOException { - final FileReader reader = new FileReader("src/test/resources/test_read3.in"); + final FileReader reader = new FileReader("src/test/resources/fileTestTokenizer.txt"); final StreamTokenizer tokenizer = new StreamTokenizer(reader); tokenizer.nextToken(); @@ -177,37 +175,26 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadWithDataInputStream_thenCorrect() throws IOException { - final String expected_value = "Hello"; + String expectedValue = "Hello, world!"; + String file ="src/test/resources/fileTest.txt"; - String result; - final DataInputStream reader = new DataInputStream(new FileInputStream("src/test/resources/test_read4.in")); - result = reader.readUTF(); - reader.close(); + String result = null; - assertEquals(expected_value, result); - } + DataInputStream reader = new DataInputStream(new FileInputStream(file)); + int nBytesToRead = reader.available(); + if(nBytesToRead > 0) { + byte[] bytes = new byte[nBytesToRead]; + reader.read(bytes); + result = new String(bytes); + } - public void whenReadTwoFilesWithSequenceInputStream_thenCorrect() throws IOException { - final int expected_value1 = 2000; - final int expected_value2 = 5000; - - final FileInputStream stream1 = new FileInputStream("src/test/resources/test_read5.in"); - final FileInputStream stream2 = new FileInputStream("src/test/resources/test_read6.in"); - - final SequenceInputStream sequence = new SequenceInputStream(stream1, stream2); - final DataInputStream reader = new DataInputStream(sequence); - - assertEquals(expected_value1, reader.readInt()); - assertEquals(expected_value2, reader.readInt()); - - reader.close(); - stream2.close(); + assertEquals(expectedValue, result); } @Test public void whenReadUTFEncodedFile_thenCorrect() throws IOException { final String expected_value = "青空"; - final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8")); + final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/fileTestUtf8.txt"), "UTF-8")); final String currentLine = reader.readLine(); reader.close(); @@ -216,8 +203,8 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadFileContentsIntoString_thenCorrect() throws IOException { - final String expected_value = "Hello world \n Test line \n"; - final BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/test_read8.in")); + final String expected_value = "Hello, world!\n"; + final BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/fileTest.txt")); final StringBuilder builder = new StringBuilder(); String currentLine = reader.readLine(); while (currentLine != null) { @@ -233,8 +220,8 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadWithFileChannel_thenCorrect() throws IOException { - final String expected_value = "Hello world"; - final RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "r"); + final String expected_value = "Hello, world!"; + final RandomAccessFile reader = new RandomAccessFile("src/test/resources/fileTest.txt", "r"); final FileChannel channel = reader.getChannel(); int bufferSize = 1024; @@ -251,8 +238,8 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadSmallFileJava7_thenCorrect() throws IOException { - final String expected_value = "Hello world"; - final Path path = Paths.get("src/test/resources/test_read.in"); + final String expected_value = "Hello, world!"; + final Path path = Paths.get("src/test/resources/fileTest.txt"); final String read = Files.readAllLines(path, Charset.defaultCharset()).get(0); assertEquals(expected_value, read); @@ -260,9 +247,9 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadLargeFileJava7_thenCorrect() throws IOException { - final String expected_value = "Hello world"; + final String expected_value = "Hello, world!"; - final Path path = Paths.get("src/test/resources/test_read.in"); + final Path path = Paths.get("src/test/resources/fileTest.txt"); final BufferedReader reader = Files.newBufferedReader(path, Charset.defaultCharset()); final String line = reader.readLine(); assertEquals(expected_value, line); diff --git a/core-java-modules/core-java-io/src/test/resources/fileTest.txt b/core-java-modules/core-java-io/src/test/resources/fileTest.txt index ce4bea208b..5dd01c177f 100644 --- a/core-java-modules/core-java-io/src/test/resources/fileTest.txt +++ b/core-java-modules/core-java-io/src/test/resources/fileTest.txt @@ -1 +1 @@ -Hello World from fileTest.txt!!! \ No newline at end of file +Hello, world! \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/test/resources/test_read3.in b/core-java-modules/core-java-io/src/test/resources/fileTestTokenizer.txt similarity index 100% rename from core-java-modules/core-java-io/src/test/resources/test_read3.in rename to core-java-modules/core-java-io/src/test/resources/fileTestTokenizer.txt diff --git a/core-java-modules/core-java-io/src/test/resources/test_read7.in b/core-java-modules/core-java-io/src/test/resources/fileTestUtf8.txt similarity index 100% rename from core-java-modules/core-java-io/src/test/resources/test_read7.in rename to core-java-modules/core-java-io/src/test/resources/fileTestUtf8.txt diff --git a/core-java-modules/core-java-io/src/test/resources/test_read1.in b/core-java-modules/core-java-io/src/test/resources/test_read1.in deleted file mode 100644 index 1e46242993..0000000000 --- a/core-java-modules/core-java-io/src/test/resources/test_read1.in +++ /dev/null @@ -1 +0,0 @@ -Hello world 1 \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/test/resources/test_read2.in b/core-java-modules/core-java-io/src/test/resources/test_read2.in deleted file mode 100644 index fe47dc003b..0000000000 --- a/core-java-modules/core-java-io/src/test/resources/test_read2.in +++ /dev/null @@ -1 +0,0 @@ -2,3 4 \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/test/resources/test_read4.in b/core-java-modules/core-java-io/src/test/resources/test_read4.in deleted file mode 100644 index 5727d54bfcb2046f4989fd13cf5dcf408201fa2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7 OcmZQz^+?Uh$p-)htO5D} diff --git a/core-java-modules/core-java-io/src/test/resources/test_read8.in b/core-java-modules/core-java-io/src/test/resources/test_read8.in deleted file mode 100644 index 10fc1aac8a..0000000000 --- a/core-java-modules/core-java-io/src/test/resources/test_read8.in +++ /dev/null @@ -1,2 +0,0 @@ -Hello world - Test line diff --git a/core-java-modules/core-java-io/src/test/resources/test_read9.in b/core-java-modules/core-java-io/src/test/resources/test_read9.in deleted file mode 100644 index 7be79c9761..0000000000 --- a/core-java-modules/core-java-io/src/test/resources/test_read9.in +++ /dev/null @@ -1 +0,0 @@ -This is a content of the file From f69aee855fa1edde4b50cd64730e688b5b6a16c6 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 16 Feb 2020 21:35:44 +0200 Subject: [PATCH 34/52] Update README.md --- core-java-modules/core-java-io/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-io/README.md b/core-java-modules/core-java-io/README.md index b8bec7aa5e..2c6c3363cb 100644 --- a/core-java-modules/core-java-io/README.md +++ b/core-java-modules/core-java-io/README.md @@ -3,7 +3,7 @@ This module contains articles about core Java input and output (IO) ### Relevant Articles: -- [Java – Read from File](https://www.baeldung.com/java-read-file) +- [How to Read a File in Java](https://www.baeldung.com/reading-file-in-java) - [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) - [Java – Directory Size](https://www.baeldung.com/java-folder-size) - [File Size in Java](https://www.baeldung.com/java-file-size) From d1814a27112ba4f58f05c5d40e5241925bee00d7 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sun, 16 Feb 2020 21:49:31 +0200 Subject: [PATCH 35/52] BAEL-3777: Revert spring boot to previous version --- ddd/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ddd/pom.xml b/ddd/pom.xml index 817e3b8899..f27f1d24a9 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -39,6 +39,7 @@ org.junit.platform junit-platform-launcher + ${junit-platform.version} test @@ -93,7 +94,7 @@ 1.0.1 - 2.2.4.RELEASE + 2.0.6.RELEASE \ No newline at end of file From f33e9961a15d89669ed33dba6575d08098de8b24 Mon Sep 17 00:00:00 2001 From: Seun Matt Date: Sun, 16 Feb 2020 23:07:46 +0100 Subject: [PATCH 36/52] propage exception in example code (#8738) * example code for BAEL-3749 * added live test * added live test * improved exception handling in response log filter * propage exception in example code * updated repo with upstream --- .../src/main/java/com/baeldung/filters/ResponseLogFilter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/src/main/java/com/baeldung/filters/ResponseLogFilter.java b/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/src/main/java/com/baeldung/filters/ResponseLogFilter.java index 1fdd89c7f7..b0e4f7e313 100644 --- a/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/src/main/java/com/baeldung/filters/ResponseLogFilter.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/src/main/java/com/baeldung/filters/ResponseLogFilter.java @@ -12,6 +12,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.POST_TYPE; +import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; @Component public class ResponseLogFilter extends ZuulFilter { @@ -50,7 +51,7 @@ public class ResponseLogFilter extends ZuulFilter { context.setResponseBody(responseData); } catch (Exception e) { - logger.error("error occurred at response log filter", e); + throw new ZuulException(e, INTERNAL_SERVER_ERROR.value(), e.getMessage()); } return null; From dc569151df7109d0eec851ad898cf951786e0b61 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 9 Feb 2020 10:55:23 +0100 Subject: [PATCH 37/52] [BAEL-16532] Moving articles code out of spring-boot-mvc module (as they don't belong there) * Moved reference of Cache Eviction article as code has already been moved --- spring-boot-modules/spring-boot-mvc/README.md | 1 - spring-caching/README.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-mvc/README.md b/spring-boot-modules/spring-boot-mvc/README.md index a83ea3ee25..529a8d7e1f 100644 --- a/spring-boot-modules/spring-boot-mvc/README.md +++ b/spring-boot-modules/spring-boot-mvc/README.md @@ -12,7 +12,6 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Spring Core Annotations](https://www.baeldung.com/spring-core-annotations) - [Display RSS Feed with Spring MVC](https://www.baeldung.com/spring-mvc-rss-feed) - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) -- [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache) - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) - [Conditionally Enable Scheduled Jobs in Spring](https://www.baeldung.com/spring-scheduled-enabled-conditionally) - [Accessing Spring MVC Model Objects in JavaScript](https://www.baeldung.com/spring-mvc-model-objects-js) diff --git a/spring-caching/README.md b/spring-caching/README.md index 14dfe94041..3efbfe3eaa 100644 --- a/spring-caching/README.md +++ b/spring-caching/README.md @@ -2,3 +2,4 @@ - [Introduction To Ehcache](http://www.baeldung.com/ehcache) - [A Guide To Caching in Spring](http://www.baeldung.com/spring-cache-tutorial) - [Spring Cache – Creating a Custom KeyGenerator](http://www.baeldung.com/spring-cache-custom-keygenerator) +- [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache) From e703f71ada7b175ba06f522b1155fb9bd7b3a4fc Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 9 Feb 2020 11:01:39 +0100 Subject: [PATCH 38/52] * Moved Conditional Scheduling to spring-scheduling module --- spring-boot-modules/spring-boot-mvc/README.md | 1 - spring-scheduling/README.md | 1 + spring-scheduling/pom.xml | 4 ++++ .../scheduling/conditional}/ScheduleJobsByProfile.java | 2 +- .../com/baeldung/scheduling/conditional}/ScheduledJob.java | 2 +- .../scheduling/conditional}/ScheduledJobsWithBoolean.java | 2 +- .../scheduling/conditional}/ScheduledJobsWithConditional.java | 2 +- .../scheduling/conditional}/ScheduledJobsWithExpression.java | 2 +- .../scheduling/conditional}/SchedulingApplication.java | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/ScheduleJobsByProfile.java (91%) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/ScheduledJob.java (91%) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/ScheduledJobsWithBoolean.java (94%) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/ScheduledJobsWithConditional.java (93%) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/ScheduledJobsWithExpression.java (93%) rename {spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling => spring-scheduling/src/main/java/com/baeldung/scheduling/conditional}/SchedulingApplication.java (89%) diff --git a/spring-boot-modules/spring-boot-mvc/README.md b/spring-boot-modules/spring-boot-mvc/README.md index 529a8d7e1f..60d41f40da 100644 --- a/spring-boot-modules/spring-boot-mvc/README.md +++ b/spring-boot-modules/spring-boot-mvc/README.md @@ -13,7 +13,6 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Display RSS Feed with Spring MVC](https://www.baeldung.com/spring-mvc-rss-feed) - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) -- [Conditionally Enable Scheduled Jobs in Spring](https://www.baeldung.com/spring-scheduled-enabled-conditionally) - [Accessing Spring MVC Model Objects in JavaScript](https://www.baeldung.com/spring-mvc-model-objects-js) - [Using Spring ResponseEntity to Manipulate the HTTP Response](https://www.baeldung.com/spring-response-entity) - [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations) diff --git a/spring-scheduling/README.md b/spring-scheduling/README.md index 2e3bb2b5e5..ddc540bafb 100644 --- a/spring-scheduling/README.md +++ b/spring-scheduling/README.md @@ -3,4 +3,5 @@ - [The @Scheduled Annotation in Spring](https://www.baeldung.com/spring-scheduled-tasks) - [Guide to Spring Retry](http://www.baeldung.com/spring-retry) - [How To Do @Async in Spring](http://www.baeldung.com/spring-async) +- [Conditionally Enable Scheduled Jobs in Spring](https://www.baeldung.com/spring-scheduled-enabled-conditionally) diff --git a/spring-scheduling/pom.xml b/spring-scheduling/pom.xml index 8726fea438..b27f33196d 100644 --- a/spring-scheduling/pom.xml +++ b/spring-scheduling/pom.xml @@ -27,6 +27,10 @@ org.springframework spring-aspects + + org.springframework.boot + spring-boot-starter-web + javax.annotation javax.annotation-api diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduleJobsByProfile.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduleJobsByProfile.java similarity index 91% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduleJobsByProfile.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduleJobsByProfile.java index 33cd44331f..7783d0e6ff 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduleJobsByProfile.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduleJobsByProfile.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJob.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJob.java similarity index 91% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJob.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJob.java index df7cefcd3c..b56cb9ed5b 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJob.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJob.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithBoolean.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithBoolean.java similarity index 94% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithBoolean.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithBoolean.java index b03de61641..69c0efb7b2 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithBoolean.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithBoolean.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithConditional.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithConditional.java similarity index 93% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithConditional.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithConditional.java index 081c8d990a..2a90300c20 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithConditional.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithConditional.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithExpression.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithExpression.java similarity index 93% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithExpression.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithExpression.java index 577a01f241..4842e649c7 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/ScheduledJobsWithExpression.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/ScheduledJobsWithExpression.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/SchedulingApplication.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/SchedulingApplication.java similarity index 89% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/SchedulingApplication.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/SchedulingApplication.java index 913e2137f8..4777230341 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/scheduling/SchedulingApplication.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/conditional/SchedulingApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.scheduling; +package com.baeldung.scheduling.conditional; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; From 29c8b8bf0d081ad7b33937fb7e4b4a269a0d7f1e Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 9 Feb 2020 11:11:04 +0100 Subject: [PATCH 39/52] * Moved Accessing Spring MVC objects model in JavaScript --- spring-boot-modules/spring-boot-mvc/README.md | 1 - spring-mvc-java/README.md | 1 + .../src/main/java/com/baeldung/accessparamsjs/App.java | 0 .../src/main/java/com/baeldung/accessparamsjs/Controller.java | 4 ++-- .../src/main/resources/templates/thymeleaf/index.html | 0 .../src/main/webapp/js/jquery.js | 0 .../src/main/webapp/js/script-async-jquery.js | 0 .../src/main/webapp/js/script-async.js | 0 .../src/main/webapp/js/script.js | 0 9 files changed, 3 insertions(+), 3 deletions(-) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/java/com/baeldung/accessparamsjs/App.java (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/java/com/baeldung/accessparamsjs/Controller.java (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/resources/templates/thymeleaf/index.html (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/webapp/js/jquery.js (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/webapp/js/script-async-jquery.js (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/webapp/js/script-async.js (100%) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/main/webapp/js/script.js (100%) diff --git a/spring-boot-modules/spring-boot-mvc/README.md b/spring-boot-modules/spring-boot-mvc/README.md index 60d41f40da..8a561e8766 100644 --- a/spring-boot-modules/spring-boot-mvc/README.md +++ b/spring-boot-modules/spring-boot-mvc/README.md @@ -13,7 +13,6 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Display RSS Feed with Spring MVC](https://www.baeldung.com/spring-mvc-rss-feed) - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) -- [Accessing Spring MVC Model Objects in JavaScript](https://www.baeldung.com/spring-mvc-model-objects-js) - [Using Spring ResponseEntity to Manipulate the HTTP Response](https://www.baeldung.com/spring-response-entity) - [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations) - More articles: [[next -->]](/spring-boot-mvc-2) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index ff1f7830b6..f1263860f9 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -16,3 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot) - [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters) - [A Java Web Application Without a web.xml](https://www.baeldung.com/java-web-app-without-web-xml) +- [Accessing Spring MVC Model Objects in JavaScript](https://www.baeldung.com/spring-mvc-model-objects-js) diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/accessparamsjs/App.java b/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/accessparamsjs/App.java rename to spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/accessparamsjs/Controller.java b/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/accessparamsjs/Controller.java rename to spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java index 8759f1bcd6..157dcf54da 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/accessparamsjs/Controller.java +++ b/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java @@ -1,11 +1,11 @@ package com.baeldung.accessparamsjs; -import java.util.Map; - import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; +import java.util.Map; + /** * Sample rest controller for the tutorial article * "Access Spring MVC Model object in JavaScript". diff --git a/spring-boot-modules/spring-boot-mvc/src/main/resources/templates/thymeleaf/index.html b/spring-mvc-java/src/main/resources/templates/thymeleaf/index.html similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/resources/templates/thymeleaf/index.html rename to spring-mvc-java/src/main/resources/templates/thymeleaf/index.html diff --git a/spring-boot-modules/spring-boot-mvc/src/main/webapp/js/jquery.js b/spring-mvc-java/src/main/webapp/js/jquery.js similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/webapp/js/jquery.js rename to spring-mvc-java/src/main/webapp/js/jquery.js diff --git a/spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script-async-jquery.js b/spring-mvc-java/src/main/webapp/js/script-async-jquery.js similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script-async-jquery.js rename to spring-mvc-java/src/main/webapp/js/script-async-jquery.js diff --git a/spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script-async.js b/spring-mvc-java/src/main/webapp/js/script-async.js similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script-async.js rename to spring-mvc-java/src/main/webapp/js/script-async.js diff --git a/spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script.js b/spring-mvc-java/src/main/webapp/js/script.js similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/webapp/js/script.js rename to spring-mvc-java/src/main/webapp/js/script.js From cd745e0b8d239d5321227c39db1edb1acb7c1143 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 9 Feb 2020 11:20:42 +0100 Subject: [PATCH 40/52] * Moved tests as well --- .../java/com/baeldung/accessparamsjs/ControllerUnitTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {spring-boot-modules/spring-boot-mvc => spring-mvc-java}/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java (100%) diff --git a/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java b/spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java rename to spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java index 2dc62a20f6..f05d34b654 100644 --- a/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java @@ -1,7 +1,5 @@ package com.baeldung.accessparamsjs; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -12,6 +10,8 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc From 6cd76fbd61f42a9aa8ff6586e22a38bc615bb597 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 13 Feb 2020 18:23:27 +0100 Subject: [PATCH 41/52] * Moved annotations articles to new spring-boot-annotations module --- spring-boot-modules/pom.xml | 3 ++- .../spring-boot-annotations/pom.xml | 15 +++++++++++++++ .../main/java/com/baeldung/annotations/Bike.java | 0 .../main/java/com/baeldung/annotations/Biker.java | 0 .../main/java/com/baeldung/annotations/Car.java | 0 .../com/baeldung/annotations/CarMechanic.java | 0 .../java/com/baeldung/annotations/CarUtility.java | 0 .../com/baeldung/annotations/CustomException.java | 0 .../java/com/baeldung/annotations/Driver.java | 0 .../java/com/baeldung/annotations/Engine.java | 0 .../baeldung/annotations/PerformanceAspect.java | 0 .../java/com/baeldung/annotations/Vehicle.java | 0 .../baeldung/annotations/VehicleController.java | 0 .../annotations/VehicleFactoryApplication.java | 0 .../annotations/VehicleFactoryConfig.java | 0 .../baeldung/annotations/VehicleRepository.java | 0 .../annotations/VehicleRestController.java | 0 .../com/baeldung/annotations/VehicleService.java | 0 18 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-annotations/pom.xml rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Bike.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Biker.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Car.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/CarMechanic.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/CarUtility.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/CustomException.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Driver.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Engine.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/PerformanceAspect.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/Vehicle.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleController.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleFactoryConfig.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleRepository.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleRestController.java (100%) rename spring-boot-modules/{spring-boot-mvc => spring-boot-annotations}/src/main/java/com/baeldung/annotations/VehicleService.java (100%) diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 0918aa9496..90468ba575 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -16,7 +16,8 @@ spring-boot spring-boot-admin - spring-boot-angular + spring-boot-angular + spring-boot-annotations spring-boot-artifacts spring-boot-autoconfiguration spring-boot-bootstrap diff --git a/spring-boot-modules/spring-boot-annotations/pom.xml b/spring-boot-modules/spring-boot-annotations/pom.xml new file mode 100644 index 0000000000..7436f4539e --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + spring-boot-annotations + spring-boot-annotations + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Bike.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Bike.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Bike.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Bike.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Biker.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Biker.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Biker.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Biker.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Car.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Car.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Car.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Car.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CarMechanic.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CarMechanic.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CarMechanic.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CarMechanic.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CarUtility.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CarUtility.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CarUtility.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CarUtility.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CustomException.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CustomException.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/CustomException.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/CustomException.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Driver.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Driver.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Driver.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Driver.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Engine.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Engine.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Engine.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Engine.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/PerformanceAspect.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/PerformanceAspect.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/PerformanceAspect.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/PerformanceAspect.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Vehicle.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Vehicle.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/Vehicle.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/Vehicle.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleController.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleController.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleController.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleController.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryConfig.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleFactoryConfig.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryConfig.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleFactoryConfig.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleRepository.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleRepository.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleRepository.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleRepository.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleRestController.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleRestController.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleRestController.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleRestController.java diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleService.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleService.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleService.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/VehicleService.java From 3232360885768fd60bd8ded485534cd83dfcd1a5 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 15 Feb 2020 06:53:40 +0100 Subject: [PATCH 42/52] * Added spring-boot-annotations dependencies as well --- .../spring-boot-annotations/pom.xml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spring-boot-modules/spring-boot-annotations/pom.xml b/spring-boot-modules/spring-boot-annotations/pom.xml index 7436f4539e..5c1ef43242 100644 --- a/spring-boot-modules/spring-boot-annotations/pom.xml +++ b/spring-boot-modules/spring-boot-annotations/pom.xml @@ -12,4 +12,24 @@ 0.0.1-SNAPSHOT ../../parent-boot-2 + + + + org.aspectj + aspectjweaver + 1.9.1 + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-test + test + + From ddb928e2d10491765b684adaff87cdc96698bf28 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Mon, 17 Feb 2020 07:30:36 +0100 Subject: [PATCH 43/52] * Moving articles from README as well * Fixed pom.xml whitespaces --- spring-boot-modules/pom.xml | 4 ++-- spring-boot-modules/spring-boot-annotations/README.md | 11 +++++++++++ spring-boot-modules/spring-boot-annotations/pom.xml | 2 +- spring-boot-modules/spring-boot-mvc/README.md | 5 ----- 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 spring-boot-modules/spring-boot-annotations/README.md diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 90468ba575..4c6560e5fd 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -16,8 +16,8 @@ spring-boot spring-boot-admin - spring-boot-angular - spring-boot-annotations + spring-boot-angular + spring-boot-annotations spring-boot-artifacts spring-boot-autoconfiguration spring-boot-bootstrap diff --git a/spring-boot-modules/spring-boot-annotations/README.md b/spring-boot-modules/spring-boot-annotations/README.md new file mode 100644 index 0000000000..a721f28d55 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/README.md @@ -0,0 +1,11 @@ +## Spring Boot Annotations + +This module contains articles about Spring Boot annotations + +### Relevant Articles: + +- [Spring Boot Annotations](https://www.baeldung.com/spring-boot-annotations) +- [Spring Scheduling Annotations](https://www.baeldung.com/spring-scheduling-annotations) +- [Spring Web Annotations](https://www.baeldung.com/spring-mvc-annotations) +- [Spring Core Annotations](https://www.baeldung.com/spring-core-annotations) +- [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations) diff --git a/spring-boot-modules/spring-boot-annotations/pom.xml b/spring-boot-modules/spring-boot-annotations/pom.xml index 5c1ef43242..9ad63214ef 100644 --- a/spring-boot-modules/spring-boot-annotations/pom.xml +++ b/spring-boot-modules/spring-boot-annotations/pom.xml @@ -19,7 +19,7 @@ aspectjweaver 1.9.1 - + org.springframework.boot spring-boot-starter-web diff --git a/spring-boot-modules/spring-boot-mvc/README.md b/spring-boot-modules/spring-boot-mvc/README.md index 8a561e8766..b4f87d1d40 100644 --- a/spring-boot-modules/spring-boot-mvc/README.md +++ b/spring-boot-modules/spring-boot-mvc/README.md @@ -6,13 +6,8 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Guide to the Favicon in Spring Boot](https://www.baeldung.com/spring-boot-favicon) - [Custom Validation MessageSource in Spring Boot](https://www.baeldung.com/spring-custom-validation-message-source) -- [Spring Boot Annotations](https://www.baeldung.com/spring-boot-annotations) -- [Spring Scheduling Annotations](https://www.baeldung.com/spring-scheduling-annotations) -- [Spring Web Annotations](https://www.baeldung.com/spring-mvc-annotations) -- [Spring Core Annotations](https://www.baeldung.com/spring-core-annotations) - [Display RSS Feed with Spring MVC](https://www.baeldung.com/spring-mvc-rss-feed) - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) - [Using Spring ResponseEntity to Manipulate the HTTP Response](https://www.baeldung.com/spring-response-entity) -- [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations) - More articles: [[next -->]](/spring-boot-mvc-2) From 10b69c94af0cd52c83e97e4659630b76da0c5963 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 17 Feb 2020 20:26:07 +0530 Subject: [PATCH 44/52] JAVA-476 Fixed integration failing tests in spring-mvc-xml module --- spring-mvc-xml/pom.xml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index c389e41e29..4812d5c979 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -92,8 +92,8 @@ ${spring-boot.version} test - - + + org.crashub crash.embed.spring @@ -101,16 +101,22 @@ org.crashub - crash.cli + crash.cli ${crash.version} org.crashub crash.connectors.telnet ${crash.version} + + + log4j + log4j + + - - + + org.codehaus.groovy groovy @@ -161,7 +167,7 @@ 1.6.1 - + 1.3.2 3.0.0-rc-3 From 233891c10775e7259c12384757996aa1b9a30bed Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 17 Feb 2020 20:57:44 +0100 Subject: [PATCH 45/52] JAVA-143: Migrate spring-hibernate-3 to com.baeldung --- .../spring-hibernate-3/README.md | 4 +- .../persistence/dao/AbstractHibernateDao.java | 2 +- .../baeldung/persistence/dao/EventDao.java | 36 ++++---- .../baeldung/persistence/dao/FooDao.java | 4 +- .../baeldung/persistence/dao/IEventDao.java | 8 ++ .../com/baeldung/persistence/dao/IFooDao.java | 7 ++ .../baeldung/persistence/dao/IOperations.java | 2 +- .../baeldung/persistence/model/Event.java | 88 +++++++++---------- .../baeldung/persistence/model/Foo.java | 2 +- .../persistence/service/EventService.java | 54 ++++++------ .../persistence/service/FooService.java | 6 +- .../baeldung/spring/PersistenceConfig.java | 6 +- .../spring/PersistenceConfigHibernate3.java | 4 +- .../baeldung/spring/PersistenceXmlConfig.java | 4 +- .../baeldung/persistence/dao/IEventDao.java | 9 -- .../org/baeldung/persistence/dao/IFooDao.java | 7 -- .../src/main/resources/exceptionDemo.cfg.xml | 2 +- .../exceptionDemoPersistenceConfig.xml | 2 +- .../src/main/resources/persistenceConfig.xml | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../baeldung/SpringContextTest.java | 4 +- .../FooServicePersistenceIntegrationTest.java | 7 +- ...nateExceptionScen1MainIntegrationTest.java | 6 +- ...nateExceptionScen2MainIntegrationTest.java | 6 +- ...ingAnnoSessionBeanMainIntegrationTest.java | 84 +++++++++--------- ...ngLocalSessionBeanMainIntegrationTest.java | 77 ++++++++-------- 26 files changed, 216 insertions(+), 219 deletions(-) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/dao/AbstractHibernateDao.java (97%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/dao/EventDao.java (70%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/dao/FooDao.java (73%) create mode 100644 persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IEventDao.java create mode 100644 persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IFooDao.java rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/dao/IOperations.java (89%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/model/Event.java (89%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/model/Foo.java (97%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/service/EventService.java (72%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/persistence/service/FooService.java (75%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/spring/PersistenceConfig.java (94%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/spring/PersistenceConfigHibernate3.java (97%) rename persistence-modules/spring-hibernate-3/src/main/java/{org => com}/baeldung/spring/PersistenceXmlConfig.java (82%) delete mode 100644 persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IEventDao.java delete mode 100644 persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IFooDao.java rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/SpringContextTest.java (88%) rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java (91%) rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java (90%) rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java (91%) rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java (88%) rename persistence-modules/spring-hibernate-3/src/test/java/{org => com}/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java (86%) diff --git a/persistence-modules/spring-hibernate-3/README.md b/persistence-modules/spring-hibernate-3/README.md index 898c6522a9..610d586f85 100644 --- a/persistence-modules/spring-hibernate-3/README.md +++ b/persistence-modules/spring-hibernate-3/README.md @@ -4,8 +4,8 @@ This module contains articles about Spring with Hibernate 3 ### Relevant Articles: -- [Hibernate 3 with Spring](http://www.baeldung.com/hibernate3-spring) -- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](http://www.baeldung.com/no-hibernate-session-bound-to-thread-exception) +- [Hibernate 3 with Spring](https://www.baeldung.com/hibernate3-spring) +- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](https://www.baeldung.com/no-hibernate-session-bound-to-thread-exception) ### Quick Start diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/AbstractHibernateDao.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/AbstractHibernateDao.java similarity index 97% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/AbstractHibernateDao.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/AbstractHibernateDao.java index 0f8b132891..701c6c43c7 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/AbstractHibernateDao.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/AbstractHibernateDao.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/EventDao.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/EventDao.java similarity index 70% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/EventDao.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/EventDao.java index 74da643f35..e6519d54c8 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/EventDao.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/EventDao.java @@ -1,18 +1,18 @@ -package org.baeldung.persistence.dao; - - -import org.baeldung.persistence.model.Event; -import org.springframework.stereotype.Repository; - -@Repository -public class EventDao extends AbstractHibernateDao implements IEventDao { - - public EventDao() { - super(); - - setClazz(Event.class); - } - - // API - -} +package com.baeldung.persistence.dao; + + +import com.baeldung.persistence.model.Event; +import org.springframework.stereotype.Repository; + +@Repository +public class EventDao extends AbstractHibernateDao implements IEventDao { + + public EventDao() { + super(); + + setClazz(Event.class); + } + + // API + +} diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/FooDao.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/FooDao.java similarity index 73% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/FooDao.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/FooDao.java index 23de04169e..afcd958bc2 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/FooDao.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/FooDao.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.stereotype.Repository; @Repository diff --git a/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IEventDao.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IEventDao.java new file mode 100644 index 0000000000..da2be1ce1e --- /dev/null +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IEventDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.model.Event; + + +public interface IEventDao extends IOperations { + // +} diff --git a/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IFooDao.java new file mode 100644 index 0000000000..f79883980a --- /dev/null +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -0,0 +1,7 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.model.Foo; + +public interface IFooDao extends IOperations { + // +} diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IOperations.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IOperations.java similarity index 89% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IOperations.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IOperations.java index 8c5a5e1aed..66f8008f27 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IOperations.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/dao/IOperations.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Event.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Event.java similarity index 89% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Event.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Event.java index 1d659ed75c..37a9758cd5 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Event.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Event.java @@ -1,45 +1,45 @@ -package org.baeldung.persistence.model; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "EVENTS") -public class Event implements Serializable { - - @Id - @GeneratedValue - private Long id; - - private String description; - - public Event() { - } - - - public Event(String description) { - this.description = description; - } - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - +package com.baeldung.persistence.model; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "EVENTS") +public class Event implements Serializable { + + @Id + @GeneratedValue + private Long id; + + private String description; + + public Event() { + } + + + public Event(String description) { + this.description = description; + } + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + } \ No newline at end of file diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Foo.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 97% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Foo.java index 8e1dee33e8..9af3d07bed 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/EventService.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/EventService.java similarity index 72% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/EventService.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/EventService.java index 6171751cc5..bf9afed38b 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/EventService.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/EventService.java @@ -1,27 +1,27 @@ -package org.baeldung.persistence.service; - - -import org.baeldung.persistence.dao.IEventDao; -import org.baeldung.persistence.model.Event; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class EventService { - - @Autowired - private IEventDao dao; - - public EventService() { - super(); - } - - // API - - public void create(final Event entity) { - dao.create(entity); - } - -} +package com.baeldung.persistence.service; + + +import com.baeldung.persistence.model.Event; +import com.baeldung.persistence.dao.IEventDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class EventService { + + @Autowired + private IEventDao dao; + + public EventService() { + super(); + } + + // API + + public void create(final Event entity) { + dao.create(entity); + } + +} diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/FooService.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/FooService.java similarity index 75% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/FooService.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/FooService.java index b07698c438..ad88062216 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/service/FooService.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/persistence/service/FooService.java @@ -1,7 +1,7 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 94% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfig.java index 03b9bfac33..29472174b2 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfig.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import java.util.Properties; @@ -22,7 +22,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) +@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" }) public class PersistenceConfig { @Autowired @@ -36,7 +36,7 @@ public class PersistenceConfig { public AnnotationSessionFactoryBean sessionFactory() { final AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfigHibernate3.java similarity index 97% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfigHibernate3.java index f38da21dc0..08ae9a76df 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceConfigHibernate3.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import java.util.Properties; @@ -24,7 +24,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) +@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" }) public class PersistenceConfigHibernate3 { @Autowired diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java similarity index 82% rename from persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceXmlConfig.java rename to persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java index 5831d2745c..798fb740a7 100644 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceXmlConfig.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ImportResource; @@ -6,7 +6,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; // @Configuration @EnableTransactionManagement -@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) +@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" }) @ImportResource({ "classpath:persistenceConfig.xml" }) public class PersistenceXmlConfig { diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IEventDao.java b/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IEventDao.java deleted file mode 100644 index f7be705905..0000000000 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IEventDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.model.Event; - - - -public interface IEventDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IFooDao.java deleted file mode 100644 index 6a3bd95d71..0000000000 --- a/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/persistence/dao/IFooDao.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.model.Foo; - -public interface IFooDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemo.cfg.xml b/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemo.cfg.xml index 8a710cc559..896c080983 100644 --- a/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemo.cfg.xml +++ b/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemo.cfg.xml @@ -4,6 +4,6 @@ "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> - + diff --git a/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemoPersistenceConfig.xml b/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemoPersistenceConfig.xml index 263e902e7c..5f9e8c0107 100644 --- a/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemoPersistenceConfig.xml +++ b/persistence-modules/spring-hibernate-3/src/main/resources/exceptionDemoPersistenceConfig.xml @@ -16,7 +16,7 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - + diff --git a/persistence-modules/spring-hibernate-3/src/main/resources/persistenceConfig.xml b/persistence-modules/spring-hibernate-3/src/main/resources/persistenceConfig.xml index f39817383b..03d4d022e6 100644 --- a/persistence-modules/spring-hibernate-3/src/main/resources/persistenceConfig.xml +++ b/persistence-modules/spring-hibernate-3/src/main/resources/persistenceConfig.xml @@ -9,7 +9,7 @@ - + ${hibernate.hbm2ddl.auto} diff --git a/persistence-modules/spring-hibernate-3/src/main/webapp/WEB-INF/web.xml b/persistence-modules/spring-hibernate-3/src/main/webapp/WEB-INF/web.xml index ad56bf28c7..69ce04fe06 100644 --- a/persistence-modules/spring-hibernate-3/src/main/webapp/WEB-INF/web.xml +++ b/persistence-modules/spring-hibernate-3/src/main/webapp/WEB-INF/web.xml @@ -11,7 +11,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring org.springframework.web.context.ContextLoaderListener diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/SpringContextTest.java similarity index 88% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/SpringContextTest.java index 956d5279a3..8b352b490d 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.PersistenceConfig; +import com.baeldung.spring.PersistenceConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java similarity index 91% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java index b6e4a5592f..7874f7c679 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java @@ -1,10 +1,9 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.FooService; -import org.baeldung.spring.PersistenceConfig; +import com.baeldung.spring.PersistenceConfig; +import com.baeldung.persistence.model.Foo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java similarity index 90% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java index 08032660c0..99dc7b42be 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java @@ -1,7 +1,7 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfigHibernate3; +import com.baeldung.persistence.model.Event; +import com.baeldung.spring.PersistenceConfigHibernate3; import org.hamcrest.core.IsInstanceOf; import org.hibernate.HibernateException; import org.junit.Ignore; diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java similarity index 91% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java index 44cc6ca010..d3e475a244 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java @@ -1,7 +1,7 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfig; +import com.baeldung.persistence.model.Event; +import com.baeldung.spring.PersistenceConfig; import org.hamcrest.core.IsInstanceOf; import org.hibernate.HibernateException; import org.junit.Ignore; diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java similarity index 88% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java index 2b29dcb7a9..d1c5cc04e6 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest.java @@ -1,42 +1,42 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceXmlConfig; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.orm.hibernate3.HibernateSystemException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceXmlConfig.class }, loader = AnnotationConfigContextLoader.class) -public class NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from Annotation Session Bean Factory")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expect(HibernateSystemException.class); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation of " - + "non-transactional one here"); - service.create(new Event("from Annotation Session Bean Factory")); - } - -} +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Event; +import com.baeldung.spring.PersistenceXmlConfig; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.orm.hibernate3.HibernateSystemException; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceXmlConfig.class }, loader = AnnotationConfigContextLoader.class) +public class NoHibernateSessBoundUsingAnnoSessionBeanMainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from Annotation Session Bean Factory")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expect(HibernateSystemException.class); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation of " + + "non-transactional one here"); + service.create(new Event("from Annotation Session Bean Factory")); + } + +} diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java similarity index 86% rename from persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java index 1bc6c07b18..1df6aa172c 100644 --- a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/com/baeldung/persistence/service/NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest.java @@ -1,39 +1,38 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.model.Event; -import org.hibernate.HibernateException; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.orm.hibernate3.HibernateSystemException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:exceptionDemoPersistenceConfig.xml" }) -public class NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from local session bean factory")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expect(HibernateException.class); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation " - + "of non-transactional one here"); - service.create(new Event("from local session bean factory")); - } -} +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Event; +import org.hibernate.HibernateException; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { "classpath:exceptionDemoPersistenceConfig.xml" }) +public class NoHibernateSessBoundUsingLocalSessionBeanMainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from local session bean factory")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expect(HibernateException.class); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation " + + "of non-transactional one here"); + service.create(new Event("from local session bean factory")); + } +} From 9b18dff3cba243a99454f50a3360d4f87fac1dff Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 17 Feb 2020 21:05:33 +0100 Subject: [PATCH 46/52] JAVA-143: Migrate spring-hibernate4 to com.baeldung --- persistence-modules/spring-hibernate4/README.md | 14 +++++++------- .../{org => com}/baeldung/SpringContextTest.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename persistence-modules/spring-hibernate4/src/test/java/{org => com}/baeldung/SpringContextTest.java (96%) diff --git a/persistence-modules/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md index c9e2b5abfc..cfa13ca3b0 100644 --- a/persistence-modules/spring-hibernate4/README.md +++ b/persistence-modules/spring-hibernate4/README.md @@ -3,13 +3,13 @@ This module contains articles about Spring with Hibernate 4 ### Relevant Articles: -- [Guide to Hibernate 4 with Spring](http://www.baeldung.com/hibernate-4-spring) -- [Hibernate Pagination](http://www.baeldung.com/hibernate-pagination) -- [Sorting with Hibernate](http://www.baeldung.com/hibernate-sort) -- [Stored Procedures with Hibernate](http://www.baeldung.com/stored-procedures-with-hibernate-tutorial) -- [Hibernate: save, persist, update, merge, saveOrUpdate](http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate) -- [Eager/Lazy Loading In Hibernate](http://www.baeldung.com/hibernate-lazy-eager-loading) -- [The DAO with Spring and Hibernate](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) +- [Guide to Hibernate 4 with Spring](https://www.baeldung.com/hibernate-4-spring) +- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination) +- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort) +- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial) +- [Hibernate: save, persist, update, merge, saveOrUpdate](https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate) +- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading) +- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) - [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa) ### Quick Start diff --git a/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java similarity index 96% rename from persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java index 6815ebf304..e19965773e 100644 --- a/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextTest.java +++ b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 173440f519889a0eec3161af8af8765660f79af2 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 17 Feb 2020 21:09:56 +0100 Subject: [PATCH 47/52] JAVA-143: Migrate spring-hibernate-5 to com.baeldung --- persistence-modules/spring-hibernate-5/README.md | 14 +++++++------- .../{org => com}/baeldung/SpringContextTest.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename persistence-modules/spring-hibernate-5/src/test/java/{org => com}/baeldung/SpringContextTest.java (96%) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index a74600a47f..c3c8fa7b9f 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -4,11 +4,11 @@ This module contains articles about Hibernate 5 with Spring. ### Relevant articles -- [Hibernate Many to Many Annotation Tutorial](http://www.baeldung.com/hibernate-many-to-many) -- [Programmatic Transactions in the Spring TestContext Framework](http://www.baeldung.com/spring-test-programmatic-transactions) -- [JPA Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries) -- [Introduction to Hibernate Search](http://www.baeldung.com/hibernate-search) +- [Hibernate Many to Many Annotation Tutorial](https://www.baeldung.com/hibernate-many-to-many) +- [Programmatic Transactions in the Spring TestContext Framework](https://www.baeldung.com/spring-test-programmatic-transactions) +- [JPA Criteria Queries](https://www.baeldung.com/hibernate-criteria-queries) +- [Introduction to Hibernate Search](https://www.baeldung.com/hibernate-search) - [@DynamicUpdate with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-dynamicupdate) -- [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache) -- [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate) -- [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource) +- [Hibernate Second-Level Cache](https://www.baeldung.com/hibernate-second-level-cache) +- [Deleting Objects with Hibernate](https://www.baeldung.com/delete-with-hibernate) +- [Spring, Hibernate and a JNDI Datasource](https://www.baeldung.com/spring-persistence-jpa-jndi-datasource) diff --git a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/SpringContextTest.java similarity index 96% rename from persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextTest.java rename to persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/SpringContextTest.java index 6815ebf304..e19965773e 100644 --- a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextTest.java +++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 4cb11e39451e0678a0db23779a55e5273c99f8c6 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 18 Feb 2020 12:42:05 +0100 Subject: [PATCH 48/52] JAVA-143: Migrate spring-jpa to com.baeldung --- persistence-modules/spring-jpa/README.md | 14 ++++++------- .../annotations/MyUtilityRepository.java | 2 +- .../baeldung/annotations/Person.java | 4 ++-- .../annotations/PersonRepository.java | 2 +- .../baeldung/config/PersistenceJPAConfig.java | 8 ++++---- .../config/PersistenceJPAConfigXml.java | 4 ++-- .../baeldung/config/SpringWebConfig.java | 4 ++-- .../baeldung/config/StudentJpaConfig.java | 6 +++--- .../baeldung/config/WebInitializer.java | 2 +- .../baeldung/dsrouting/ClientDao.java | 2 +- .../dsrouting/ClientDataSourceRouter.java | 2 +- .../baeldung/dsrouting/ClientDatabase.java | 2 +- .../ClientDatabaseContextHolder.java | 2 +- .../baeldung/dsrouting/ClientService.java | 2 +- .../dao/ManyStudentRepository.java | 4 ++-- .../persistence/dao/ManyTagRepository.java | 4 ++-- .../persistence/dao/StudentRepository.java | 4 ++-- .../inmemory/persistence/model/KVTag.java | 2 +- .../persistence/model/LocationTag.java | 2 +- .../persistence/model/ManyStudent.java | 2 +- .../inmemory/persistence/model/ManyTag.java | 2 +- .../inmemory/persistence/model/SkillTag.java | 2 +- .../inmemory/persistence/model/Student.java | 2 +- .../persistence/dao/AbstractJpaDAO.java | 2 +- .../persistence/dao/BookRepository.java | 4 ++-- .../persistence/dao/BookRepositoryCustom.java | 4 ++-- .../persistence/dao/BookRepositoryImpl.java | 4 ++-- .../baeldung/persistence/dao/BookService.java | 8 ++++---- .../persistence/dao/BookSpecifications.java | 4 ++-- .../baeldung/persistence/dao/FooDao.java | 4 ++-- .../baeldung/persistence/dao/IFooDao.java | 4 ++-- .../baeldung/persistence/model/Bar.java | 2 +- .../baeldung/persistence/model/Book.java | 2 +- .../baeldung/persistence/model/Foo.java | 2 +- .../multiple/model/user/Possession.java | 2 +- .../persistence/multiple/model/user/User.java | 2 +- .../persistence/service/FooService.java | 6 +++--- .../baeldung/sqlfiles/Country.java | 2 +- .../baeldung/web/MainController.java | 4 ++-- .../src/main/resources/persistence.xml | 2 +- .../src/test/java/META-INF/persistence.xml | 4 ++-- .../java/com/baeldung/SpringContextTest.java | 2 +- .../DataSourceRoutingIntegrationTest.java | 2 +- .../DataSourceRoutingTestConfiguration.java | 2 +- .../AdvancedTaggingIntegrationTest.java | 20 +++++++++---------- .../repository/InMemoryDBIntegrationTest.java | 8 ++++---- ...oPaginationPersistenceIntegrationTest.java | 6 +++--- .../FooServicePersistenceIntegrationTest.java | 6 +++--- .../FooServiceSortingIntegrationTest.java | 8 ++++---- ...eSortingWitNullsManualIntegrationTest.java | 6 +++--- .../service/PersistenceTestSuite.java | 2 +- 51 files changed, 102 insertions(+), 102 deletions(-) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/annotations/MyUtilityRepository.java (90%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/annotations/Person.java (93%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/annotations/PersonRepository.java (96%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/config/PersistenceJPAConfig.java (94%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/config/PersistenceJPAConfigXml.java (84%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/config/SpringWebConfig.java (92%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/config/StudentJpaConfig.java (94%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/config/WebInitializer.java (95%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/dsrouting/ClientDao.java (95%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/dsrouting/ClientDataSourceRouter.java (91%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/dsrouting/ClientDatabase.java (64%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/dsrouting/ClientDatabaseContextHolder.java (95%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/dsrouting/ClientService.java (94%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/dao/ManyStudentRepository.java (68%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/dao/ManyTagRepository.java (57%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/dao/StudentRepository.java (90%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/KVTag.java (91%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/LocationTag.java (92%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/ManyStudent.java (94%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/ManyTag.java (93%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/SkillTag.java (90%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/inmemory/persistence/model/Student.java (96%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/AbstractJpaDAO.java (96%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/BookRepository.java (76%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/BookRepositoryCustom.java (65%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/BookRepositoryImpl.java (93%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/BookService.java (71%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/BookSpecifications.java (82%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/FooDao.java (73%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/dao/IFooDao.java (74%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/model/Bar.java (98%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/model/Book.java (92%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/model/Foo.java (98%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/multiple/model/user/Possession.java (96%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/multiple/model/user/User.java (96%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/persistence/service/FooService.java (81%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/sqlfiles/Country.java (95%) rename persistence-modules/spring-jpa/src/main/java/{org => com}/baeldung/web/MainController.java (85%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/dsrouting/DataSourceRoutingIntegrationTest.java (98%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/dsrouting/DataSourceRoutingTestConfiguration.java (98%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/repository/AdvancedTaggingIntegrationTest.java (82%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/repository/InMemoryDBIntegrationTest.java (93%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java (97%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java (94%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/service/FooServiceSortingIntegrationTest.java (96%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java (94%) rename persistence-modules/spring-jpa/src/test/java/{org => com}/baeldung/persistence/service/PersistenceTestSuite.java (90%) diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index 489d990fc3..27a2fe8368 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -4,13 +4,13 @@ ### Relevant Articles: -- [The DAO with JPA and Spring](http://www.baeldung.com/spring-dao-jpa) -- [JPA Pagination](http://www.baeldung.com/jpa-pagination) -- [Sorting with JPA](http://www.baeldung.com/jpa-sort) -- [Self-Contained Testing Using an In-Memory Database](http://www.baeldung.com/spring-jpa-test-in-memory-database) -- [A Guide to Spring AbstractRoutingDatasource](http://www.baeldung.com/spring-abstract-routing-data-source) -- [Obtaining Auto-generated Keys in Spring JDBC](http://www.baeldung.com/spring-jdbc-autogenerated-keys) -- [Transactions with Spring 4 and JPA](http://www.baeldung.com/transaction-configuration-with-jpa-and-spring) +- [The DAO with JPA and Spring](https://www.baeldung.com/spring-dao-jpa) +- [JPA Pagination](https://www.baeldung.com/jpa-pagination) +- [Sorting with JPA](https://www.baeldung.com/jpa-sort) +- [Self-Contained Testing Using an In-Memory Database](https://www.baeldung.com/spring-jpa-test-in-memory-database) +- [A Guide to Spring AbstractRoutingDatasource](https://www.baeldung.com/spring-abstract-routing-data-source) +- [Obtaining Auto-generated Keys in Spring JDBC](https://www.baeldung.com/spring-jdbc-autogenerated-keys) +- [Transactions with Spring 4 and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) - [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) - [Spring Persistence (Hibernate and JPA) with a JNDI datasource](https://www.baeldung.com/spring-persistence-hibernate-and-jpa-with-a-jndi-datasource/) diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/MyUtilityRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/MyUtilityRepository.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/MyUtilityRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/MyUtilityRepository.java index 5fe54b80d9..a23e9d9fe4 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/MyUtilityRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/MyUtilityRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.annotations; +package com.baeldung.annotations; import java.io.Serializable; import java.util.Optional; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/Person.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/Person.java similarity index 93% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/Person.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/Person.java index 309a4f43e1..b881535e05 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/Person.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.annotations; +package com.baeldung.annotations; import java.util.Date; @@ -8,7 +8,7 @@ import javax.persistence.NamedStoredProcedureQuery; import javax.persistence.ParameterMode; import javax.persistence.StoredProcedureParameter; -import org.baeldung.persistence.multiple.model.user.User; +import com.baeldung.persistence.multiple.model.user.User; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.Id; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/PersonRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/PersonRepository.java similarity index 96% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/PersonRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/PersonRepository.java index 58558860ff..77b7067f11 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/annotations/PersonRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/annotations/PersonRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.annotations; +package com.baeldung.annotations; import javax.persistence.LockModeType; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfig.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfig.java similarity index 94% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfig.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfig.java index ec0d4bca3c..4eda4d9274 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfig.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import java.util.Properties; @@ -25,8 +25,8 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) -@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao") +@ComponentScan({ "com.baeldung.persistence" }) +@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") public class PersistenceJPAConfig { @Autowired @@ -42,7 +42,7 @@ public class PersistenceJPAConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfigXml.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java similarity index 84% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfigXml.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java index 3df36e62ee..95224a4662 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJPAConfigXml.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ImportResource; @@ -6,7 +6,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; // @Configuration @EnableTransactionManagement -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) @ImportResource({ "classpath:jpaConfig.xml" }) public class PersistenceJPAConfigXml { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/SpringWebConfig.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/SpringWebConfig.java similarity index 92% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/config/SpringWebConfig.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/config/SpringWebConfig.java index 6afb271b10..475970d1f0 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/SpringWebConfig.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/SpringWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -10,7 +10,7 @@ import org.springframework.web.servlet.view.JstlView; @EnableWebMvc @Configuration -@ComponentScan({ "org.baeldung.web" }) +@ComponentScan({ "com.baeldung.web" }) public class SpringWebConfig extends WebMvcConfigurerAdapter { @Bean diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/StudentJpaConfig.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/StudentJpaConfig.java similarity index 94% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/config/StudentJpaConfig.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/config/StudentJpaConfig.java index 17047cbab2..08f37ea806 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/StudentJpaConfig.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/StudentJpaConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import java.util.Properties; @@ -18,7 +18,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration -@EnableJpaRepositories(basePackages = "org.baeldung.inmemory.persistence.dao") +@EnableJpaRepositories(basePackages = "com.baeldung.inmemory.persistence.dao") @PropertySource("persistence-student.properties") @EnableTransactionManagement public class StudentJpaConfig { @@ -41,7 +41,7 @@ public class StudentJpaConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.inmemory.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.inmemory.persistence.model" }); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/WebInitializer.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/WebInitializer.java similarity index 95% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/config/WebInitializer.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/config/WebInitializer.java index cf6e69eb39..be81cca76b 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/WebInitializer.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/config/WebInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDao.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDao.java similarity index 95% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDao.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDao.java index 9e19cf4ed9..e8117ba4fa 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDao.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDao.java @@ -1,4 +1,4 @@ -package org.baeldung.dsrouting; +package com.baeldung.dsrouting; import javax.sql.DataSource; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDataSourceRouter.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDataSourceRouter.java similarity index 91% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDataSourceRouter.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDataSourceRouter.java index 997e461cde..a9f5d83b55 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDataSourceRouter.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDataSourceRouter.java @@ -1,4 +1,4 @@ -package org.baeldung.dsrouting; +package com.baeldung.dsrouting; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabase.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabase.java similarity index 64% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabase.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabase.java index 619b8707d8..d8d178a4d5 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabase.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabase.java @@ -1,4 +1,4 @@ -package org.baeldung.dsrouting; +package com.baeldung.dsrouting; public enum ClientDatabase { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabaseContextHolder.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabaseContextHolder.java similarity index 95% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabaseContextHolder.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabaseContextHolder.java index c08559e877..ae5d16cad2 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientDatabaseContextHolder.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientDatabaseContextHolder.java @@ -1,4 +1,4 @@ -package org.baeldung.dsrouting; +package com.baeldung.dsrouting; import org.springframework.util.Assert; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientService.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientService.java similarity index 94% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientService.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientService.java index 4b63c6333c..59b3d1660a 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/dsrouting/ClientService.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/dsrouting/ClientService.java @@ -1,4 +1,4 @@ -package org.baeldung.dsrouting; +package com.baeldung.dsrouting; /** * Service layer code for datasource routing example. Here, the service methods are responsible diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyStudentRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java similarity index 68% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyStudentRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java index a03b2950a0..a2aa0c5780 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyStudentRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java @@ -1,6 +1,6 @@ -package org.baeldung.inmemory.persistence.dao; +package com.baeldung.inmemory.persistence.dao; -import org.baeldung.inmemory.persistence.model.ManyStudent; +import com.baeldung.inmemory.persistence.model.ManyStudent; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyTagRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java similarity index 57% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyTagRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java index b7d991de32..63337f3cb9 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/ManyTagRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java @@ -1,6 +1,6 @@ -package org.baeldung.inmemory.persistence.dao; +package com.baeldung.inmemory.persistence.dao; -import org.baeldung.inmemory.persistence.model.ManyTag; +import com.baeldung.inmemory.persistence.model.ManyTag; import org.springframework.data.jpa.repository.JpaRepository; public interface ManyTagRepository extends JpaRepository { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/StudentRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/StudentRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java index ffe1a68558..8ac91fbf0c 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/dao/StudentRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java @@ -1,6 +1,6 @@ -package org.baeldung.inmemory.persistence.dao; +package com.baeldung.inmemory.persistence.dao; -import org.baeldung.inmemory.persistence.model.Student; +import com.baeldung.inmemory.persistence.model.Student; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/KVTag.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java similarity index 91% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/KVTag.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java index 1522744116..1fc186f4ce 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/KVTag.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import javax.persistence.Embeddable; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/LocationTag.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java similarity index 92% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/LocationTag.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java index 3acdbbe6fe..b12ad9fbd1 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/LocationTag.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import javax.persistence.Embeddable; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyStudent.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java similarity index 94% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyStudent.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java index 8343edc9cd..190740d582 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyStudent.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import javax.persistence.*; import java.util.HashSet; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyTag.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java similarity index 93% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyTag.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java index e820506544..5af898f7df 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/ManyTag.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import javax.persistence.*; import java.util.HashSet; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/SkillTag.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/SkillTag.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java index 490ee0a18e..738b5d0b36 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/SkillTag.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import javax.persistence.Embeddable; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/Student.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/Student.java similarity index 96% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/Student.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/Student.java index 07aa3ef9ef..f0e824e165 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/inmemory/persistence/model/Student.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/inmemory/persistence/model/Student.java @@ -1,4 +1,4 @@ -package org.baeldung.inmemory.persistence.model; +package com.baeldung.inmemory.persistence.model; import java.util.ArrayList; import java.util.List; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/AbstractJpaDAO.java similarity index 96% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/AbstractJpaDAO.java index 13007d9fcc..b4827cc7e1 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/AbstractJpaDAO.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepository.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepository.java similarity index 76% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepository.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepository.java index 114cf48c7c..48620f4ff1 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepository.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepository.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.Book; +import com.baeldung.persistence.model.Book; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryCustom.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java similarity index 65% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryCustom.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java index b939907572..1b46d0ecc3 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryCustom.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.util.List; -import org.baeldung.persistence.model.Book; +import com.baeldung.persistence.model.Book; public interface BookRepositoryCustom { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryImpl.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java similarity index 93% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryImpl.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java index 6e9aa998d7..241a4c05aa 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookRepositoryImpl.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.util.ArrayList; import java.util.List; @@ -10,7 +10,7 @@ import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; -import org.baeldung.persistence.model.Book; +import com.baeldung.persistence.model.Book; import org.springframework.stereotype.Repository; @Repository diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookService.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java similarity index 71% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookService.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java index 88b769e9bf..f02f9daa11 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookService.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java @@ -1,12 +1,12 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import static org.baeldung.persistence.dao.BookSpecifications.hasAuthor; -import static org.baeldung.persistence.dao.BookSpecifications.titleContains; +import static com.baeldung.persistence.dao.BookSpecifications.hasAuthor; +import static com.baeldung.persistence.dao.BookSpecifications.titleContains; import static org.springframework.data.jpa.domain.Specifications.where; import java.util.List; -import org.baeldung.persistence.model.Book; +import com.baeldung.persistence.model.Book; import org.springframework.stereotype.Service; @Service diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookSpecifications.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java similarity index 82% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookSpecifications.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java index ed9540060d..16646a5b4b 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/BookSpecifications.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.Book; +import com.baeldung.persistence.model.Book; import org.springframework.data.jpa.domain.Specification; public class BookSpecifications { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/FooDao.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/FooDao.java similarity index 73% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/FooDao.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/FooDao.java index 77978c5cf2..a4ed7d97b4 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/FooDao.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/FooDao.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.stereotype.Repository; @Repository diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/IFooDao.java similarity index 74% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/IFooDao.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/IFooDao.java index f5799522e2..8a4877aa79 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/dao/IFooDao.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.util.List; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; public interface IFooDao { diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Bar.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Bar.java similarity index 98% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Bar.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Bar.java index b602e57562..5a88ecc6cf 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Bar.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Bar.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Book.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Book.java similarity index 92% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Book.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Book.java index 754bd179d1..507043dd56 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Book.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Book.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.Entity; import javax.persistence.Id; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 98% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Foo.java index 5294860311..7897bba4e4 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import org.hibernate.annotations.CacheConcurrencyStrategy; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/Possession.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/Possession.java similarity index 96% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/Possession.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/Possession.java index 7aff5f51d0..6ad6b8e603 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/Possession.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/Possession.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.multiple.model.user; +package com.baeldung.persistence.multiple.model.user; import javax.persistence.*; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/User.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/User.java similarity index 96% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/User.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/User.java index 6fb9de4a47..3ebb1e0156 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/multiple/model/user/User.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/multiple/model/user/User.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.multiple.model.user; +package com.baeldung.persistence.multiple.model.user; import javax.persistence.*; import java.util.List; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/service/FooService.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/service/FooService.java similarity index 81% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/service/FooService.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/service/FooService.java index 6d1bb0adbe..ace36dd03b 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/service/FooService.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/service/FooService.java @@ -1,9 +1,9 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; import java.util.List; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/sqlfiles/Country.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/sqlfiles/Country.java similarity index 95% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/sqlfiles/Country.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/sqlfiles/Country.java index 922f55cbf6..f2be33adfd 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/sqlfiles/Country.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/sqlfiles/Country.java @@ -1,4 +1,4 @@ -package org.baeldung.sqlfiles; +package com.baeldung.sqlfiles; import static javax.persistence.GenerationType.IDENTITY; diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/web/MainController.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/web/MainController.java similarity index 85% rename from persistence-modules/spring-jpa/src/main/java/org/baeldung/web/MainController.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/web/MainController.java index 6900482de8..c0d4743ae7 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/web/MainController.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/web/MainController.java @@ -1,6 +1,6 @@ -package org.baeldung.web; +package com.baeldung.web; -import org.baeldung.persistence.service.FooService; +import com.baeldung.persistence.service.FooService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; diff --git a/persistence-modules/spring-jpa/src/main/resources/persistence.xml b/persistence-modules/spring-jpa/src/main/resources/persistence.xml index 6304fa0a65..57687c306d 100644 --- a/persistence-modules/spring-jpa/src/main/resources/persistence.xml +++ b/persistence-modules/spring-jpa/src/main/resources/persistence.xml @@ -11,7 +11,7 @@ - + + + javax.ejb + javax.ejb-api + ${javax.ejb-api.version} + provided + + + + org.springframework + spring-jms + ${springframework.version} + + + commons-logging + commons-logging + + + + + + org.apache.activemq + activemq-broker + ${activemq.broker.version} + + + org.apache.activemq.tooling + activemq-junit + ${activemq.junit.version} + test + org.jboss.arquillian.junit arquillian-junit-container @@ -81,6 +117,10 @@ 1.7.5 3.1.2 1.0.0.CR4 + 3.2 + 5.2.3.RELEASE + 5.10.2 + 5.13.1 diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/messagedriven/RecieverMDB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/messagedriven/RecieverMDB.java new file mode 100644 index 0000000000..7a6b750ce5 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/messagedriven/RecieverMDB.java @@ -0,0 +1,63 @@ +package com.baeldung.ejb.spring.comparison.ejb.messagedriven; + +import javax.annotation.Resource; +import javax.ejb.ActivationConfigProperty; +import javax.ejb.MessageDriven; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.DeliveryMode; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.TextMessage; + +@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }) +public class RecieverMDB implements MessageListener { + + @Resource + private ConnectionFactory connectionFactory; + + @Resource(name = "ackQueue") + private Queue ackQueue; + + public void onMessage(Message message) { + try { + + TextMessage textMessage = (TextMessage) message; + String producerPing = textMessage.getText(); + + if (producerPing.equals("marco")) { + acknowledge("polo"); + } + } catch (JMSException e) { + throw new IllegalStateException(e); + } + } + + private void acknowledge(String text) throws JMSException { + + Connection connection = null; + Session session = null; + + try { + connection = connectionFactory.createConnection(); + connection.start(); + + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + MessageProducer ackSender = session.createProducer(ackQueue); + ackSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + + TextMessage message = session.createTextMessage(text); + + ackSender.send(message); + } finally { + session.close(); + connection.close(); + } + } + +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJB.java new file mode 100644 index 0000000000..b64005aed8 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJB.java @@ -0,0 +1,14 @@ +package com.baeldung.ejb.spring.comparison.ejb.singleton; + +import javax.ejb.Singleton; + +@Singleton +public class CounterEJB implements CounterEJBRemote { + + private int count = 1; + + public int count() { + return count++; + } + +} \ No newline at end of file diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJBRemote.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJBRemote.java new file mode 100644 index 0000000000..ec3b9e9f6b --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/singleton/CounterEJBRemote.java @@ -0,0 +1,8 @@ +package com.baeldung.ejb.spring.comparison.ejb.singleton; + +import javax.ejb.Remote; + +@Remote +public interface CounterEJBRemote { + int count(); +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJB.java new file mode 100644 index 0000000000..5bdccea994 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJB.java @@ -0,0 +1,25 @@ +package com.baeldung.ejb.spring.comparison.ejb.stateful; + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Stateful; + +@Stateful +public class ShoppingCartEJB implements ShoppingCartEJBRemote { + + private List shoppingCart; + + public ShoppingCartEJB() { + shoppingCart = new ArrayList(); + } + + public void addItem(String item) { + shoppingCart.add(item); + } + + public List getItems() { + return shoppingCart; + } + +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJBRemote.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJBRemote.java new file mode 100644 index 0000000000..a8d7a15d25 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateful/ShoppingCartEJBRemote.java @@ -0,0 +1,13 @@ +package com.baeldung.ejb.spring.comparison.ejb.stateful; + +import java.util.List; + +import javax.ejb.Remote; + +@Remote +public interface ShoppingCartEJBRemote { + + void addItem(String item); + + List getItems(); +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJB.java new file mode 100644 index 0000000000..fb45e4e7ce --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJB.java @@ -0,0 +1,25 @@ +package com.baeldung.ejb.spring.comparison.ejb.stateless; + +import java.util.HashMap; +import java.util.Map; + +import javax.ejb.Stateless; + +@Stateless +public class FinderEJB implements FinderEJBRemote { + + private Map alphabet; + + public FinderEJB() { + alphabet = new HashMap(); + alphabet.put("A", "Apple"); + alphabet.put("B", "Ball"); + alphabet.put("C", "Cat"); + alphabet.put("D", "Dog"); + } + + public String search(String keyword) { + return alphabet.get(keyword); + } + +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJBRemote.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJBRemote.java new file mode 100644 index 0000000000..36b4c9ae04 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/ejb/stateless/FinderEJBRemote.java @@ -0,0 +1,9 @@ +package com.baeldung.ejb.spring.comparison.ejb.stateless; + +import javax.ejb.Remote; + +@Remote +public interface FinderEJBRemote { + + String search(String keyword); +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/config/ApplicationConfig.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/config/ApplicationConfig.java new file mode 100644 index 0000000000..6ec14dc098 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/config/ApplicationConfig.java @@ -0,0 +1,36 @@ +package com.baeldung.ejb.spring.comparison.spring.config; + +import javax.jms.ConnectionFactory; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.jms.annotation.EnableJms; +import org.springframework.jms.config.DefaultJmsListenerContainerFactory; +import org.springframework.jms.core.JmsTemplate; + +@Configuration +@ComponentScan(basePackages = "com.baeldung.ejb.spring.comparison.spring") +@EnableJms +public class ApplicationConfig { + + @Bean + public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() { + DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); + factory.setConnectionFactory(connectionFactory()); + return factory; + } + + @Bean + public ConnectionFactory connectionFactory() { + return new ActiveMQConnectionFactory("tcp://localhost:61616"); + } + + @Bean + public JmsTemplate jmsTemplate() { + JmsTemplate template = new JmsTemplate(connectionFactory()); + template.setConnectionFactory(connectionFactory()); + return template; + } +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Producer.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Producer.java new file mode 100644 index 0000000000..a60dc4db8e --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Producer.java @@ -0,0 +1,19 @@ +package com.baeldung.ejb.spring.comparison.spring.messagedriven; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.stereotype.Component; + +@Component +public class Producer { + @Autowired + private JmsTemplate jmsTemplate; + + public void sendMessageToDefaultDestination(final String message) { + jmsTemplate.convertAndSend("myQueue", message); + } + + public String receiveAck() { + return (String) jmsTemplate.receiveAndConvert("ackQueue"); + } +} \ No newline at end of file diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Receiver.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Receiver.java new file mode 100644 index 0000000000..a3b36dd587 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/messagedriven/Receiver.java @@ -0,0 +1,22 @@ +package com.baeldung.ejb.spring.comparison.spring.messagedriven; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jms.annotation.JmsListener; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.stereotype.Component; + +@Component +public class Receiver { + @Autowired + private JmsTemplate jmsTemplate; + + @JmsListener(destination = "myQueue") + public void receiveMessage(String msg) { + sendAck(); + } + + private void sendAck() { + jmsTemplate.convertAndSend("ackQueue", "polo"); + } + +} \ No newline at end of file diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/singleton/CounterBean.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/singleton/CounterBean.java new file mode 100644 index 0000000000..6456cfc007 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/singleton/CounterBean.java @@ -0,0 +1,12 @@ +package com.baeldung.ejb.spring.comparison.spring.singleton; + +import org.springframework.stereotype.Component; + +@Component +public class CounterBean { + private int count = 1; + + public int count() { + return count++; + } +} diff --git a/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/stateful/ShoppingCartBean.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/stateful/ShoppingCartBean.java new file mode 100644 index 0000000000..9286ff9950 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/spring/comparison/spring/stateful/ShoppingCartBean.java @@ -0,0 +1,28 @@ +package com.baeldung.ejb.spring.comparison.spring.stateful; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Component +@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class ShoppingCartBean { + + private List shoppingCart; + + public ShoppingCartBean() { + shoppingCart = new ArrayList(); + } + + public void addItem(String item) { + shoppingCart.add(item); + } + + public List getItems() { + return shoppingCart; + } + +} diff --git a/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/ejb/EJBUnitTest.java b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/ejb/EJBUnitTest.java new file mode 100644 index 0000000000..1f0f1bf8a4 --- /dev/null +++ b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/ejb/EJBUnitTest.java @@ -0,0 +1,142 @@ +package com.baeldung.ejb.spring.comparison.ejb; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.embeddable.EJBContainer; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.naming.Context; +import javax.naming.NamingException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baeldung.ejb.spring.comparison.ejb.singleton.CounterEJBRemote; +import com.baeldung.ejb.spring.comparison.ejb.stateful.ShoppingCartEJBRemote; +import com.baeldung.ejb.spring.comparison.ejb.stateless.FinderEJBRemote; + +public class EJBUnitTest { + + private static EJBContainer ejbContainer = null; + + private static Context context = null; + + @Resource + private ConnectionFactory connectionFactory; + + @EJB + private FinderEJBRemote alphabetFinder; + + @Resource(name = "myQueue") + private Queue myQueue; + + @Resource(name = "ackQueue") + private Queue ackQueue; + + @BeforeClass + public static void start() throws NamingException { + ejbContainer = EJBContainer.createEJBContainer(); + } + + @Before + public void initializeContext() throws NamingException { + context = ejbContainer.getContext(); + context.bind("inject", this); + } + + @Test + public void givenSingletonBean_whenCounterInvoked_thenCountIsIncremented() throws NamingException { + + int count = 0; + CounterEJBRemote counterEJB = (CounterEJBRemote) context.lookup("java:global/ejb-beans/CounterEJB"); + + for (int i = 0; i < 10; i++) + count = counterEJB.count(); + + assertThat(count, is(not(1))); + } + + @Test + public void givenSingletonBean_whenCounterInvokedAgain_thenCountIsIncremented() throws NamingException { + + CounterEJBRemote counterEJB = (CounterEJBRemote) context.lookup("java:global/ejb-beans/CounterEJB"); + + int count = 0; + for (int i = 0; i < 10; i++) + count = counterEJB.count(); + + assertThat(count, is(not(1))); + } + + @Test + public void givenStatefulBean_whenBathingCartWithThreeItemsAdded_thenItemsSizeIsThree() throws NamingException { + ShoppingCartEJBRemote bathingCart = (ShoppingCartEJBRemote) context.lookup("java:global/ejb-beans/ShoppingCartEJB"); + + bathingCart.addItem("soap"); + bathingCart.addItem("shampoo"); + bathingCart.addItem("oil"); + + assertEquals(3, bathingCart.getItems() + .size()); + } + + @Test + public void givenStatefulBean_whenFruitCartWithTwoItemsAdded_thenItemsSizeIsTwo() throws NamingException { + ShoppingCartEJBRemote fruitCart = (ShoppingCartEJBRemote) context.lookup("java:global/ejb-beans/ShoppingCartEJB"); + + fruitCart.addItem("apples"); + fruitCart.addItem("oranges"); + + assertEquals(2, fruitCart.getItems() + .size()); + } + + @Test + public void givenStatelessBean_whenSearchForA_thenApple() throws NamingException { + + assertEquals("Apple", alphabetFinder.search("A")); + } + + @Test + public void givenMDB_whenMessageSent_thenAcknowledgementReceived() throws InterruptedException, JMSException, NamingException { + + Connection connection = connectionFactory.createConnection(); + connection.start(); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer producer = session.createProducer(myQueue); + producer.send(session.createTextMessage("marco")); + MessageConsumer response = session.createConsumer(ackQueue); + + assertEquals("polo", ((TextMessage) response.receive(1000)).getText()); + + } + + @After + public void reset() throws NamingException { + context.unbind("inject"); + } + + @AfterClass + public static void checkTotalCountAndcloseContext() throws NamingException { + CounterEJBRemote counterEJB = (CounterEJBRemote) context.lookup("java:global/ejb-beans/CounterEJB"); + assertEquals(21, counterEJB.count()); + + context.close(); + ejbContainer.close(); + } + +} diff --git a/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/spring/SpringUnitTest.java b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/spring/SpringUnitTest.java new file mode 100644 index 0000000000..a346baba38 --- /dev/null +++ b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/spring/comparison/spring/SpringUnitTest.java @@ -0,0 +1,108 @@ +package com.baeldung.ejb.spring.comparison.spring; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import javax.naming.NamingException; + +import org.apache.activemq.junit.EmbeddedActiveMQBroker; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +import com.baeldung.ejb.spring.comparison.spring.config.ApplicationConfig; +import com.baeldung.ejb.spring.comparison.spring.messagedriven.Producer; +import com.baeldung.ejb.spring.comparison.spring.singleton.CounterBean; +import com.baeldung.ejb.spring.comparison.spring.stateful.ShoppingCartBean; + +public class SpringUnitTest { + + private static AnnotationConfigApplicationContext context = null; + + @ClassRule + public static EmbeddedActiveMQBroker broker = new EmbeddedActiveMQBroker() { + @Override + protected void configure() { + this.getBrokerService() + .setUseJmx(true); + try { + this.getBrokerService() + .addConnector("tcp://localhost:61616"); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + }; + + @BeforeClass + public static void init() { + context = new AnnotationConfigApplicationContext(ApplicationConfig.class); + } + + @Test + public void whenCounterInvoked_thenCountIsIncremented() throws NamingException { + CounterBean counterBean = context.getBean(CounterBean.class); + + int count = 0; + for (int i = 0; i < 10; i++) + count = counterBean.count(); + + assertThat(count, is(not(1))); + } + + @Test + public void whenCounterInvokedAgain_thenCountIsIncremented() throws NamingException { + CounterBean counterBean = context.getBean(CounterBean.class); + + int count = 0; + for (int i = 0; i < 10; i++) + count = counterBean.count(); + + assertThat(count, is(not(1))); + } + + @Test + public void whenBathingCartWithThreeItemsAdded_thenItemsSizeIsThree() throws NamingException { + ShoppingCartBean bathingCart = context.getBean(ShoppingCartBean.class); + + bathingCart.addItem("soap"); + bathingCart.addItem("shampoo"); + bathingCart.addItem("oil"); + + assertEquals(3, bathingCart.getItems() + .size()); + } + + @Test + public void whenFruitCartWithTwoItemsAdded_thenItemsSizeIsTwo() throws NamingException { + ShoppingCartBean fruitCart = context.getBean(ShoppingCartBean.class); + + fruitCart.addItem("apples"); + fruitCart.addItem("oranges"); + + assertEquals(2, fruitCart.getItems() + .size()); + } + + @Test + public void givenJMSBean_whenMessageSent_thenAcknowledgementReceived() throws NamingException { + Producer producer = context.getBean(Producer.class); + producer.sendMessageToDefaultDestination("marco"); + + assertEquals("polo", producer.receiveAck()); + } + + @AfterClass + public static void checkTotalCountAndcloseContext() throws NamingException { + CounterBean counterBean = context.getBean(CounterBean.class); + int count = counterBean.count(); + assertEquals(21, count); + context.close(); + } + +} From 67f29a37cdc2c4fe5ac00646364c88125ee447b1 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 19 Feb 2020 22:31:43 +0100 Subject: [PATCH 50/52] BAEL-3799: Update spring-5 to the Spring Boot 2.2.2 (#8754) --- spring-5/pom.xml | 1 - .../com/baeldung/restdocs/CRUDController.java | 2 +- .../baeldung/restdocs/IndexController.java | 20 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/spring-5/pom.xml b/spring-5/pom.xml index a242c29933..eadfb5e512 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -149,7 +149,6 @@ - 2.1.9.RELEASE 1.0 1.5.6 4.1 diff --git a/spring-5/src/main/java/com/baeldung/restdocs/CRUDController.java b/spring-5/src/main/java/com/baeldung/restdocs/CRUDController.java index 429d3f433a..b10cfd5f55 100644 --- a/spring-5/src/main/java/com/baeldung/restdocs/CRUDController.java +++ b/spring-5/src/main/java/com/baeldung/restdocs/CRUDController.java @@ -1,6 +1,6 @@ package com.baeldung.restdocs; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import java.util.ArrayList; import java.util.List; diff --git a/spring-5/src/main/java/com/baeldung/restdocs/IndexController.java b/spring-5/src/main/java/com/baeldung/restdocs/IndexController.java index 2c58d5fe6b..b1516f43c5 100644 --- a/spring-5/src/main/java/com/baeldung/restdocs/IndexController.java +++ b/spring-5/src/main/java/com/baeldung/restdocs/IndexController.java @@ -1,21 +1,25 @@ package com.baeldung.restdocs; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; - -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.Link; +import org.springframework.hateoas.RepresentationModel; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; + @RestController @RequestMapping("/") public class IndexController { - @GetMapping - public ResourceSupport index() { - ResourceSupport index = new ResourceSupport(); - index.add(linkTo(CRUDController.class).withRel("crud")); - return index; + static class CustomRepresentationModel extends RepresentationModel { + public CustomRepresentationModel(Link initialLink) { + super(initialLink); + } } + @GetMapping + public CustomRepresentationModel index() { + return new CustomRepresentationModel(linkTo(CRUDController.class).withRel("crud")); + } } \ No newline at end of file From 1ad0bfaf298178e1ac3f46ecde3afc94512dc972 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 19 Feb 2020 22:34:10 +0100 Subject: [PATCH 51/52] BAEL-3804: Update spring-mvc-java to use latest Spring Boot version (#8747) --- spring-mvc-java/pom.xml | 2 -- .../config/CustomWebMvcConfigurationSupport.java | 14 +++++++------- .../controller/GreetControllerIntegrationTest.java | 2 +- .../web/controller/GreetControllerUnitTest.java | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 0f3a1d65b9..079a664a5d 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -223,8 +223,6 @@ - 2.1.9.RELEASE - 3.0.9.RELEASE diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/CustomWebMvcConfigurationSupport.java b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/CustomWebMvcConfigurationSupport.java index 4a9f6a3431..a0dd7358d0 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/CustomWebMvcConfigurationSupport.java +++ b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/CustomWebMvcConfigurationSupport.java @@ -1,17 +1,17 @@ package com.baeldung.spring.web.config; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; @Configuration public class CustomWebMvcConfigurationSupport extends WebMvcConfigurationSupport { - @Bean - public RequestMappingHandlerMapping requestMappingHandlerMapping() { - RequestMappingHandlerMapping handlerMapping = super.requestMappingHandlerMapping(); - handlerMapping.setUseSuffixPatternMatch(false); - return handlerMapping; + @Override + protected PathMatchConfigurer getPathMatchConfigurer() { + PathMatchConfigurer pathMatchConfigurer = super.getPathMatchConfigurer(); + pathMatchConfigurer.setUseSuffixPatternMatch(false); + + return pathMatchConfigurer; } } diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java index 079ea3e5cd..3d34a46791 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java @@ -32,7 +32,7 @@ public class GreetControllerIntegrationTest { private MockMvc mockMvc; - private static final String CONTENT_TYPE = "application/json;charset=UTF-8"; + private static final String CONTENT_TYPE = "application/json"; @Before public void setup() throws Exception { diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java index 0475bd933d..eacd256438 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java @@ -16,7 +16,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; public class GreetControllerUnitTest { private MockMvc mockMvc; - private static final String CONTENT_TYPE = "application/json;charset=UTF-8"; + private static final String CONTENT_TYPE = "application/json"; @Before public void setup() { From 059a9e6a51d065cca716a6f57d48061b136c0887 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 19 Feb 2020 22:36:27 +0100 Subject: [PATCH 52/52] BAEL-3801: Update spring-boot-rest to use latest Spring Boot version (#8740) * BAEL-3801: Upgrade to Spring Boot 2.2.2 * BAEL-3801: Fix JacksonMarshaller * BAEL-3801: Get rid of deprecated HATEOAS classes * BAEL-3801: Fix H2 tables drop order * BAEL-3801: Remove commented property from pom.xml --- spring-boot-rest/pom.xml | 1 - .../persistence/config/CustomH2Dialect.java | 26 +++++++++++++++++++ .../baeldung/persistence/model/Customer.java | 9 +++---- .../com/baeldung/persistence/model/Order.java | 4 +-- .../web/controller/CustomerController.java | 14 +++++----- .../main/resources/persistence-h2.properties | 2 +- .../com/baeldung/test/JacksonMarshaller.java | 2 +- 7 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 spring-boot-rest/src/main/java/com/baeldung/persistence/config/CustomH2Dialect.java diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 2483aab6be..10dacf99e8 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -95,7 +95,6 @@ 27.0.1-jre 1.4.11.1 2.3.5 - 2.1.9.RELEASE diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/config/CustomH2Dialect.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/config/CustomH2Dialect.java new file mode 100644 index 0000000000..0108f92b2c --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/config/CustomH2Dialect.java @@ -0,0 +1,26 @@ +package com.baeldung.persistence.config; + +import org.hibernate.dialect.H2Dialect; + +/** + * Since H2 1.4.200. the behavior of the drop table commands has changed. + * Tables are not dropped in a correct order. + * Until this is properly fixed directly in Hibernate project, + * let's use this custom H2Dialect class to solve this issue. + * + * @see https://hibernate.atlassian.net/browse/HHH-13711 + * @see https://github.com/hibernate/hibernate-orm/pull/3093 + */ +public class CustomH2Dialect extends H2Dialect { + + @Override + public boolean dropConstraints() { + return true; + } + + @Override + public boolean supportsIfExistsAfterAlterTable() { + return true; + } + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Customer.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Customer.java index 10da2e10f0..06b2485c7b 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Customer.java +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Customer.java @@ -1,14 +1,13 @@ package com.baeldung.persistence.model; -import java.util.Map; - -import org.springframework.hateoas.ResourceSupport; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.springframework.hateoas.RepresentationModel; + +import java.util.Map; @JsonInclude(Include.NON_NULL) -public class Customer extends ResourceSupport { +public class Customer extends RepresentationModel { private String customerId; private String customerName; private String companyName; diff --git a/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Order.java b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Order.java index 7aea9bce5c..b5e1a2cee2 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Order.java +++ b/spring-boot-rest/src/main/java/com/baeldung/persistence/model/Order.java @@ -1,8 +1,8 @@ package com.baeldung.persistence.model; -import org.springframework.hateoas.ResourceSupport; +import org.springframework.hateoas.RepresentationModel; -public class Order extends ResourceSupport { +public class Order extends RepresentationModel { private String orderId; private double price; private int quantity; diff --git a/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java b/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java index 91aa9f2144..2b7dc1eee1 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/web/controller/CustomerController.java @@ -1,13 +1,13 @@ package com.baeldung.web.controller; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.Link; -import org.springframework.hateoas.Resources; +import org.springframework.hateoas.CollectionModel; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; import org.springframework.web.bind.annotation.GetMapping; @@ -41,7 +41,7 @@ public class CustomerController { } @GetMapping(value = "/{customerId}/orders", produces = { "application/hal+json" }) - public Resources getOrdersForCustomer(@PathVariable final String customerId) { + public CollectionModel getOrdersForCustomer(@PathVariable final String customerId) { final List orders = orderService.getAllOrdersForCustomer(customerId); for (final Order order : orders) { final Link selfLink = linkTo( @@ -50,12 +50,12 @@ public class CustomerController { } Link link = linkTo(methodOn(CustomerController.class).getOrdersForCustomer(customerId)).withSelfRel(); - Resources result = new Resources<>(orders, link); + CollectionModel result = new CollectionModel<>(orders, link); return result; } @GetMapping(produces = { "application/hal+json" }) - public Resources getAllCustomers() { + public CollectionModel getAllCustomers() { final List allCustomers = customerService.allCustomers(); for (final Customer customer : allCustomers) { @@ -72,7 +72,7 @@ public class CustomerController { } Link link = linkTo(CustomerController.class).withSelfRel(); - Resources result = new Resources<>(allCustomers, link); + CollectionModel result = new CollectionModel<>(allCustomers, link); return result; } diff --git a/spring-boot-rest/src/main/resources/persistence-h2.properties b/spring-boot-rest/src/main/resources/persistence-h2.properties index 839a466533..efbf3f7db7 100644 --- a/spring-boot-rest/src/main/resources/persistence-h2.properties +++ b/spring-boot-rest/src/main/resources/persistence-h2.properties @@ -17,6 +17,6 @@ jdbc.user=sa jdbc.pass= # hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.dialect=com.baeldung.persistence.config.CustomH2Dialect hibernate.show_sql=false hibernate.hbm2ddl.auto=create-drop diff --git a/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java b/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java index 23b5d60b6b..0f89e0a9de 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java +++ b/spring-boot-rest/src/test/java/com/baeldung/test/JacksonMarshaller.java @@ -60,7 +60,7 @@ public final class JacksonMarshaller implements IMarshaller { List entities = null; try { if (clazz.equals(Foo.class)) { - entities = objectMapper.readValue(resourcesAsString, new TypeReference>() { + entities = objectMapper.readValue(resourcesAsString, new TypeReference>() { // ... }); } else {