From 238e75eec9e79dd09a269d6b921f76169247b3c0 Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Sun, 19 May 2019 22:03:12 +0200 Subject: [PATCH 01/70] added parent module for spring boot 2.2 added module for spring boot 2.2 added example for lazy initialization in spring boot 2.2 --- parent-boot-2-2/README.md | 2 + parent-boot-2-2/pom.xml | 91 +++++++++++++++++++ spring-boot-2-2/pom.xml | 45 +++++++++ .../lazyinitialization/Application.java | 32 +++++++ .../lazyinitialization/services/Writer.java | 16 ++++ .../src/main/resources/application.yml | 3 + 6 files changed, 189 insertions(+) create mode 100644 parent-boot-2-2/README.md create mode 100644 parent-boot-2-2/pom.xml create mode 100644 spring-boot-2-2/pom.xml create mode 100644 spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java create mode 100644 spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java create mode 100644 spring-boot-2-2/src/main/resources/application.yml diff --git a/parent-boot-2-2/README.md b/parent-boot-2-2/README.md new file mode 100644 index 0000000000..d2bd6d660b --- /dev/null +++ b/parent-boot-2-2/README.md @@ -0,0 +1,2 @@ + +This is a parent module for all projects using Spring Boot 2.2. diff --git a/parent-boot-2-2/pom.xml b/parent-boot-2-2/pom.xml new file mode 100644 index 0000000000..59611c9044 --- /dev/null +++ b/parent-boot-2-2/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + parent-boot-2-2 + 0.0.1-SNAPSHOT + parent-boot-2-2 + pom + Parent for all Spring Boot 2.2 modules + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + io.rest-assured + rest-assured + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + thin-jar + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.springframework.boot.experimental + spring-boot-thin-layout + ${thin.version} + + + + + + + + + + 3.1.0 + + 1.0.21.RELEASE + 2.2.0.M3 + + diff --git a/spring-boot-2-2/pom.xml b/spring-boot-2-2/pom.xml new file mode 100644 index 0000000000..4390e29b60 --- /dev/null +++ b/spring-boot-2-2/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + spring-boot-2-2 + spring-boot-2-2 + war + This is simple boot application for Spring boot 2.2 + + + parent-boot-2-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2-2 + + + + + org.springframework.boot + spring-boot-starter + + + + + spring-boot-2-2 + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-war-plugin + + + + + + + com.baeldung.lazyinitialization.Application + + \ No newline at end of file diff --git a/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java b/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java new file mode 100644 index 0000000000..195b260399 --- /dev/null +++ b/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java @@ -0,0 +1,32 @@ +package com.baeldung.lazyinitialization; + +import com.baeldung.lazyinitialization.services.Writer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class Application { + + @Bean("writer1") + public Writer getWriter1() { + return new Writer("Writer 1"); + } + + @Bean("writer2") + public Writer getWriter2() { + return new Writer("Writer 2"); + } + + public static void main(String[] args) { + ApplicationContext ctx = SpringApplication.run(Application.class, args); + System.out.println("Application context initialized!!!"); + + Writer writer1 = ctx.getBean("writer1", Writer.class); + writer1.write("First message"); + + Writer writer2 = ctx.getBean("writer2", Writer.class); + writer2.write("Second message"); + } +} diff --git a/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java b/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java new file mode 100644 index 0000000000..7c67fb7ea4 --- /dev/null +++ b/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java @@ -0,0 +1,16 @@ +package com.baeldung.lazyinitialization.services; + +public class Writer { + + private final String writerId; + + public Writer(String writerId) { + this.writerId = writerId; + System.out.println(writerId + " initialized!!!"); + } + + public void write(String message) { + System.out.println(writerId + ": " + message); + } + +} diff --git a/spring-boot-2-2/src/main/resources/application.yml b/spring-boot-2-2/src/main/resources/application.yml new file mode 100644 index 0000000000..25f03eed56 --- /dev/null +++ b/spring-boot-2-2/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + main: + lazy-initialization: true \ No newline at end of file From ab8684f9169fc6d8ade3f9932de4142660d9e157 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 May 2019 11:40:50 -0600 Subject: [PATCH 02/70] BAEL-2958: Jest client examples --- jest/jest-demo/.gitignore | 29 ++ .../.mvn/wrapper/MavenWrapperDownloader.java | 114 +++++++ jest/jest-demo/.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 48337 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + jest/jest-demo/mvnw | 286 ++++++++++++++++++ jest/jest-demo/mvnw.cmd | 161 ++++++++++ jest/jest-demo/pom.xml | 53 ++++ .../main/java/com/baeldung/jest/Employee.java | 42 +++ .../jest/JestClientConfiguration.java | 32 ++ .../baeldung/jest/JestDemoApplication.java | 147 +++++++++ .../src/main/resources/application.properties | 1 + .../jest/JestDemoApplicationTests.java | 16 + 12 files changed, 882 insertions(+) create mode 100644 jest/jest-demo/.gitignore create mode 100644 jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 jest/jest-demo/.mvn/wrapper/maven-wrapper.jar create mode 100644 jest/jest-demo/.mvn/wrapper/maven-wrapper.properties create mode 100755 jest/jest-demo/mvnw create mode 100644 jest/jest-demo/mvnw.cmd create mode 100644 jest/jest-demo/pom.xml create mode 100644 jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java create mode 100644 jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java create mode 100644 jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java create mode 100644 jest/jest-demo/src/main/resources/application.properties create mode 100644 jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java diff --git a/jest/jest-demo/.gitignore b/jest/jest-demo/.gitignore new file mode 100644 index 0000000000..153c9335eb --- /dev/null +++ b/jest/jest-demo/.gitignore @@ -0,0 +1,29 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ + +### VS Code ### +.vscode/ diff --git a/jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java b/jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..7f91a56ea7 --- /dev/null +++ b/jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/jest/jest-demo/.mvn/wrapper/maven-wrapper.jar b/jest/jest-demo/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..01e67997377a393fd672c7dcde9dccbedf0cb1e9 GIT binary patch literal 48337 zcmbTe1CV9Qwl>;j+wQV$+qSXFw%KK)%eHN!%U!l@+x~l>b1vR}@9y}|TM-#CBjy|< zb7YRpp)Z$$Gzci_H%LgxZ{NNV{%Qa9gZlF*E2<($D=8;N5Asbx8se{Sz5)O13x)rc z5cR(k$_mO!iis+#(8-D=#R@|AF(8UQ`L7dVNSKQ%v^P|1A%aF~Lye$@HcO@sMYOb3 zl`5!ThJ1xSJwsg7hVYFtE5vS^5UE0$iDGCS{}RO;R#3y#{w-1hVSg*f1)7^vfkxrm!!N|oTR0Hj?N~IbVk+yC#NK} z5myv()UMzV^!zkX@O=Yf!(Z_bF7}W>k*U4@--&RH0tHiHY0IpeezqrF#@8{E$9d=- z7^kT=1Bl;(Q0k{*_vzz1Et{+*lbz%mkIOw(UA8)EE-Pkp{JtJhe@VXQ8sPNTn$Vkj zicVp)sV%0omhsj;NCmI0l8zzAipDV#tp(Jr7p_BlL$}Pys_SoljztS%G-Wg+t z&Q#=<03Hoga0R1&L!B);r{Cf~b$G5p#@?R-NNXMS8@cTWE^7V!?ixz(Ag>lld;>COenWc$RZ61W+pOW0wh>sN{~j; zCBj!2nn|4~COwSgXHFH?BDr8pK323zvmDK-84ESq25b;Tg%9(%NneBcs3;r znZpzntG%E^XsSh|md^r-k0Oen5qE@awG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-VDO;3=^E;fhW~b=Wd5r8otQrO{Vu)M1{j(+?+^q%xpYCojc6rmQ<&ytZ2ly?bw*X)WB8(n^B4Gmxr^1bQ&=m;I4O$g{ z3m|M{tmkOyAPnMHu(Z}Q1X1GM|A+)VDP3Fz934zSl)z>N|D^`G-+>Mej|VcK+?iew zQ3=DH4zz;i>z{Yv_l@j*?{936kxM{c7eK$1cf8wxL>>O#`+vsu*KR)te$adfTD*w( zAStXnZk<6N3V-Vs#GB%vXZat+(EFWbkbky#{yGY`rOvN)?{5qUuFv=r=dyYZrULf%MppWuNRUWc z8|YaIn}P0DGkwSZ(njAO$Zhr3Yw`3O1A+&F*2UjO{0`P%kK(qL;kEkfjRC=lxPRjL z{{4PO3-*5RZ_B3LUB&?ZpJ4nk1E4L&eT~HX0Jo(|uGQCW3utB@p)rF@W*n$==TlS zKiTfzhrLbAeRqru%D;fUwXOUcHud{pw@Ib1xxQ}<2)?KC&%y5PVef<7rcu2l!8dsy z?lvdaHJ#s$0m18y{x#fB$o=l)-sV?Qya5GWf#8Vd{~Grn@qgX#!EI`Y>++l%1A;eL z{_7t6jMeEr@a+oxyCL^+_}9Qc;i0&Xd%LXp?to*R|26LKHG(m0)*QF4*h;5%YG5<9)c> z1vq!7bIJSv1^27i-mcH!zX>ep3Iw0^{nx<1jOy)N_UoFD8v}x~2mEWapI3m~kMQkR z#&@4FuEGBn`mgtSx6jeY7vUQNf=^}sTZErIEpH!cy|@7Z zU4h_Oxxd2s=f{}$XXy4}%JqTSjRC \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + 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 + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jest/jest-demo/mvnw.cmd b/jest/jest-demo/mvnw.cmd new file mode 100644 index 0000000000..fef5a8f7f9 --- /dev/null +++ b/jest/jest-demo/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. 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, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/jest/jest-demo/pom.xml b/jest/jest-demo/pom.xml new file mode 100644 index 0000000000..b5cc620b69 --- /dev/null +++ b/jest/jest-demo/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.5.RELEASE + + + com.baeldung.jest + jest-demo + 0.0.1-SNAPSHOT + jest-demo + Demo project for Spring Boot + + + 11 + + + + + org.springframework.boot + spring-boot-starter + + + io.searchbox + jest + 6.3.1 + + + + org.springframework.boot + spring-boot-starter-test + test + + + com.fasterxml.jackson.core + jackson-databind + 2.9.6 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java b/jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java new file mode 100644 index 0000000000..5a2c1a534f --- /dev/null +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java @@ -0,0 +1,42 @@ +package com.baeldung.jest; + +import java.util.List; + +public class Employee { + String name; + String title; + List skills; + int years_of_service; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public List getSkills() { + return skills; + } + + public void setSkills(List skills) { + this.skills = skills; + } + + public int getYears_of_service() { + return years_of_service; + } + + public void setYears_of_service(int years_of_service) { + this.years_of_service = years_of_service; + } +} diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java b/jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java new file mode 100644 index 0000000000..a010c0f76e --- /dev/null +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java @@ -0,0 +1,32 @@ +package com.baeldung.jest; + +import io.searchbox.client.JestClient; +import io.searchbox.client.JestClientFactory; +import io.searchbox.client.config.HttpClientConfig; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class JestClientConfiguration { + + @Value("${elastic.url:http://localhost:9200}") + private String elasticUrl; + + /** + * Create a JEST client bean. + * @return JestClient + */ + @Bean + public JestClient jestClient() + { + JestClientFactory factory = new JestClientFactory(); + factory.setHttpClientConfig( + new HttpClientConfig.Builder(elasticUrl) + .multiThreaded(true) + .defaultMaxTotalConnectionPerRoute(2) + .maxTotalConnection(20) + .build()); + return factory.getObject(); + } +} diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java new file mode 100644 index 0000000000..b87f67754c --- /dev/null +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -0,0 +1,147 @@ +package com.baeldung.jest; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import io.searchbox.client.JestClient; +import io.searchbox.client.JestResult; +import io.searchbox.client.JestResultHandler; +import io.searchbox.core.*; +import io.searchbox.indices.CreateIndex; +import io.searchbox.indices.IndicesExists; +import io.searchbox.indices.aliases.AddAliasMapping; +import io.searchbox.indices.aliases.ModifyAliases; +import io.searchbox.indices.aliases.RemoveAliasMapping; +import io.searchbox.indices.mapping.PutMapping; +import io.searchbox.indices.settings.GetSettings; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +@SpringBootApplication +public class JestDemoApplication { + + public static void main(String[] args) throws IOException { + ApplicationContext context = SpringApplication.run(JestDemoApplication.class, args); + + // Demo the JestClient + JestClient jestClient = context.getBean(JestClient.class); + + // Check an index + jestClient.execute(new IndicesExists.Builder("employees").build()); + + // Create an index + jestClient.execute(new CreateIndex.Builder("employees").build()); + + // Create an index with options + Map settings = new HashMap<>(); + settings.put("number_of_shards", 11); + settings.put("number_of_replicas", 2); + jestClient.execute(new CreateIndex.Builder("employees").settings(settings).build()); + + // Create an alias, then remove it + jestClient.execute(new ModifyAliases.Builder( + new AddAliasMapping.Builder( + "employees", + "e") + .build()) + .build()); + jestClient.execute(new ModifyAliases.Builder( + new RemoveAliasMapping.Builder( + "employees", + "e") + .build()) + .build()); + + // Sample JSON for indexing + + // { + // "name": "Michael Pratt", + // "title": "Java Developer", + // "skills": ["java", "spring", "elasticsearch"], + // "years_of_service": 2 + // } + + // Index a document from String + ObjectMapper mapper = new ObjectMapper(); + JsonNode employeeJsonNode = mapper.createObjectNode() + .put("name", "Michael Pratt") + .put("title", "Java Developer") + .put("years_of_service", 2) + .set("skills", mapper.createArrayNode() + .add("java") + .add("spring") + .add("elasticsearch")); + jestClient.execute(new Index.Builder(employeeJsonNode.toString()).index("employees").build()); + + // Index a document from Map + Map employeeHashMap = new LinkedHashMap<>(); + employeeHashMap.put("name", "Michael Pratt"); + employeeHashMap.put("title", "Java Developer"); + employeeHashMap.put("years_of_service", 2); + employeeHashMap.put("skills", Arrays.asList("java", "spring", "elasticsearch")); + jestClient.execute(new Index.Builder(employeeHashMap).index("employees").build()); + + // Index a document from POJO + Employee employee = new Employee(); + employee.setName("Michael Pratt"); + employee.setTitle("Java Developer"); + employee.setYears_of_service(2); + employee.setSkills(Arrays.asList("java", "spring", "elasticsearch")); + jestClient.execute(new Index.Builder(employee).index("employees").build()); + + // Read document by ID + jestClient.execute(new Get.Builder("employees", "1").build()); + + // Search documents + + // Update document + employee.setYears_of_service(3); + jestClient.execute(new Update.Builder(employee).index("employees").id("1").build()); + + // Delete documents + jestClient.execute(new Delete.Builder("2") .index("employees") .build()); + + // Bulk operations + Employee employeeObject1 = new Employee(); + employee.setName("John Smith"); + employee.setTitle("Python Developer"); + employee.setYears_of_service(10); + employee.setSkills(Arrays.asList("python")); + + Employee employeeObject2 = new Employee(); + employee.setName("Kate Smith"); + employee.setTitle("Senior JavaScript Developer"); + employee.setYears_of_service(10); + employee.setSkills(Arrays.asList("javascript", "angular")); + + jestClient.execute(new Bulk.Builder() .defaultIndex("employees") + .addAction(new Index.Builder(employeeObject1).build()) + .addAction(new Index.Builder(employeeObject2).build()) + .addAction(new Delete.Builder("3").build()) .build()); + + // Async operations + Employee employeeObject3 = new Employee(); + employee.setName("Jane Doe"); + employee.setTitle("Manager"); + employee.setYears_of_service(20); + employee.setSkills(Arrays.asList("managing")); + + jestClient.executeAsync( new Index.Builder(employeeObject3).build(), new JestResultHandler() { + @Override public void completed(JestResult result) { + // handle result + } + @Override public void failed(Exception ex) { + // handle exception + } + }); + } + +} diff --git a/jest/jest-demo/src/main/resources/application.properties b/jest/jest-demo/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/jest/jest-demo/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java b/jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java new file mode 100644 index 0000000000..33fb2f49e8 --- /dev/null +++ b/jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java @@ -0,0 +1,16 @@ +package com.baeldung.jest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class JestDemoApplicationTests { + + @Test + public void contextLoads() { + } + +} From 53f3f903ce546c5b69cd6e0b38ab42b8f1e86e4c Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 May 2019 12:00:18 -0600 Subject: [PATCH 03/70] BAEL-2958: Add search example --- .../java/com/baeldung/jest/JestDemoApplication.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java index b87f67754c..939ed8461f 100644 --- a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -101,6 +101,16 @@ public class JestDemoApplication { jestClient.execute(new Get.Builder("employees", "1").build()); // Search documents + String search = "{\n" + + " \"query\": {\n" + + " \"bool\": {\n" + + " \"must\": [\n" + + " { \"match\": { \"name\": \"Michael Pratt\" }}\n" + + " ]\n" + + " }\n" + + " }\n" + + "}"; + jestClient.execute(new Search.Builder(search).build()); // Update document employee.setYears_of_service(3); From 685001eb4ec3b13f75db83f8a193097d949d6ac9 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 May 2019 19:11:52 +0000 Subject: [PATCH 04/70] BAEL-2958: Add more examples --- .../java/com/baeldung/jest/JestDemoApplication.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java index 939ed8461f..c9720f958f 100644 --- a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -20,10 +20,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; @SpringBootApplication public class JestDemoApplication { @@ -98,7 +95,7 @@ public class JestDemoApplication { jestClient.execute(new Index.Builder(employee).index("employees").build()); // Read document by ID - jestClient.execute(new Get.Builder("employees", "1").build()); + Employee getResult = jestClient.execute(new Get.Builder("employees", "1").build()).getSourceAsObject(Employee.class); // Search documents String search = "{\n" + @@ -110,7 +107,9 @@ public class JestDemoApplication { " }\n" + " }\n" + "}"; - jestClient.execute(new Search.Builder(search).build()); + List> searchResults = + jestClient.execute(new Search.Builder(search).build()) + .getHits(Employee.class); // Update document employee.setYears_of_service(3); From 74ba5b7e88f24d66f15fc94e0c89f96b77e0018b Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 28 May 2019 13:15:56 +0000 Subject: [PATCH 05/70] BAEL-2958: Move Jest demo under persistence modules and add more examples --- .../jest}/.gitignore | 0 .../jest}/.mvn/wrapper/MavenWrapperDownloader.java | 0 .../jest}/.mvn/wrapper/maven-wrapper.jar | Bin .../jest}/.mvn/wrapper/maven-wrapper.properties | 0 {jest/jest-demo => persistence-modules/jest}/mvnw | 0 .../jest-demo => persistence-modules/jest}/mvnw.cmd | 0 .../jest-demo => persistence-modules/jest}/pom.xml | 2 +- .../src/main/java/com/baeldung/jest/Employee.java | 0 .../com/baeldung/jest/JestClientConfiguration.java | 0 .../java/com/baeldung/jest/JestDemoApplication.java | 11 +++++++++-- .../jest}/src/main/resources/application.properties | 0 .../com/baeldung/jest/JestDemoApplicationTests.java | 0 persistence-modules/pom.xml | 1 + 13 files changed, 11 insertions(+), 3 deletions(-) rename {jest/jest-demo => persistence-modules/jest}/.gitignore (100%) rename {jest/jest-demo => persistence-modules/jest}/.mvn/wrapper/MavenWrapperDownloader.java (100%) rename {jest/jest-demo => persistence-modules/jest}/.mvn/wrapper/maven-wrapper.jar (100%) rename {jest/jest-demo => persistence-modules/jest}/.mvn/wrapper/maven-wrapper.properties (100%) rename {jest/jest-demo => persistence-modules/jest}/mvnw (100%) rename {jest/jest-demo => persistence-modules/jest}/mvnw.cmd (100%) rename {jest/jest-demo => persistence-modules/jest}/pom.xml (97%) rename {jest/jest-demo => persistence-modules/jest}/src/main/java/com/baeldung/jest/Employee.java (100%) rename {jest/jest-demo => persistence-modules/jest}/src/main/java/com/baeldung/jest/JestClientConfiguration.java (100%) rename {jest/jest-demo => persistence-modules/jest}/src/main/java/com/baeldung/jest/JestDemoApplication.java (93%) rename {jest/jest-demo => persistence-modules/jest}/src/main/resources/application.properties (100%) rename {jest/jest-demo => persistence-modules/jest}/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java (100%) diff --git a/jest/jest-demo/.gitignore b/persistence-modules/jest/.gitignore similarity index 100% rename from jest/jest-demo/.gitignore rename to persistence-modules/jest/.gitignore diff --git a/jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java b/persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java similarity index 100% rename from jest/jest-demo/.mvn/wrapper/MavenWrapperDownloader.java rename to persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java diff --git a/jest/jest-demo/.mvn/wrapper/maven-wrapper.jar b/persistence-modules/jest/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from jest/jest-demo/.mvn/wrapper/maven-wrapper.jar rename to persistence-modules/jest/.mvn/wrapper/maven-wrapper.jar diff --git a/jest/jest-demo/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/jest/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from jest/jest-demo/.mvn/wrapper/maven-wrapper.properties rename to persistence-modules/jest/.mvn/wrapper/maven-wrapper.properties diff --git a/jest/jest-demo/mvnw b/persistence-modules/jest/mvnw similarity index 100% rename from jest/jest-demo/mvnw rename to persistence-modules/jest/mvnw diff --git a/jest/jest-demo/mvnw.cmd b/persistence-modules/jest/mvnw.cmd similarity index 100% rename from jest/jest-demo/mvnw.cmd rename to persistence-modules/jest/mvnw.cmd diff --git a/jest/jest-demo/pom.xml b/persistence-modules/jest/pom.xml similarity index 97% rename from jest/jest-demo/pom.xml rename to persistence-modules/jest/pom.xml index b5cc620b69..e1bb08d182 100644 --- a/jest/jest-demo/pom.xml +++ b/persistence-modules/jest/pom.xml @@ -15,7 +15,7 @@ Demo project for Spring Boot - 11 + 8 diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java b/persistence-modules/jest/src/main/java/com/baeldung/jest/Employee.java similarity index 100% rename from jest/jest-demo/src/main/java/com/baeldung/jest/Employee.java rename to persistence-modules/jest/src/main/java/com/baeldung/jest/Employee.java diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java b/persistence-modules/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java similarity index 100% rename from jest/jest-demo/src/main/java/com/baeldung/jest/JestClientConfiguration.java rename to persistence-modules/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java b/persistence-modules/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java similarity index 93% rename from jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java rename to persistence-modules/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java index c9720f958f..7eb53ff25a 100644 --- a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/persistence-modules/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -32,7 +32,10 @@ public class JestDemoApplication { JestClient jestClient = context.getBean(JestClient.class); // Check an index - jestClient.execute(new IndicesExists.Builder("employees").build()); + JestResult result = jestClient.execute(new IndicesExists.Builder("employees").build()); + if(!result.isSucceeded()) { + System.out.println(result.getErrorMessage()); + } // Create an index jestClient.execute(new CreateIndex.Builder("employees").build()); @@ -111,6 +114,10 @@ public class JestDemoApplication { jestClient.execute(new Search.Builder(search).build()) .getHits(Employee.class); + searchResults.forEach(hit -> { + System.out.println(String.format("Document %s has score %s", hit.id, hit.score)); + }); + // Update document employee.setYears_of_service(3); jestClient.execute(new Update.Builder(employee).index("employees").id("1").build()); @@ -131,7 +138,7 @@ public class JestDemoApplication { employee.setYears_of_service(10); employee.setSkills(Arrays.asList("javascript", "angular")); - jestClient.execute(new Bulk.Builder() .defaultIndex("employees") + jestClient.execute(new Bulk.Builder().defaultIndex("employees") .addAction(new Index.Builder(employeeObject1).build()) .addAction(new Index.Builder(employeeObject2).build()) .addAction(new Delete.Builder("3").build()) .build()); diff --git a/jest/jest-demo/src/main/resources/application.properties b/persistence-modules/jest/src/main/resources/application.properties similarity index 100% rename from jest/jest-demo/src/main/resources/application.properties rename to persistence-modules/jest/src/main/resources/application.properties diff --git a/jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java b/persistence-modules/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java similarity index 100% rename from jest/jest-demo/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java rename to persistence-modules/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 47c733d8a7..1974561e1f 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -28,6 +28,7 @@ java-jdbi java-jpa java-mongodb + jest jnosql liquibase orientdb From 3bb5ddedb03b5caaedeb99ec09bfde1b62ee35ad Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 29 May 2019 12:36:03 +0000 Subject: [PATCH 06/70] BAEL-2958: Move Jest demo and remove maven wrapper files --- .../{ => elasticsearch}/jest/.gitignore | 0 .../{ => elasticsearch}/jest/pom.xml | 0 .../main/java/com/baeldung/jest/Employee.java | 0 .../jest/JestClientConfiguration.java | 0 .../baeldung/jest/JestDemoApplication.java | 0 .../src/main/resources/application.properties | 0 .../jest/JestDemoApplicationTests.java | 0 .../.mvn/wrapper/MavenWrapperDownloader.java | 114 ------- .../jest/.mvn/wrapper/maven-wrapper.jar | Bin 48337 -> 0 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 - persistence-modules/jest/mvnw | 286 ------------------ persistence-modules/jest/mvnw.cmd | 161 ---------- persistence-modules/pom.xml | 2 +- 13 files changed, 1 insertion(+), 563 deletions(-) rename persistence-modules/{ => elasticsearch}/jest/.gitignore (100%) rename persistence-modules/{ => elasticsearch}/jest/pom.xml (100%) rename persistence-modules/{ => elasticsearch}/jest/src/main/java/com/baeldung/jest/Employee.java (100%) rename persistence-modules/{ => elasticsearch}/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java (100%) rename persistence-modules/{ => elasticsearch}/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java (100%) rename persistence-modules/{ => elasticsearch}/jest/src/main/resources/application.properties (100%) rename persistence-modules/{ => elasticsearch}/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java (100%) delete mode 100644 persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java delete mode 100644 persistence-modules/jest/.mvn/wrapper/maven-wrapper.jar delete mode 100644 persistence-modules/jest/.mvn/wrapper/maven-wrapper.properties delete mode 100755 persistence-modules/jest/mvnw delete mode 100644 persistence-modules/jest/mvnw.cmd diff --git a/persistence-modules/jest/.gitignore b/persistence-modules/elasticsearch/jest/.gitignore similarity index 100% rename from persistence-modules/jest/.gitignore rename to persistence-modules/elasticsearch/jest/.gitignore diff --git a/persistence-modules/jest/pom.xml b/persistence-modules/elasticsearch/jest/pom.xml similarity index 100% rename from persistence-modules/jest/pom.xml rename to persistence-modules/elasticsearch/jest/pom.xml diff --git a/persistence-modules/jest/src/main/java/com/baeldung/jest/Employee.java b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/Employee.java similarity index 100% rename from persistence-modules/jest/src/main/java/com/baeldung/jest/Employee.java rename to persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/Employee.java diff --git a/persistence-modules/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java similarity index 100% rename from persistence-modules/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java rename to persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java diff --git a/persistence-modules/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java similarity index 100% rename from persistence-modules/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java rename to persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java diff --git a/persistence-modules/jest/src/main/resources/application.properties b/persistence-modules/elasticsearch/jest/src/main/resources/application.properties similarity index 100% rename from persistence-modules/jest/src/main/resources/application.properties rename to persistence-modules/elasticsearch/jest/src/main/resources/application.properties diff --git a/persistence-modules/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java b/persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java similarity index 100% rename from persistence-modules/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java rename to persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java diff --git a/persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java b/persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index 7f91a56ea7..0000000000 --- a/persistence-modules/jest/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,114 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. -*/ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = - "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/persistence-modules/jest/.mvn/wrapper/maven-wrapper.jar b/persistence-modules/jest/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 01e67997377a393fd672c7dcde9dccbedf0cb1e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48337 zcmbTe1CV9Qwl>;j+wQV$+qSXFw%KK)%eHN!%U!l@+x~l>b1vR}@9y}|TM-#CBjy|< zb7YRpp)Z$$Gzci_H%LgxZ{NNV{%Qa9gZlF*E2<($D=8;N5Asbx8se{Sz5)O13x)rc z5cR(k$_mO!iis+#(8-D=#R@|AF(8UQ`L7dVNSKQ%v^P|1A%aF~Lye$@HcO@sMYOb3 zl`5!ThJ1xSJwsg7hVYFtE5vS^5UE0$iDGCS{}RO;R#3y#{w-1hVSg*f1)7^vfkxrm!!N|oTR0Hj?N~IbVk+yC#NK} z5myv()UMzV^!zkX@O=Yf!(Z_bF7}W>k*U4@--&RH0tHiHY0IpeezqrF#@8{E$9d=- z7^kT=1Bl;(Q0k{*_vzz1Et{+*lbz%mkIOw(UA8)EE-Pkp{JtJhe@VXQ8sPNTn$Vkj zicVp)sV%0omhsj;NCmI0l8zzAipDV#tp(Jr7p_BlL$}Pys_SoljztS%G-Wg+t z&Q#=<03Hoga0R1&L!B);r{Cf~b$G5p#@?R-NNXMS8@cTWE^7V!?ixz(Ag>lld;>COenWc$RZ61W+pOW0wh>sN{~j; zCBj!2nn|4~COwSgXHFH?BDr8pK323zvmDK-84ESq25b;Tg%9(%NneBcs3;r znZpzntG%E^XsSh|md^r-k0Oen5qE@awGLfpg;8P@a-s<{Fwf?w3WapWe|b-CQkqlo z46GmTdPtkGYdI$e(d9Zl=?TU&uv94VR`g|=7xB2Ur%=6id&R2 z4e@fP7`y58O2sl;YB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|M{tmkOyAPnMHu(Z}Q1X1GM|A+)VDP3Fz934zSl)z>N|D^`G-+>Mej|VcK+?iew zQ3=DH4zz;i>z{Yv_l@j*?{936kxM{c7eK$1cf8wxL>>O#`+vsu*KR)te$adfTD*w( zAStXnZk<6N3V-Vs#GB%vXZat+(EFWbkbky#{yGY`rOvN)?{5qUuFv=r=dyYZrULf%MppWuNRUWc z8|YaIn}P0DGkwSZ(njAO$Zhr3Yw`3O1A+&F*2UjO{0`P%kK(qL;kEkfjRC=lxPRjL z{{4PO3-*5RZ_B3LUB&?ZpJ4nk1E4L&eT~HX0Jo(|uGQCW3utB@p)rF@W*n$==TlS zKiTfzhrLbAeRqru%D;fUwXOUcHud{pw@Ib1xxQ}<2)?KC&%y5PVef<7rcu2l!8dsy z?lvdaHJ#s$0m18y{x#fB$o=l)-sV?Qya5GWf#8Vd{~Grn@qgX#!EI`Y>++l%1A;eL z{_7t6jMeEr@a+oxyCL^+_}9Qc;i0&Xd%LXp?to*R|26LKHG(m0)*QF4*h;5%YG5<9)c> z1vq!7bIJSv1^27i-mcH!zX>ep3Iw0^{nx<1jOy)N_UoFD8v}x~2mEWapI3m~kMQkR z#&@4FuEGBn`mgtSx6jeY7vUQNf=^}sTZErIEpH!cy|@7Z zU4h_Oxxd2s=f{}$XXy4}%JqTSjRC \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - 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 - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - wget "$jarUrl" -O "$wrapperJarPath" - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - curl -o "$wrapperJarPath" "$jarUrl" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/persistence-modules/jest/mvnw.cmd b/persistence-modules/jest/mvnw.cmd deleted file mode 100644 index fef5a8f7f9..0000000000 --- a/persistence-modules/jest/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. 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, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@REM End of extension - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 1974561e1f..8021e0d55b 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -28,7 +28,7 @@ java-jdbi java-jpa java-mongodb - jest + elasticsearch/jest jnosql liquibase orientdb From 963422bafbdc4b2018dfefdc787beb93148973e1 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Thu, 30 May 2019 22:20:03 +0530 Subject: [PATCH 07/70] [BAEL-14846] - Fixed tests in spring-5-reactive module --- .../errorhandling/ErrorHandlingIntegrationTest.java | 6 +++++- .../reactive/filters/PlayerHandlerIntegrationTest.java | 2 ++ .../com/baeldung/stepverifier/PostExecutionUnitTest.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java index 10cfaffce4..42da90ecd5 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java @@ -1,10 +1,13 @@ package com.baeldung.reactive.errorhandling; -import java.io.IOException; import static org.junit.Assert.assertEquals; + +import java.io.IOException; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.MediaType; @@ -15,6 +18,7 @@ import org.springframework.test.web.reactive.server.WebTestClient; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT) @WithMockUser +@AutoConfigureWebTestClient(timeout = "10000") public class ErrorHandlingIntegrationTest { @Autowired diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java index fbf46a93cc..c1523cb5ee 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java @@ -3,6 +3,7 @@ package com.baeldung.reactive.filters; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; @@ -14,6 +15,7 @@ import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @WithMockUser +@AutoConfigureWebTestClient(timeout = "10000") public class PlayerHandlerIntegrationTest { @Autowired diff --git a/spring-5-reactive/src/test/java/com/baeldung/stepverifier/PostExecutionUnitTest.java b/spring-5-reactive/src/test/java/com/baeldung/stepverifier/PostExecutionUnitTest.java index 17fea6b50b..4395e0b048 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/stepverifier/PostExecutionUnitTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/stepverifier/PostExecutionUnitTest.java @@ -28,7 +28,7 @@ public class PostExecutionUnitTest { .expectComplete() .verifyThenAssertThat() .hasDropped(4) - .tookLessThan(Duration.ofMillis(1050)); + .tookLessThan(Duration.ofMillis(1500)); } } From dfeadea6ae73c7cbed66f1bc1c5c0a42e1d39817 Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Mon, 3 Jun 2019 00:36:37 +0200 Subject: [PATCH 08/70] CHANGED: name of module for Spring Boot 2.2 --- {parent-boot-2-2 => parent-boot-performance}/README.md | 1 - {parent-boot-2-2 => parent-boot-performance}/pom.xml | 4 ++-- {spring-boot-2-2 => spring-boot-performance}/pom.xml | 10 +++++----- .../com/baeldung/lazyinitialization/Application.java | 0 .../baeldung/lazyinitialization/services/Writer.java | 0 .../src/main/resources/application.yml | 0 6 files changed, 7 insertions(+), 8 deletions(-) rename {parent-boot-2-2 => parent-boot-performance}/README.md (98%) rename {parent-boot-2-2 => parent-boot-performance}/pom.xml (97%) rename {spring-boot-2-2 => spring-boot-performance}/pom.xml (81%) rename {spring-boot-2-2 => spring-boot-performance}/src/main/java/com/baeldung/lazyinitialization/Application.java (100%) rename {spring-boot-2-2 => spring-boot-performance}/src/main/java/com/baeldung/lazyinitialization/services/Writer.java (100%) rename {spring-boot-2-2 => spring-boot-performance}/src/main/resources/application.yml (100%) diff --git a/parent-boot-2-2/README.md b/parent-boot-performance/README.md similarity index 98% rename from parent-boot-2-2/README.md rename to parent-boot-performance/README.md index d2bd6d660b..963176a5e3 100644 --- a/parent-boot-2-2/README.md +++ b/parent-boot-performance/README.md @@ -1,2 +1 @@ - This is a parent module for all projects using Spring Boot 2.2. diff --git a/parent-boot-2-2/pom.xml b/parent-boot-performance/pom.xml similarity index 97% rename from parent-boot-2-2/pom.xml rename to parent-boot-performance/pom.xml index 59611c9044..c7a0263716 100644 --- a/parent-boot-2-2/pom.xml +++ b/parent-boot-performance/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - parent-boot-2-2 + parent-boot-performance 0.0.1-SNAPSHOT - parent-boot-2-2 + parent-boot-performance pom Parent for all Spring Boot 2.2 modules diff --git a/spring-boot-2-2/pom.xml b/spring-boot-performance/pom.xml similarity index 81% rename from spring-boot-2-2/pom.xml rename to spring-boot-performance/pom.xml index 4390e29b60..cb2dba359e 100644 --- a/spring-boot-2-2/pom.xml +++ b/spring-boot-performance/pom.xml @@ -2,16 +2,16 @@ 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 - spring-boot-2-2 - spring-boot-2-2 + spring-boot-performance + spring-boot-performance war This is simple boot application for Spring boot 2.2 - parent-boot-2-2 + parent-boot-performance com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2-2 + ../parent-boot-performance @@ -22,7 +22,7 @@ - spring-boot-2-2 + spring-boot-performance src/main/resources diff --git a/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java b/spring-boot-performance/src/main/java/com/baeldung/lazyinitialization/Application.java similarity index 100% rename from spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/Application.java rename to spring-boot-performance/src/main/java/com/baeldung/lazyinitialization/Application.java diff --git a/spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java b/spring-boot-performance/src/main/java/com/baeldung/lazyinitialization/services/Writer.java similarity index 100% rename from spring-boot-2-2/src/main/java/com/baeldung/lazyinitialization/services/Writer.java rename to spring-boot-performance/src/main/java/com/baeldung/lazyinitialization/services/Writer.java diff --git a/spring-boot-2-2/src/main/resources/application.yml b/spring-boot-performance/src/main/resources/application.yml similarity index 100% rename from spring-boot-2-2/src/main/resources/application.yml rename to spring-boot-performance/src/main/resources/application.yml From 2d6aeee195e3d8b69068fdde98e8decbafa2577f Mon Sep 17 00:00:00 2001 From: Jon Cook Date: Tue, 4 Jun 2019 19:27:52 +0200 Subject: [PATCH 09/70] BAEL-2913 - TempDir Support --- testing-modules/junit-5-basics/pom.xml | 24 ++------- .../SharedTemporaryDirectoryUnitTest.java | 49 +++++++++++++++++++ .../tempdir/TemporaryDirectoryUnitTest.java | 48 ++++++++++++++++++ 3 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/SharedTemporaryDirectoryUnitTest.java create mode 100644 testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/TemporaryDirectoryUnitTest.java diff --git a/testing-modules/junit-5-basics/pom.xml b/testing-modules/junit-5-basics/pom.xml index 28afcd6aac..5f36dd17cc 100644 --- a/testing-modules/junit-5-basics/pom.xml +++ b/testing-modules/junit-5-basics/pom.xml @@ -16,20 +16,10 @@ - - org.junit.platform - junit-platform-engine - ${junit.platform.version} - - - org.junit.jupiter - junit-jupiter-params - ${junit.jupiter.version} - org.junit.platform junit-platform-runner - ${junit.platform.version} + ${junit-platform.version} test @@ -92,13 +82,7 @@ maven-surefire-plugin ${maven-surefire-plugin.version} - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - - + **/*IntegrationTest.java @@ -148,9 +132,7 @@ - 5.4.2 - 1.2.0 - 5.2.0 + 5.4.2 1.4.196 5.0.6.RELEASE 2.21.0 diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/SharedTemporaryDirectoryUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/SharedTemporaryDirectoryUnitTest.java new file mode 100644 index 0000000000..9483a33143 --- /dev/null +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/SharedTemporaryDirectoryUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.extensions.tempdir; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertLinesMatch; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.io.TempDir; + +import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; + +@TestMethodOrder(OrderAnnotation.class) +class SharedTemporaryDirectoryUnitTest { + + @TempDir + static Path sharedTempDir; + + @Test + @Order(1) + void givenFieldWithSharedTempDirectoryPath_whenWriteToFile_thenContentIsCorrect() throws IOException { + Path numbers = sharedTempDir.resolve("numbers.txt"); + + List lines = Arrays.asList("1", "2", "3"); + Files.write(numbers, lines); + + assertAll( + () -> assertTrue("File should exist", Files.exists(numbers)), + () -> assertLinesMatch(lines, Files.readAllLines(numbers))); + + Files.createTempDirectory("bpb"); + } + + @Test + @Order(2) + void givenAlreadyWrittenToSharedFile_whenCheckContents_thenContentIsCorrect() throws IOException { + Path numbers = sharedTempDir.resolve("numbers.txt"); + + assertLinesMatch(Arrays.asList("1", "2", "3"), Files.readAllLines(numbers)); + } + +} diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/TemporaryDirectoryUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/TemporaryDirectoryUnitTest.java new file mode 100644 index 0000000000..c6f1a7cd77 --- /dev/null +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/extensions/tempdir/TemporaryDirectoryUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.extensions.tempdir; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertLinesMatch; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +class TemporaryDirectoryUnitTest { + + @Test + void givenTestMethodWithTempDirectoryPath_whenWriteToFile_thenContentIsCorrect(@TempDir Path tempDir) throws IOException { + Path numbers = tempDir.resolve("numbers.txt"); + + List lines = Arrays.asList("1", "2", "3"); + Files.write(numbers, lines); + + assertAll( + () -> assertTrue("File should exist", Files.exists(numbers)), + () -> assertLinesMatch(lines, Files.readAllLines(numbers))); + } + + @TempDir + File anotherTempDir; + + @Test + void givenFieldWithTempDirectoryFile_whenWriteToFile_thenContentIsCorrect() throws IOException { + assertTrue("Should be a directory ", this.anotherTempDir.isDirectory()); + + File letters = new File(anotherTempDir, "letters.txt"); + List lines = Arrays.asList("x", "y", "z"); + + Files.write(letters.toPath(), lines); + + assertAll( + () -> assertTrue("File should exist", Files.exists(letters.toPath())), + () -> assertLinesMatch(lines, Files.readAllLines(letters.toPath()))); + } + +} From 99c06664db92a7952844ab4299c57888593976c9 Mon Sep 17 00:00:00 2001 From: Jon Cook Date: Tue, 4 Jun 2019 19:28:18 +0200 Subject: [PATCH 10/70] BAEL-2913 - TempDir Support --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 185c0a4015..20113d90a2 100644 --- a/pom.xml +++ b/pom.xml @@ -1556,7 +1556,7 @@ 2.9.8 1.3 1.2.0 - 5.2.0 + 5.4.2 0.3.1 2.5.1 0.0.1 From 4633c51b175b8b16cc51522c1f59abe152965b6e Mon Sep 17 00:00:00 2001 From: Erhan KARAKAYA Date: Wed, 5 Jun 2019 01:44:57 +0300 Subject: [PATCH 11/70] Added code sample for autoservice --- autovalue/pom.xml | 7 +++++++ .../autoservice/BingTranslateServiceProvider.java | 11 +++++++++++ .../autoservice/GoogleTranslateServiceProvider.java | 11 +++++++++++ .../com/baeldung/autoservice/TranslateService.java | 8 ++++++++ 4 files changed, 37 insertions(+) create mode 100644 autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java create mode 100644 autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java create mode 100644 autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java diff --git a/autovalue/pom.xml b/autovalue/pom.xml index 3ec2d26b35..a10e8ef055 100644 --- a/autovalue/pom.xml +++ b/autovalue/pom.xml @@ -29,6 +29,12 @@ + + com.google.auto.service + auto-service + ${auto-service.version} + true + com.google.inject @@ -40,6 +46,7 @@ 1.3 1.0-beta5 + 1.0-rc5 4.2.0 diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java new file mode 100644 index 0000000000..93ab8f4fe4 --- /dev/null +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java @@ -0,0 +1,11 @@ +package com.baeldung.autoservice; + +import java.util.Locale; + +@AutoService(TranslateService.class) +public class BingTranslateServiceProvider implements TranslateService { + + public String translate(String message, Locale from, Locale to) { + return "translated by Bing"; + } +} diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java new file mode 100644 index 0000000000..07772e2afe --- /dev/null +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java @@ -0,0 +1,11 @@ +package com.baeldung.autoservice; + +import java.util.Locale; + +@AutoService(TranslateService.class) +public class GoogleTranslateServiceProvider implements TranslateService { + + public String translate(String message, Locale from, Locale to) { + return "translated by Google"; + } +} diff --git a/autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java b/autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java new file mode 100644 index 0000000000..6d68f6aca3 --- /dev/null +++ b/autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java @@ -0,0 +1,8 @@ +package com.baeldung.autoservice; + +import java.util.Locale; + +public interface TranslateService { + + String translate(String message, Locale from, Locale to); +} From de469b49409ac2e615b00762d5d9c551fa3e813f Mon Sep 17 00:00:00 2001 From: Erhan KARAKAYA Date: Wed, 5 Jun 2019 02:00:53 +0300 Subject: [PATCH 12/70] Added missing imports --- .../com/baeldung/autoservice/BingTranslateServiceProvider.java | 2 ++ .../baeldung/autoservice/GoogleTranslateServiceProvider.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java index 93ab8f4fe4..00f21a943e 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java @@ -1,5 +1,7 @@ package com.baeldung.autoservice; +import com.google.auto.service.AutoService; + import java.util.Locale; @AutoService(TranslateService.class) diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java index 07772e2afe..786d9bd443 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java @@ -1,5 +1,7 @@ package com.baeldung.autoservice; +import com.google.auto.service.AutoService; + import java.util.Locale; @AutoService(TranslateService.class) From b31776d89d1a1a75886a8ee30137cf8d97bee0ac Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 5 Jun 2019 14:16:33 +0000 Subject: [PATCH 13/70] BAEL-2958: Remove spring boot dependencies from Jest demo --- .../elasticsearch/jest/pom.xml | 32 +++---------------- .../jest/JestClientConfiguration.java | 32 ------------------- .../baeldung/jest/JestDemoApplication.java | 20 ++++++++---- 3 files changed, 19 insertions(+), 65 deletions(-) delete mode 100644 persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java diff --git a/persistence-modules/elasticsearch/jest/pom.xml b/persistence-modules/elasticsearch/jest/pom.xml index e1bb08d182..7027f70900 100644 --- a/persistence-modules/elasticsearch/jest/pom.xml +++ b/persistence-modules/elasticsearch/jest/pom.xml @@ -2,52 +2,30 @@ 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.1.5.RELEASE - - com.baeldung.jest jest-demo 0.0.1-SNAPSHOT jest-demo - Demo project for Spring Boot + Demo project for Jest Client for Elasticsearch + 8 + 1.8 + 1.8 - - org.springframework.boot - spring-boot-starter - + io.searchbox jest 6.3.1 - - - org.springframework.boot - spring-boot-starter-test - test - com.fasterxml.jackson.core jackson-databind 2.9.6 - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java deleted file mode 100644 index a010c0f76e..0000000000 --- a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestClientConfiguration.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.jest; - -import io.searchbox.client.JestClient; -import io.searchbox.client.JestClientFactory; -import io.searchbox.client.config.HttpClientConfig; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class JestClientConfiguration { - - @Value("${elastic.url:http://localhost:9200}") - private String elasticUrl; - - /** - * Create a JEST client bean. - * @return JestClient - */ - @Bean - public JestClient jestClient() - { - JestClientFactory factory = new JestClientFactory(); - factory.setHttpClientConfig( - new HttpClientConfig.Builder(elasticUrl) - .multiThreaded(true) - .defaultMaxTotalConnectionPerRoute(2) - .maxTotalConnection(20) - .build()); - return factory.getObject(); - } -} diff --git a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java index 7eb53ff25a..e4c8ef51be 100644 --- a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -5,8 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import io.searchbox.client.JestClient; +import io.searchbox.client.JestClientFactory; import io.searchbox.client.JestResult; import io.searchbox.client.JestResultHandler; +import io.searchbox.client.config.HttpClientConfig; import io.searchbox.core.*; import io.searchbox.indices.CreateIndex; import io.searchbox.indices.IndicesExists; @@ -15,21 +17,16 @@ import io.searchbox.indices.aliases.ModifyAliases; import io.searchbox.indices.aliases.RemoveAliasMapping; import io.searchbox.indices.mapping.PutMapping; import io.searchbox.indices.settings.GetSettings; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; import java.io.IOException; import java.util.*; -@SpringBootApplication public class JestDemoApplication { public static void main(String[] args) throws IOException { - ApplicationContext context = SpringApplication.run(JestDemoApplication.class, args); // Demo the JestClient - JestClient jestClient = context.getBean(JestClient.class); + JestClient jestClient = jestClient(); // Check an index JestResult result = jestClient.execute(new IndicesExists.Builder("employees").build()); @@ -160,4 +157,15 @@ public class JestDemoApplication { }); } + private static JestClient jestClient() + { + JestClientFactory factory = new JestClientFactory(); + factory.setHttpClientConfig( + new HttpClientConfig.Builder("http://localhost:9200") + .multiThreaded(true) + .defaultMaxTotalConnectionPerRoute(2) + .maxTotalConnection(20) + .build()); + return factory.getObject(); + } } From 8ce6c0355106acb0df67ffd397fb98ef12fd3409 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 5 Jun 2019 14:25:26 +0000 Subject: [PATCH 14/70] BAEL-2958: Remove auto generated test classes --- .../baeldung/jest/JestDemoApplicationTests.java | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java diff --git a/persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java b/persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java deleted file mode 100644 index 33fb2f49e8..0000000000 --- a/persistence-modules/elasticsearch/jest/src/test/java/com/baeldung/jest/JestDemoApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.jest; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class JestDemoApplicationTests { - - @Test - public void contextLoads() { - } - -} From 83c500f9773b28dbe19c55c91be516478a4fbd54 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 5 Jun 2019 20:52:16 -0600 Subject: [PATCH 15/70] BAEL-2958: Flatten elasticsearch directory hierarchy --- persistence-modules/elasticsearch/{jest => }/.gitignore | 0 persistence-modules/elasticsearch/{jest => }/pom.xml | 0 .../{jest => }/src/main/java/com/baeldung/jest/Employee.java | 0 .../src/main/java/com/baeldung/jest/JestDemoApplication.java | 0 .../{jest => }/src/main/resources/application.properties | 0 persistence-modules/pom.xml | 2 +- 6 files changed, 1 insertion(+), 1 deletion(-) rename persistence-modules/elasticsearch/{jest => }/.gitignore (100%) rename persistence-modules/elasticsearch/{jest => }/pom.xml (100%) rename persistence-modules/elasticsearch/{jest => }/src/main/java/com/baeldung/jest/Employee.java (100%) rename persistence-modules/elasticsearch/{jest => }/src/main/java/com/baeldung/jest/JestDemoApplication.java (100%) rename persistence-modules/elasticsearch/{jest => }/src/main/resources/application.properties (100%) diff --git a/persistence-modules/elasticsearch/jest/.gitignore b/persistence-modules/elasticsearch/.gitignore similarity index 100% rename from persistence-modules/elasticsearch/jest/.gitignore rename to persistence-modules/elasticsearch/.gitignore diff --git a/persistence-modules/elasticsearch/jest/pom.xml b/persistence-modules/elasticsearch/pom.xml similarity index 100% rename from persistence-modules/elasticsearch/jest/pom.xml rename to persistence-modules/elasticsearch/pom.xml diff --git a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/Employee.java b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java similarity index 100% rename from persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/Employee.java rename to persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java diff --git a/persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java similarity index 100% rename from persistence-modules/elasticsearch/jest/src/main/java/com/baeldung/jest/JestDemoApplication.java rename to persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java diff --git a/persistence-modules/elasticsearch/jest/src/main/resources/application.properties b/persistence-modules/elasticsearch/src/main/resources/application.properties similarity index 100% rename from persistence-modules/elasticsearch/jest/src/main/resources/application.properties rename to persistence-modules/elasticsearch/src/main/resources/application.properties diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 8021e0d55b..2f4b8288ea 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -28,7 +28,7 @@ java-jdbi java-jpa java-mongodb - elasticsearch/jest + elasticsearch jnosql liquibase orientdb From b25db79cccf4802c12e0e7d1023dfcffadbc5f9b Mon Sep 17 00:00:00 2001 From: amit2103 Date: Fri, 7 Jun 2019 21:28:52 +0530 Subject: [PATCH 16/70] [BAEL-14942] - Create code for the Spring Security - Run-as authentication article --- .../config/child/MethodSecurityConfig.java | 37 +++++++++++++++++++ .../org/baeldung/service/RunAsService.java | 17 +++++++++ .../web/controller/RunAsController.java | 23 ++++++++++++ .../web/controller/ViewController.java | 5 +++ .../main/webapp/WEB-INF/templates/runas.html | 23 ++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java create mode 100644 spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java create mode 100644 spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java create mode 100644 spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java b/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java new file mode 100644 index 0000000000..bc9a9f161b --- /dev/null +++ b/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java @@ -0,0 +1,37 @@ +package org.baeldung.config.child; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.intercept.RunAsImplAuthenticationProvider; +import org.springframework.security.access.intercept.RunAsManager; +import org.springframework.security.access.intercept.RunAsManagerImpl; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; + + +@Configuration +@EnableGlobalMethodSecurity(securedEnabled = true) +public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration { + + @Override + protected RunAsManager runAsManager() { + RunAsManagerImpl runAsManager = new RunAsManagerImpl(); + runAsManager.setKey("MyRunAsKey"); + return runAsManager; + } + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.authenticationProvider(runAsAuthenticationProvider()); + } + + @Bean + public AuthenticationProvider runAsAuthenticationProvider() { + RunAsImplAuthenticationProvider authProvider = new RunAsImplAuthenticationProvider(); + authProvider.setKey("MyRunAsKey"); + return authProvider; + } +} \ No newline at end of file diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java b/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java new file mode 100644 index 0000000000..a6320f8b81 --- /dev/null +++ b/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java @@ -0,0 +1,17 @@ +package org.baeldung.service; + +import org.springframework.security.access.annotation.Secured; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Service; + +@Service +public class RunAsService { + + @Secured({ "ROLE_RUN_AS_REPORTER" }) + public Authentication getCurrentUser() { + Authentication authentication = + SecurityContextHolder.getContext().getAuthentication(); + return authentication; + } +} \ No newline at end of file diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java b/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java new file mode 100644 index 0000000000..08f39aa5f2 --- /dev/null +++ b/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java @@ -0,0 +1,23 @@ +package org.baeldung.web.controller; + +import org.springframework.security.access.annotation.Secured; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + + +@Controller +@RequestMapping("/runas") +public class RunAsController { + + @Secured({ "ROLE_USER", "RUN_AS_REPORTER" }) + @RequestMapping + @ResponseBody + public String tryRunAs() { + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + return "Current User Authorities inside this RunAS method only " + + auth.getAuthorities().toString(); + } +} diff --git a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java b/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java index 83c0292d98..fbcb9b979e 100644 --- a/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java +++ b/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java @@ -10,4 +10,9 @@ public class ViewController { public String index() { return "index"; } + + @RequestMapping({ "/runashome" }) + public String run() { + return "runas"; + } } diff --git a/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html b/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html new file mode 100644 index 0000000000..c7c3b2e0e4 --- /dev/null +++ b/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html @@ -0,0 +1,23 @@ + + + + Current user authorities: + user +
+ + Generate Report As Super User + + + + + \ No newline at end of file From 0933326ea9bf9e9b945dd7cfa9ca8b8802df9f6d Mon Sep 17 00:00:00 2001 From: TINO Date: Sun, 9 Jun 2019 23:10:28 +0300 Subject: [PATCH 17/70] BAEL-2956 Initial Commit --- libraries-2/pom.xml | 12 ++ .../chroniclemap/ChronicleMapUnitTest.java | 132 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 6303c0cab5..2e23e0433c 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -55,6 +55,17 @@ spring-boot-starter ${spring-boot-starter.version}
+ + net.openhft + chronicle-map + ${chronicle.map.version} + + + com.sun.java + tools + + +
@@ -62,6 +73,7 @@ 4.8.28 6.0.0.Final 3.9.6 + 3.17.2 2.1.4.RELEASE
diff --git a/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java new file mode 100644 index 0000000000..f396fbb443 --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java @@ -0,0 +1,132 @@ +package com.baeldung.chroniclemap; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.io.File; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import net.openhft.chronicle.core.values.LongValue; +import net.openhft.chronicle.map.ChronicleMap; +import net.openhft.chronicle.map.ExternalMapQueryContext; +import net.openhft.chronicle.map.MapEntry; +import net.openhft.chronicle.values.Values; + +public class ChronicleMapUnitTest { + + static ChronicleMap persistedCountryMap = null; + + static ChronicleMap inMemoryCountryMap = null; + + static ChronicleMap> multiMap = null; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @BeforeClass + public static void init() { + try { + inMemoryCountryMap = ChronicleMap.of(LongValue.class, CharSequence.class) + .name("country-map") + .entries(50) + .averageValue("America") + .create(); + + persistedCountryMap = ChronicleMap.of(LongValue.class, CharSequence.class) + .name("country-map") + .entries(50) + .averageValue("America") + .createPersistedTo(new File(System.getProperty("java.io.tmpdir") + "country-details.dat")); + + Set averageValue = IntStream.of(1, 2) + .boxed() + .collect(Collectors.toSet()); + multiMap = ChronicleMap.of(Integer.class, (Class>) (Class) Set.class) + .name("multi-map") + .entries(50) + .averageValue(averageValue) + .create(); + + LongValue qatarKey = Values.newHeapInstance(LongValue.class); + qatarKey.setValue(1); + inMemoryCountryMap.put(qatarKey, "Qatar"); + + LongValue key = Values.newHeapInstance(LongValue.class); + key.setValue(1); + persistedCountryMap.put(key, "Romania"); + key.setValue(2); + persistedCountryMap.put(key, "India"); + + Set set1 = new HashSet<>(); + set1.add(1); + set1.add(2); + multiMap.put(1, set1); + + Set set2 = new HashSet<>(); + set2.add(3); + multiMap.put(2, set2); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void shouldReturnResult_whenQuery_withGet() { + LongValue key = Values.newHeapInstance(LongValue.class); + key.setValue(1); + CharSequence country = inMemoryCountryMap.get(key); + assertThat(country.toString(), is(equalTo("Qatar"))); + } + + @Test + public void shouldReturnResult_whenQuery_withGetUsing() { + LongValue key = Values.newHeapInstance(LongValue.class); + StringBuilder country = new StringBuilder(); + key.setValue(1); + persistedCountryMap.getUsing(key, country); + assertThat(country.toString(), is(equalTo("Romania"))); + key.setValue(2); + persistedCountryMap.getUsing(key, country); + assertThat(country.toString(), is(equalTo("India"))); + } + + @Test + public void shouldChangeTheValue_whenManage_withMultipleKeys() { + try (ExternalMapQueryContext, ?> fistContext = multiMap.queryContext(1)) { + try (ExternalMapQueryContext, ?> secondContext = multiMap.queryContext(2)) { + fistContext.updateLock() + .lock(); + secondContext.updateLock() + .lock(); + MapEntry> firstEntry = fistContext.entry(); + Set firstSet = firstEntry.value() + .get(); + firstSet.remove(2); + MapEntry> secondEntry = secondContext.entry(); + Set secondSet = secondEntry.value() + .get(); + secondSet.add(4); + firstEntry.doReplaceValue(fistContext.wrapValueAsData(firstSet)); + secondEntry.doReplaceValue(secondContext.wrapValueAsData(secondSet)); + } + } finally { + assertThat(multiMap.get(1) + .size(), is(equalTo(1))); + assertThat(multiMap.get(2) + .size(), is(equalTo(2))); + } + } + + @AfterClass + public static void finish() { + persistedCountryMap.close(); + inMemoryCountryMap.close(); + multiMap.close(); + } +} From b3d77616e1eb977b4498e91183f4c3c8a82d1f49 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Wed, 12 Jun 2019 01:49:11 +0530 Subject: [PATCH 18/70] [BAEL-14847] - Fix tests in spring-activi, spring-data-cassandra-reactive modules --- .../spring-data-cassandra-reactive/pom.xml | 8 + ...tiveEmployeeRepositoryIntegrationTest.java | 23 +- .../src/test/resources/cassandra-init.cql | 7 + .../src/test/resources/cassandra-server.yaml | 590 ++++++++++++++++++ .../SpringContextIntegrationTest.java | 2 + ...ActivitiSpringSecurityIntegrationTest.java | 2 + ...iWithSpringApplicationIntegrationTest.java | 4 +- .../ProcessEngineCreationIntegrationTest.java | 7 +- 8 files changed, 639 insertions(+), 4 deletions(-) create mode 100644 persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-init.cql create mode 100644 persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-server.yaml diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 5a34d90c9f..288f842201 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -46,6 +46,13 @@ reactor-test test + + org.cassandraunit + cassandra-unit-spring + ${cassandra-unit-spring.version} + test + +
@@ -53,6 +60,7 @@ UTF-8 2.1.2.RELEASE + 3.11.2.0 diff --git a/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java b/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java index ad726fe969..ae314db5e7 100644 --- a/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java @@ -1,13 +1,23 @@ package com.baeldung.cassandra.reactive; -import com.baeldung.cassandra.reactive.model.Employee; -import com.baeldung.cassandra.reactive.repository.EmployeeRepository; +import org.cassandraunit.spring.CassandraDataSet; +import org.cassandraunit.spring.CassandraUnitDependencyInjectionTestExecutionListener; +import org.cassandraunit.spring.CassandraUnitTestExecutionListener; +import org.cassandraunit.spring.EmbeddedCassandra; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextTestExecutionListener; +import org.springframework.test.context.web.ServletTestExecutionListener; + +import com.baeldung.cassandra.reactive.model.Employee; +import com.baeldung.cassandra.reactive.repository.EmployeeRepository; + import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -15,6 +25,15 @@ import reactor.test.StepVerifier; @RunWith(SpringRunner.class) @SpringBootTest +@TestExecutionListeners(listeners = { + CassandraUnitDependencyInjectionTestExecutionListener.class, + CassandraUnitTestExecutionListener.class, + ServletTestExecutionListener.class, + DependencyInjectionTestExecutionListener.class, + DirtiesContextTestExecutionListener.class +}) +@EmbeddedCassandra(timeout = 60000, configuration = "cassandra-server.yaml") +@CassandraDataSet(value = {"cassandra-init.cql"}, keyspace = "practice") public class ReactiveEmployeeRepositoryIntegrationTest { @Autowired diff --git a/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-init.cql b/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-init.cql new file mode 100644 index 0000000000..b28fda5320 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-init.cql @@ -0,0 +1,7 @@ +CREATE TABLE employee( + id int PRIMARY KEY, + name text, + address text, + email text, + age int +); \ No newline at end of file diff --git a/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-server.yaml b/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-server.yaml new file mode 100644 index 0000000000..af3fb21e54 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/test/resources/cassandra-server.yaml @@ -0,0 +1,590 @@ +# Cassandra storage config YAML + +# NOTE: +# See http://wiki.apache.org/cassandra/StorageConfiguration for +# full explanations of configuration directives +# /NOTE + +# The name of the cluster. This is mainly used to prevent machines in +# one logical cluster from joining another. +cluster_name: 'Test Cluster' + +# You should always specify InitialToken when setting up a production +# cluster for the first time, and often when adding capacity later. +# The principle is that each node should be given an equal slice of +# the token ring; see http://wiki.apache.org/cassandra/Operations +# for more details. +# +# If blank, Cassandra will request a token bisecting the range of +# the heaviest-loaded existing node. If there is no load information +# available, such as is the case with a new cluster, it will pick +# a random token, which will lead to hot spots. +#initial_token: + +# See http://wiki.apache.org/cassandra/HintedHandoff +hinted_handoff_enabled: true +# this defines the maximum amount of time a dead host will have hints +# generated. After it has been dead this long, new hints for it will not be +# created until it has been seen alive and gone down again. +max_hint_window_in_ms: 10800000 # 3 hours +# Maximum throttle in KBs per second, per delivery thread. This will be +# reduced proportionally to the number of nodes in the cluster. (If there +# are two nodes in the cluster, each delivery thread will use the maximum +# rate; if there are three, each will throttle to half of the maximum, +# since we expect two nodes to be delivering hints simultaneously.) +hinted_handoff_throttle_in_kb: 1024 +# Number of threads with which to deliver hints; +# Consider increasing this number when you have multi-dc deployments, since +# cross-dc handoff tends to be slower +max_hints_delivery_threads: 2 + +hints_directory: target/embeddedCassandra/hints + +# The following setting populates the page cache on memtable flush and compaction +# WARNING: Enable this setting only when the whole node's data fits in memory. +# Defaults to: false +# populate_io_cache_on_flush: false + +# Authentication backend, implementing IAuthenticator; used to identify users +# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthenticator, +# PasswordAuthenticator}. +# +# - AllowAllAuthenticator performs no checks - set it to disable authentication. +# - PasswordAuthenticator relies on username/password pairs to authenticate +# users. It keeps usernames and hashed passwords in system_auth.credentials table. +# Please increase system_auth keyspace replication factor if you use this authenticator. +authenticator: AllowAllAuthenticator + +# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions +# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer, +# CassandraAuthorizer}. +# +# - AllowAllAuthorizer allows any action to any user - set it to disable authorization. +# - CassandraAuthorizer stores permissions in system_auth.permissions table. Please +# increase system_auth keyspace replication factor if you use this authorizer. +authorizer: AllowAllAuthorizer + +# Validity period for permissions cache (fetching permissions can be an +# expensive operation depending on the authorizer, CassandraAuthorizer is +# one example). Defaults to 2000, set to 0 to disable. +# Will be disabled automatically for AllowAllAuthorizer. +permissions_validity_in_ms: 2000 + + +# The partitioner is responsible for distributing rows (by key) across +# nodes in the cluster. Any IPartitioner may be used, including your/m +# own as long as it is on the classpath. Out of the box, Cassandra +# provides org.apache.cassandra.dht.{Murmur3Partitioner, RandomPartitioner +# ByteOrderedPartitioner, OrderPreservingPartitioner (deprecated)}. +# +# - RandomPartitioner distributes rows across the cluster evenly by md5. +# This is the default prior to 1.2 and is retained for compatibility. +# - Murmur3Partitioner is similar to RandomPartioner but uses Murmur3_128 +# Hash Function instead of md5. When in doubt, this is the best option. +# - ByteOrderedPartitioner orders rows lexically by key bytes. BOP allows +# scanning rows in key order, but the ordering can generate hot spots +# for sequential insertion workloads. +# - OrderPreservingPartitioner is an obsolete form of BOP, that stores +# - keys in a less-efficient format and only works with keys that are +# UTF8-encoded Strings. +# - CollatingOPP collates according to EN,US rules rather than lexical byte +# ordering. Use this as an example if you need custom collation. +# +# See http://wiki.apache.org/cassandra/Operations for more on +# partitioners and token selection. +partitioner: org.apache.cassandra.dht.Murmur3Partitioner + +# directories where Cassandra should store data on disk. +data_file_directories: + - target/embeddedCassandra/data + +# commit log +commitlog_directory: target/embeddedCassandra/commitlog + +cdc_raw_directory: target/embeddedCassandra/cdc + +# policy for data disk failures: +# stop: shut down gossip and Thrift, leaving the node effectively dead, but +# can still be inspected via JMX. +# best_effort: stop using the failed disk and respond to requests based on +# remaining available sstables. This means you WILL see obsolete +# data at CL.ONE! +# ignore: ignore fatal errors and let requests fail, as in pre-1.2 Cassandra +disk_failure_policy: stop + + +# Maximum size of the key cache in memory. +# +# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the +# minimum, sometimes more. The key cache is fairly tiny for the amount of +# time it saves, so it's worthwhile to use it at large numbers. +# The row cache saves even more time, but must store the whole values of +# its rows, so it is extremely space-intensive. It's best to only use the +# row cache if you have hot rows or static rows. +# +# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup. +# +# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache. +key_cache_size_in_mb: + +# Duration in seconds after which Cassandra should +# safe the keys cache. Caches are saved to saved_caches_directory as +# specified in this configuration file. +# +# Saved caches greatly improve cold-start speeds, and is relatively cheap in +# terms of I/O for the key cache. Row cache saving is much more expensive and +# has limited use. +# +# Default is 14400 or 4 hours. +key_cache_save_period: 14400 + +# Number of keys from the key cache to save +# Disabled by default, meaning all keys are going to be saved +# key_cache_keys_to_save: 100 + +# Maximum size of the row cache in memory. +# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup. +# +# Default value is 0, to disable row caching. +row_cache_size_in_mb: 0 + +# Duration in seconds after which Cassandra should +# safe the row cache. Caches are saved to saved_caches_directory as specified +# in this configuration file. +# +# Saved caches greatly improve cold-start speeds, and is relatively cheap in +# terms of I/O for the key cache. Row cache saving is much more expensive and +# has limited use. +# +# Default is 0 to disable saving the row cache. +row_cache_save_period: 0 + +# Number of keys from the row cache to save +# Disabled by default, meaning all keys are going to be saved +# row_cache_keys_to_save: 100 + +# saved caches +saved_caches_directory: target/embeddedCassandra/saved_caches + +# commitlog_sync may be either "periodic" or "batch." +# When in batch mode, Cassandra won't ack writes until the commit log +# has been fsynced to disk. It will wait up to +# commitlog_sync_batch_window_in_ms milliseconds for other writes, before +# performing the sync. +# +# commitlog_sync: batch +# commitlog_sync_batch_window_in_ms: 50 +# +# the other option is "periodic" where writes may be acked immediately +# and the CommitLog is simply synced every commitlog_sync_period_in_ms +# milliseconds. +commitlog_sync: periodic +commitlog_sync_period_in_ms: 10000 + +# The size of the individual commitlog file segments. A commitlog +# segment may be archived, deleted, or recycled once all the data +# in it (potentially from each columnfamily in the system) has been +# flushed to sstables. +# +# The default size is 32, which is almost always fine, but if you are +# archiving commitlog segments (see commitlog_archiving.properties), +# then you probably want a finer granularity of archiving; 8 or 16 MB +# is reasonable. +commitlog_segment_size_in_mb: 32 + +# any class that implements the SeedProvider interface and has a +# constructor that takes a Map of parameters will do. +seed_provider: + # Addresses of hosts that are deemed contact points. + # Cassandra nodes use this list of hosts to find each other and learn + # the topology of the ring. You must change this if you are running + # multiple nodes! + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + # seeds is actually a comma-delimited list of addresses. + # Ex: ",," + - seeds: "127.0.0.1" + + +# For workloads with more data than can fit in memory, Cassandra's +# bottleneck will be reads that need to fetch data from +# disk. "concurrent_reads" should be set to (16 * number_of_drives) in +# order to allow the operations to enqueue low enough in the stack +# that the OS and drives can reorder them. +# +# On the other hand, since writes are almost never IO bound, the ideal +# number of "concurrent_writes" is dependent on the number of cores in +# your system; (8 * number_of_cores) is a good rule of thumb. +concurrent_reads: 32 +concurrent_writes: 32 + +# Total memory to use for memtables. Cassandra will flush the largest +# memtable when this much memory is used. +# If omitted, Cassandra will set it to 1/3 of the heap. +# memtable_total_space_in_mb: 2048 + +# Total space to use for commitlogs. +# If space gets above this value (it will round up to the next nearest +# segment multiple), Cassandra will flush every dirty CF in the oldest +# segment and remove it. +# commitlog_total_space_in_mb: 4096 + +# This sets the amount of memtable flush writer threads. These will +# be blocked by disk io, and each one will hold a memtable in memory +# while blocked. If you have a large heap and many data directories, +# you can increase this value for better flush performance. +# By default this will be set to the amount of data directories defined. +#memtable_flush_writers: 1 + +# the number of full memtables to allow pending flush, that is, +# waiting for a writer thread. At a minimum, this should be set to +# the maximum number of secondary indexes created on a single CF. +#memtable_flush_queue_size: 4 + +# Whether to, when doing sequential writing, fsync() at intervals in +# order to force the operating system to flush the dirty +# buffers. Enable this to avoid sudden dirty buffer flushing from +# impacting read latencies. Almost always a good idea on SSD:s; not +# necessarily on platters. +trickle_fsync: false +trickle_fsync_interval_in_kb: 10240 + +# TCP port, for commands and data +storage_port: 7010 + +# SSL port, for encrypted communication. Unused unless enabled in +# encryption_options +ssl_storage_port: 7011 + +# Address to bind to and tell other Cassandra nodes to connect to. You +# _must_ change this if you want multiple nodes to be able to +# communicate! +# +# Leaving it blank leaves it up to InetAddress.getLocalHost(). This +# will always do the Right Thing *if* the node is properly configured +# (hostname, name resolution, etc), and the Right Thing is to use the +# address associated with the hostname (it might not be). +# +# Setting this to 0.0.0.0 is always wrong. +listen_address: 127.0.0.1 + +start_native_transport: true +# port for the CQL native transport to listen for clients on +native_transport_port: 9042 + +# Whether to start the thrift rpc server. +start_rpc: true + +# Address to broadcast to other Cassandra nodes +# Leaving this blank will set it to the same value as listen_address +# broadcast_address: 1.2.3.4 + +# The address to bind the Thrift RPC service to -- clients connect +# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if +# you want Thrift to listen on all interfaces. +# +# Leaving this blank has the same effect it does for ListenAddress, +# (i.e. it will be based on the configured hostname of the node). +rpc_address: localhost +# port for Thrift to listen for clients on +rpc_port: 9171 + +# enable or disable keepalive on rpc connections +rpc_keepalive: true + +# Cassandra provides three options for the RPC Server: +# +# sync -> One connection per thread in the rpc pool (see below). +# For a very large number of clients, memory will be your limiting +# factor; on a 64 bit JVM, 128KB is the minimum stack size per thread. +# Connection pooling is very, very strongly recommended. +# +# async -> Nonblocking server implementation with one thread to serve +# rpc connections. This is not recommended for high throughput use +# cases. Async has been tested to be about 50% slower than sync +# or hsha and is deprecated: it will be removed in the next major release. +# +# hsha -> Stands for "half synchronous, half asynchronous." The rpc thread pool +# (see below) is used to manage requests, but the threads are multiplexed +# across the different clients. +# +# The default is sync because on Windows hsha is about 30% slower. On Linux, +# sync/hsha performance is about the same, with hsha of course using less memory. +rpc_server_type: sync + +# Uncomment rpc_min|max|thread to set request pool size. +# You would primarily set max for the sync server to safeguard against +# misbehaved clients; if you do hit the max, Cassandra will block until one +# disconnects before accepting more. The defaults for sync are min of 16 and max +# unlimited. +# +# For the Hsha server, the min and max both default to quadruple the number of +# CPU cores. +# +# This configuration is ignored by the async server. +# +# rpc_min_threads: 16 +# rpc_max_threads: 2048 + +# uncomment to set socket buffer sizes on rpc connections +# rpc_send_buff_size_in_bytes: +# rpc_recv_buff_size_in_bytes: + +# Frame size for thrift (maximum field length). +# 0 disables TFramedTransport in favor of TSocket. This option +# is deprecated; we strongly recommend using Framed mode. +thrift_framed_transport_size_in_mb: 15 + +# The max length of a thrift message, including all fields and +# internal thrift overhead. +thrift_max_message_length_in_mb: 16 + +# Set to true to have Cassandra create a hard link to each sstable +# flushed or streamed locally in a backups/ subdirectory of the +# Keyspace data. Removing these links is the operator's +# responsibility. +incremental_backups: false + +# Whether or not to take a snapshot before each compaction. Be +# careful using this option, since Cassandra won't clean up the +# snapshots for you. Mostly useful if you're paranoid when there +# is a data format change. +snapshot_before_compaction: false + +# Whether or not a snapshot is taken of the data before keyspace truncation +# or dropping of column families. The STRONGLY advised default of true +# should be used to provide data safety. If you set this flag to false, you will +# lose data on truncation or drop. +auto_snapshot: false + +# Add column indexes to a row after its contents reach this size. +# Increase if your column values are large, or if you have a very large +# number of columns. The competing causes are, Cassandra has to +# deserialize this much of the row to read a single column, so you want +# it to be small - at least if you do many partial-row reads - but all +# the index data is read for each access, so you don't want to generate +# that wastefully either. +column_index_size_in_kb: 64 + +# Size limit for rows being compacted in memory. Larger rows will spill +# over to disk and use a slower two-pass compaction process. A message +# will be logged specifying the row key. +#in_memory_compaction_limit_in_mb: 64 + +# Number of simultaneous compactions to allow, NOT including +# validation "compactions" for anti-entropy repair. Simultaneous +# compactions can help preserve read performance in a mixed read/write +# workload, by mitigating the tendency of small sstables to accumulate +# during a single long running compactions. The default is usually +# fine and if you experience problems with compaction running too +# slowly or too fast, you should look at +# compaction_throughput_mb_per_sec first. +# +# This setting has no effect on LeveledCompactionStrategy. +# +# concurrent_compactors defaults to the number of cores. +# Uncomment to make compaction mono-threaded, the pre-0.8 default. +#concurrent_compactors: 1 + +# Multi-threaded compaction. When enabled, each compaction will use +# up to one thread per core, plus one thread per sstable being merged. +# This is usually only useful for SSD-based hardware: otherwise, +# your concern is usually to get compaction to do LESS i/o (see: +# compaction_throughput_mb_per_sec), not more. +#multithreaded_compaction: false + +# Throttles compaction to the given total throughput across the entire +# system. The faster you insert data, the faster you need to compact in +# order to keep the sstable count down, but in general, setting this to +# 16 to 32 times the rate you are inserting data is more than sufficient. +# Setting this to 0 disables throttling. Note that this account for all types +# of compaction, including validation compaction. +compaction_throughput_mb_per_sec: 16 + +# Track cached row keys during compaction, and re-cache their new +# positions in the compacted sstable. Disable if you use really large +# key caches. +#compaction_preheat_key_cache: true + +# Throttles all outbound streaming file transfers on this node to the +# given total throughput in Mbps. This is necessary because Cassandra does +# mostly sequential IO when streaming data during bootstrap or repair, which +# can lead to saturating the network connection and degrading rpc performance. +# When unset, the default is 200 Mbps or 25 MB/s. +# stream_throughput_outbound_megabits_per_sec: 200 + +# How long the coordinator should wait for read operations to complete +read_request_timeout_in_ms: 5000 +# How long the coordinator should wait for seq or index scans to complete +range_request_timeout_in_ms: 10000 +# How long the coordinator should wait for writes to complete +write_request_timeout_in_ms: 2000 +# How long a coordinator should continue to retry a CAS operation +# that contends with other proposals for the same row +cas_contention_timeout_in_ms: 1000 +# How long the coordinator should wait for truncates to complete +# (This can be much longer, because unless auto_snapshot is disabled +# we need to flush first so we can snapshot before removing the data.) +truncate_request_timeout_in_ms: 60000 +# The default timeout for other, miscellaneous operations +request_timeout_in_ms: 10000 + +# Enable operation timeout information exchange between nodes to accurately +# measure request timeouts. If disabled, replicas will assume that requests +# were forwarded to them instantly by the coordinator, which means that +# under overload conditions we will waste that much extra time processing +# already-timed-out requests. +# +# Warning: before enabling this property make sure to ntp is installed +# and the times are synchronized between the nodes. +cross_node_timeout: false + +# Enable socket timeout for streaming operation. +# When a timeout occurs during streaming, streaming is retried from the start +# of the current file. This _can_ involve re-streaming an important amount of +# data, so you should avoid setting the value too low. +# Default value is 0, which never timeout streams. +# streaming_socket_timeout_in_ms: 0 + +# phi value that must be reached for a host to be marked down. +# most users should never need to adjust this. +# phi_convict_threshold: 8 + +# endpoint_snitch -- Set this to a class that implements +# IEndpointSnitch. The snitch has two functions: +# - it teaches Cassandra enough about your network topology to route +# requests efficiently +# - it allows Cassandra to spread replicas around your cluster to avoid +# correlated failures. It does this by grouping machines into +# "datacenters" and "racks." Cassandra will do its best not to have +# more than one replica on the same "rack" (which may not actually +# be a physical location) +# +# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER, +# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS +# ARE PLACED. +# +# Out of the box, Cassandra provides +# - SimpleSnitch: +# Treats Strategy order as proximity. This improves cache locality +# when disabling read repair, which can further improve throughput. +# Only appropriate for single-datacenter deployments. +# - PropertyFileSnitch: +# Proximity is determined by rack and data center, which are +# explicitly configured in cassandra-topology.properties. +# - RackInferringSnitch: +# Proximity is determined by rack and data center, which are +# assumed to correspond to the 3rd and 2nd octet of each node's +# IP address, respectively. Unless this happens to match your +# deployment conventions (as it did Facebook's), this is best used +# as an example of writing a custom Snitch class. +# - Ec2Snitch: +# Appropriate for EC2 deployments in a single Region. Loads Region +# and Availability Zone information from the EC2 API. The Region is +# treated as the Datacenter, and the Availability Zone as the rack. +# Only private IPs are used, so this will not work across multiple +# Regions. +# - Ec2MultiRegionSnitch: +# Uses public IPs as broadcast_address to allow cross-region +# connectivity. (Thus, you should set seed addresses to the public +# IP as well.) You will need to open the storage_port or +# ssl_storage_port on the public IP firewall. (For intra-Region +# traffic, Cassandra will switch to the private IP after +# establishing a connection.) +# +# You can use a custom Snitch by setting this to the full class name +# of the snitch, which will be assumed to be on your classpath. +endpoint_snitch: SimpleSnitch + +# controls how often to perform the more expensive part of host score +# calculation +dynamic_snitch_update_interval_in_ms: 100 +# controls how often to reset all host scores, allowing a bad host to +# possibly recover +dynamic_snitch_reset_interval_in_ms: 600000 +# if set greater than zero and read_repair_chance is < 1.0, this will allow +# 'pinning' of replicas to hosts in order to increase cache capacity. +# The badness threshold will control how much worse the pinned host has to be +# before the dynamic snitch will prefer other replicas over it. This is +# expressed as a double which represents a percentage. Thus, a value of +# 0.2 means Cassandra would continue to prefer the static snitch values +# until the pinned host was 20% worse than the fastest. +dynamic_snitch_badness_threshold: 0.1 + +# request_scheduler -- Set this to a class that implements +# RequestScheduler, which will schedule incoming client requests +# according to the specific policy. This is useful for multi-tenancy +# with a single Cassandra cluster. +# NOTE: This is specifically for requests from the client and does +# not affect inter node communication. +# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place +# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of +# client requests to a node with a separate queue for each +# request_scheduler_id. The scheduler is further customized by +# request_scheduler_options as described below. +request_scheduler: org.apache.cassandra.scheduler.NoScheduler + +# Scheduler Options vary based on the type of scheduler +# NoScheduler - Has no options +# RoundRobin +# - throttle_limit -- The throttle_limit is the number of in-flight +# requests per client. Requests beyond +# that limit are queued up until +# running requests can complete. +# The value of 80 here is twice the number of +# concurrent_reads + concurrent_writes. +# - default_weight -- default_weight is optional and allows for +# overriding the default which is 1. +# - weights -- Weights are optional and will default to 1 or the +# overridden default_weight. The weight translates into how +# many requests are handled during each turn of the +# RoundRobin, based on the scheduler id. +# +# request_scheduler_options: +# throttle_limit: 80 +# default_weight: 5 +# weights: +# Keyspace1: 1 +# Keyspace2: 5 + +# request_scheduler_id -- An identifer based on which to perform +# the request scheduling. Currently the only valid option is keyspace. +# request_scheduler_id: keyspace + +# index_interval controls the sampling of entries from the primrary +# row index in terms of space versus time. The larger the interval, +# the smaller and less effective the sampling will be. In technicial +# terms, the interval coresponds to the number of index entries that +# are skipped between taking each sample. All the sampled entries +# must fit in memory. Generally, a value between 128 and 512 here +# coupled with a large key cache size on CFs results in the best trade +# offs. This value is not often changed, however if you have many +# very small rows (many to an OS page), then increasing this will +# often lower memory usage without a impact on performance. +index_interval: 128 + +# Enable or disable inter-node encryption +# Default settings are TLS v1, RSA 1024-bit keys (it is imperative that +# users generate their own keys) TLS_RSA_WITH_AES_128_CBC_SHA as the cipher +# suite for authentication, key exchange and encryption of the actual data transfers. +# NOTE: No custom encryption options are enabled at the moment +# The available internode options are : all, none, dc, rack +# +# If set to dc cassandra will encrypt the traffic between the DCs +# If set to rack cassandra will encrypt the traffic between the racks +# +# The passwords used in these options must match the passwords used when generating +# the keystore and truststore. For instructions on generating these files, see: +# http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore +# +encryption_options: + internode_encryption: none + keystore: conf/.keystore + keystore_password: cassandra + truststore: conf/.truststore + truststore_password: cassandra + # More advanced defaults below: + # protocol: TLS + # algorithm: SunX509 + # store_type: JKS + # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA] \ No newline at end of file diff --git a/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java index ce48080753..89411df976 100644 --- a/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -2,6 +2,7 @@ package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -9,6 +10,7 @@ import com.baeldung.activitiwithspring.ActivitiWithSpringApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = ActivitiWithSpringApplication.class) +@AutoConfigureTestDatabase public class SpringContextIntegrationTest { @Test diff --git a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java index 53bdcee888..7f99483fcf 100644 --- a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java @@ -4,6 +4,7 @@ import org.activiti.engine.IdentityService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.test.context.junit4.SpringRunner; @@ -14,6 +15,7 @@ import com.baeldung.activiti.security.withspring.ActivitiSpringSecurityApplicati @RunWith(SpringRunner.class) @SpringBootTest(classes = ActivitiSpringSecurityApplication.class) @WebAppConfiguration +@AutoConfigureTestDatabase public class ActivitiSpringSecurityIntegrationTest { @Autowired private IdentityService identityService; diff --git a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java index 8c1e400215..d289693a73 100644 --- a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java @@ -2,11 +2,13 @@ package com.baeldung.activitiwithspring; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest +@SpringBootTest(classes = ActivitiWithSpringApplication.class) +@AutoConfigureTestDatabase public class ActivitiWithSpringApplicationIntegrationTest { @Test diff --git a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java index 00538f8e6e..5052f84d6a 100644 --- a/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java @@ -4,7 +4,7 @@ import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; import org.activiti.engine.ProcessEngines; import org.junit.Test; - +import org.junit.After; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -62,4 +62,9 @@ public class ProcessEngineCreationIntegrationTest { assertNotNull(processEngine); assertEquals("sa", processEngine.getProcessEngineConfiguration().getJdbcUsername()); } + + @After + public void cleanup() { + ProcessEngines.destroy(); + } } From 2449c8117a6ddc87b76043cbd6a1ec10d1073329 Mon Sep 17 00:00:00 2001 From: Andrew Shcherbakov Date: Wed, 12 Jun 2019 07:18:14 +0200 Subject: [PATCH 19/70] Create a package for the article code --- .../main/java/com/baeldung/folding/Main.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java new file mode 100644 index 0000000000..47ae11c80c --- /dev/null +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java @@ -0,0 +1,21 @@ +package com.baeldung.folding; + +import java.util.stream.IntStream; + +public class Main { + public static void main(String... arg) { + final String key = "Java language"; + + toAsciiCodes(key).forEach(c -> System.out.println(c)); + // toAsciiCodes(key).reduce(new ArrayList(), (accum, i) -> i); + // List numbers = Arrays.asList(1, 2, 3, 4, 5, 6); + // numbers.stream() + // .reduce(new ArrayList(), (k, v) -> new ArrayList()); + // System.out.println(result); + } + + public static IntStream toAsciiCodes(String key) { + return key.chars(); + } + +} From f64b7c027b79a5d5a36c30a1859f826125ea4068 Mon Sep 17 00:00:00 2001 From: TINO Date: Wed, 12 Jun 2019 13:30:58 +0300 Subject: [PATCH 20/70] BAEL - 2956 Changed the test methods name --- .../com/baeldung/chroniclemap/ChronicleMapUnitTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java index f396fbb443..067e3c9ef5 100644 --- a/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java @@ -77,7 +77,7 @@ public class ChronicleMapUnitTest { } @Test - public void shouldReturnResult_whenQuery_withGet() { + public void givenGetQuery_whenCalled_shouldReturnResult() { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(1); CharSequence country = inMemoryCountryMap.get(key); @@ -85,7 +85,7 @@ public class ChronicleMapUnitTest { } @Test - public void shouldReturnResult_whenQuery_withGetUsing() { + public void givenGetUsingQuery_whenCalled_shouldReturnResult() { LongValue key = Values.newHeapInstance(LongValue.class); StringBuilder country = new StringBuilder(); key.setValue(1); @@ -97,7 +97,7 @@ public class ChronicleMapUnitTest { } @Test - public void shouldChangeTheValue_whenManage_withMultipleKeys() { + public void givenMultipleKeyQuery_whenProcessed_shouldChangeTheValue() { try (ExternalMapQueryContext, ?> fistContext = multiMap.queryContext(1)) { try (ExternalMapQueryContext, ?> secondContext = multiMap.queryContext(2)) { fistContext.updateLock() From e833ede83671764f526064aa310d5e8681d661d4 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 12 Jun 2019 13:00:24 +0000 Subject: [PATCH 21/70] BAEL-2958: Update elasticsearch demo project --- persistence-modules/elasticsearch/pom.xml | 20 ++++++------- .../main/java/com/baeldung/jest/Employee.java | 10 +++---- .../baeldung/jest/JestDemoApplication.java | 29 ++++++++++--------- .../src/main/resources/application.properties | 1 - 4 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 persistence-modules/elasticsearch/src/main/resources/application.properties diff --git a/persistence-modules/elasticsearch/pom.xml b/persistence-modules/elasticsearch/pom.xml index 7027f70900..ceed88aa24 100644 --- a/persistence-modules/elasticsearch/pom.xml +++ b/persistence-modules/elasticsearch/pom.xml @@ -2,18 +2,18 @@ 4.0.0 - com.baeldung.jest - jest-demo + com.baeldung + elasticsearch 0.0.1-SNAPSHOT - jest-demo - Demo project for Jest Client for Elasticsearch + elasticsearch + Demo project for Java Elasticsearch libraries - - - 8 - 1.8 - 1.8 - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + diff --git a/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java index 5a2c1a534f..6f28a42a9c 100644 --- a/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java +++ b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/Employee.java @@ -6,7 +6,7 @@ public class Employee { String name; String title; List skills; - int years_of_service; + int yearsOfService; public String getName() { return name; @@ -32,11 +32,11 @@ public class Employee { this.skills = skills; } - public int getYears_of_service() { - return years_of_service; + public int getYearsOfService() { + return yearsOfService; } - public void setYears_of_service(int years_of_service) { - this.years_of_service = years_of_service; + public void setYearsOfService(int yearsOfService) { + this.yearsOfService = yearsOfService; } } diff --git a/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java index e4c8ef51be..91e499da2e 100644 --- a/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/persistence-modules/elasticsearch/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -2,8 +2,6 @@ package com.baeldung.jest; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import io.searchbox.client.JestClient; import io.searchbox.client.JestClientFactory; import io.searchbox.client.JestResult; @@ -15,8 +13,6 @@ import io.searchbox.indices.IndicesExists; import io.searchbox.indices.aliases.AddAliasMapping; import io.searchbox.indices.aliases.ModifyAliases; import io.searchbox.indices.aliases.RemoveAliasMapping; -import io.searchbox.indices.mapping.PutMapping; -import io.searchbox.indices.settings.GetSettings; import java.io.IOException; import java.util.*; @@ -50,20 +46,27 @@ public class JestDemoApplication { "e") .build()) .build()); - jestClient.execute(new ModifyAliases.Builder( + JestResult jestResult = jestClient.execute(new ModifyAliases.Builder( new RemoveAliasMapping.Builder( "employees", "e") .build()) .build()); + if(jestResult.isSucceeded()) { + System.out.println("Success!"); + } + else { + System.out.println(jestResult.getErrorMessage()); + } + // Sample JSON for indexing // { // "name": "Michael Pratt", // "title": "Java Developer", // "skills": ["java", "spring", "elasticsearch"], - // "years_of_service": 2 + // "yearsOfService": 2 // } // Index a document from String @@ -71,7 +74,7 @@ public class JestDemoApplication { JsonNode employeeJsonNode = mapper.createObjectNode() .put("name", "Michael Pratt") .put("title", "Java Developer") - .put("years_of_service", 2) + .put("yearsOfService", 2) .set("skills", mapper.createArrayNode() .add("java") .add("spring") @@ -82,7 +85,7 @@ public class JestDemoApplication { Map employeeHashMap = new LinkedHashMap<>(); employeeHashMap.put("name", "Michael Pratt"); employeeHashMap.put("title", "Java Developer"); - employeeHashMap.put("years_of_service", 2); + employeeHashMap.put("yearsOfService", 2); employeeHashMap.put("skills", Arrays.asList("java", "spring", "elasticsearch")); jestClient.execute(new Index.Builder(employeeHashMap).index("employees").build()); @@ -90,7 +93,7 @@ public class JestDemoApplication { Employee employee = new Employee(); employee.setName("Michael Pratt"); employee.setTitle("Java Developer"); - employee.setYears_of_service(2); + employee.setYearsOfService(2); employee.setSkills(Arrays.asList("java", "spring", "elasticsearch")); jestClient.execute(new Index.Builder(employee).index("employees").build()); @@ -116,7 +119,7 @@ public class JestDemoApplication { }); // Update document - employee.setYears_of_service(3); + employee.setYearsOfService(3); jestClient.execute(new Update.Builder(employee).index("employees").id("1").build()); // Delete documents @@ -126,13 +129,13 @@ public class JestDemoApplication { Employee employeeObject1 = new Employee(); employee.setName("John Smith"); employee.setTitle("Python Developer"); - employee.setYears_of_service(10); + employee.setYearsOfService(10); employee.setSkills(Arrays.asList("python")); Employee employeeObject2 = new Employee(); employee.setName("Kate Smith"); employee.setTitle("Senior JavaScript Developer"); - employee.setYears_of_service(10); + employee.setYearsOfService(10); employee.setSkills(Arrays.asList("javascript", "angular")); jestClient.execute(new Bulk.Builder().defaultIndex("employees") @@ -144,7 +147,7 @@ public class JestDemoApplication { Employee employeeObject3 = new Employee(); employee.setName("Jane Doe"); employee.setTitle("Manager"); - employee.setYears_of_service(20); + employee.setYearsOfService(20); employee.setSkills(Arrays.asList("managing")); jestClient.executeAsync( new Index.Builder(employeeObject3).build(), new JestResultHandler() { diff --git a/persistence-modules/elasticsearch/src/main/resources/application.properties b/persistence-modules/elasticsearch/src/main/resources/application.properties deleted file mode 100644 index 8b13789179..0000000000 --- a/persistence-modules/elasticsearch/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - From bcfd52064324e682288a94a52e6bab7b74b76559 Mon Sep 17 00:00:00 2001 From: Jon Cook Date: Wed, 12 Jun 2019 18:25:28 +0200 Subject: [PATCH 22/70] BAEL-2913 - TempDir Support --- pom.xml | 2 +- testing-modules/junit-5-basics/pom.xml | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 11d5f8df95..9760e06bc1 100644 --- a/pom.xml +++ b/pom.xml @@ -1559,7 +1559,7 @@ 2.9.8 1.3 1.2.0 - 5.4.2 + 5.2.0 0.3.1 2.5.1 0.0.1 diff --git a/testing-modules/junit-5-basics/pom.xml b/testing-modules/junit-5-basics/pom.xml index 5f36dd17cc..f72c14ee65 100644 --- a/testing-modules/junit-5-basics/pom.xml +++ b/testing-modules/junit-5-basics/pom.xml @@ -34,6 +34,24 @@ ${junit.vintage.version} test + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} + test + com.h2database h2 @@ -133,6 +151,8 @@ 5.4.2 + 1.2.0 + 5.4.2 1.4.196 5.0.6.RELEASE 2.21.0 From 2e383281a85ea2bbb0c5da0e71cf97e3707a8b1d Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Wed, 12 Jun 2019 23:14:04 +0200 Subject: [PATCH 23/70] Changed description for spring-boot-performance module --- parent-boot-performance/README.md | 2 +- parent-boot-performance/pom.xml | 2 +- spring-boot-performance/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parent-boot-performance/README.md b/parent-boot-performance/README.md index 963176a5e3..4ac49c9070 100644 --- a/parent-boot-performance/README.md +++ b/parent-boot-performance/README.md @@ -1 +1 @@ -This is a parent module for all projects using Spring Boot 2.2. +This is a parent module for projects taht want to take advantage of the performance improvements introduced in Spring Boot from version 2.2. diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index c7a0263716..49cea2ad30 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -5,7 +5,7 @@ 0.0.1-SNAPSHOT parent-boot-performance pom - Parent for all Spring Boot 2.2 modules + Parent for all modules taht want to take advantage of the performance improvements introduced in Spring Boot from version 2.2 com.baeldung diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index cb2dba359e..8f4c08002d 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -5,7 +5,7 @@ spring-boot-performance spring-boot-performance war - This is simple boot application for Spring boot 2.2 + This is a simple Spring Boot application taking advantage of the performance improvements introduced from version 2.2 parent-boot-performance From 20e1e2583122597b5f3b439c02eba0d14cffd974 Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Wed, 12 Jun 2019 23:20:32 +0200 Subject: [PATCH 24/70] Changed description for spring-boot-performance module --- parent-boot-performance/README.md | 4 +++- parent-boot-performance/pom.xml | 2 +- spring-boot-performance/pom.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/parent-boot-performance/README.md b/parent-boot-performance/README.md index 4ac49c9070..e8eb056fe3 100644 --- a/parent-boot-performance/README.md +++ b/parent-boot-performance/README.md @@ -1 +1,3 @@ -This is a parent module for projects taht want to take advantage of the performance improvements introduced in Spring Boot from version 2.2. +This is a parent module for projects taht want to take advantage of the latests Spring Boot improvements/features. + +Current version: Spring Boot 2.2 diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index 49cea2ad30..078f002968 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -5,7 +5,7 @@ 0.0.1-SNAPSHOT parent-boot-performance pom - Parent for all modules taht want to take advantage of the performance improvements introduced in Spring Boot from version 2.2 + Parent for all modules taht want to take advantage of the latests Spring Boot improvements/features. Current version: 2.2 com.baeldung diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index 8f4c08002d..5368377d36 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -5,7 +5,7 @@ spring-boot-performance spring-boot-performance war - This is a simple Spring Boot application taking advantage of the performance improvements introduced from version 2.2 + This is a simple Spring Boot application taking advantage of the latests Spring Boot improvements/features. Current version: 2.2 parent-boot-performance From d6bd06ddd99127b7dba6c13fcb24f288681b1020 Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Wed, 12 Jun 2019 23:23:21 +0200 Subject: [PATCH 25/70] fixed typos --- parent-boot-performance/README.md | 2 +- parent-boot-performance/pom.xml | 2 +- spring-boot-performance/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parent-boot-performance/README.md b/parent-boot-performance/README.md index e8eb056fe3..10775d9b00 100644 --- a/parent-boot-performance/README.md +++ b/parent-boot-performance/README.md @@ -1,3 +1,3 @@ -This is a parent module for projects taht want to take advantage of the latests Spring Boot improvements/features. +This is a parent module for projects taht want to take advantage of the latest Spring Boot improvements/features. Current version: Spring Boot 2.2 diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index 078f002968..0d39f0bb92 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -5,7 +5,7 @@ 0.0.1-SNAPSHOT parent-boot-performance pom - Parent for all modules taht want to take advantage of the latests Spring Boot improvements/features. Current version: 2.2 + Parent for all modules taht want to take advantage of the latest Spring Boot improvements/features. Current version: 2.2 com.baeldung diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index 5368377d36..207cd06f9b 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -5,7 +5,7 @@ spring-boot-performance spring-boot-performance war - This is a simple Spring Boot application taking advantage of the latests Spring Boot improvements/features. Current version: 2.2 + This is a simple Spring Boot application taking advantage of the latest Spring Boot improvements/features. Current version: 2.2 parent-boot-performance From 0ce2c744b367405985f6ff3c39ee21bdcb12c92f Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Wed, 12 Jun 2019 23:25:09 +0200 Subject: [PATCH 26/70] fixed typos --- parent-boot-performance/README.md | 2 +- parent-boot-performance/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parent-boot-performance/README.md b/parent-boot-performance/README.md index 10775d9b00..24abd27048 100644 --- a/parent-boot-performance/README.md +++ b/parent-boot-performance/README.md @@ -1,3 +1,3 @@ -This is a parent module for projects taht want to take advantage of the latest Spring Boot improvements/features. +This is a parent module for projects that want to take advantage of the latest Spring Boot improvements/features. Current version: Spring Boot 2.2 diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index 0d39f0bb92..62a1689b7f 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -5,7 +5,7 @@ 0.0.1-SNAPSHOT parent-boot-performance pom - Parent for all modules taht want to take advantage of the latest Spring Boot improvements/features. Current version: 2.2 + Parent for all modules that want to take advantage of the latest Spring Boot improvements/features. Current version: 2.2 com.baeldung From 5eaa0281230916d44a671e1a7428cc1f6054344c Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Thu, 13 Jun 2019 13:10:54 -0300 Subject: [PATCH 27/70] * Added test for constructor dependency injection article * removed spring version in xml file --- spring-core/pom.xml | 7 ++++ .../src/main/resources/constructordi.xml | 8 +++-- ...torDependencyInjectionIntegrationTest.java | 33 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java diff --git a/spring-core/pom.xml b/spring-core/pom.xml index 814addecdd..75e9fd7131 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -56,6 +56,12 @@ spring-boot-test ${mockito.spring.boot.version} test + + + org.assertj + assertj-core + ${assertj.version} + test commons-io @@ -85,6 +91,7 @@ 2.5 1.5.2.RELEASE 1.10.19 + 3.12.2 \ No newline at end of file diff --git a/spring-core/src/main/resources/constructordi.xml b/spring-core/src/main/resources/constructordi.xml index 231e72adcb..983a00a80f 100644 --- a/spring-core/src/main/resources/constructordi.xml +++ b/spring-core/src/main/resources/constructordi.xml @@ -1,19 +1,21 @@ + https://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + diff --git a/spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java new file mode 100644 index 0000000000..7bd0ad0c86 --- /dev/null +++ b/spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.constructordi; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.constructordi.domain.Car; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = Config.class) +public class ConstructorDependencyInjectionIntegrationTest { + + @Test + public void givenPrototypeInjection_WhenObjectFactory_ThenNewInstanceReturn() { + ApplicationContext context = new AnnotationConfigApplicationContext(Config.class); + Car firstContextCar = context.getBean(Car.class); + + ApplicationContext xmlContext = new ClassPathXmlApplicationContext("constructordi.xml"); + Car secondContextCar = xmlContext.getBean(Car.class); + + assertThat(firstContextCar).isNotSameAs(secondContextCar); + assertThat(firstContextCar).hasToString("Engine: v8 5 Transmission: sliding"); + assertThat(secondContextCar).hasToString("Engine: v4 2 Transmission: sliding"); + } + +} From be171f7f59cad31d406c9e44da5aee4a185457cf Mon Sep 17 00:00:00 2001 From: DOHA Date: Thu, 13 Jun 2019 21:38:53 +0300 Subject: [PATCH 28/70] iterable to collection --- .../IterableToCollectionUnitTest.java | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 java-collections-conversions/src/test/java/org/baeldung/java/collections/IterableToCollectionUnitTest.java diff --git a/java-collections-conversions/src/test/java/org/baeldung/java/collections/IterableToCollectionUnitTest.java b/java-collections-conversions/src/test/java/org/baeldung/java/collections/IterableToCollectionUnitTest.java new file mode 100644 index 0000000000..f2c80429d1 --- /dev/null +++ b/java-collections-conversions/src/test/java/org/baeldung/java/collections/IterableToCollectionUnitTest.java @@ -0,0 +1,122 @@ +package org.baeldung.java.collections; + +import static org.hamcrest.Matchers.contains; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.collections4.IteratorUtils; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +public class IterableToCollectionUnitTest { + + Iterable iterable = Arrays.asList("john", "tom", "jane"); + Iterator iterator = iterable.iterator(); + + @Test + public void whenConvertIterableToListUsingJava_thenSuccess() { + List result = new ArrayList(); + for (String str : iterable) { + result.add(str); + } + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIterableToListUsingJava8_thenSuccess() { + List result = new ArrayList(); + iterable.forEach(result::add); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIterableToListUsingJava8WithSpliterator_thenSuccess() { + List result = StreamSupport.stream(iterable.spliterator(), false) + .collect(Collectors.toList()); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIterableToListUsingGuava_thenSuccess() { + List result = Lists.newArrayList(iterable); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIterableToImmutableListUsingGuava_thenSuccess() { + List result = ImmutableList.copyOf(iterable); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIterableToListUsingApacheCommons_thenSuccess() { + List result = IterableUtils.toList(iterable); + + assertThat(result, contains("john", "tom", "jane")); + } + + // ======================== Iterator + + @Test + public void whenConvertIteratorToListUsingJava_thenSuccess() { + List result = new ArrayList(); + while (iterator.hasNext()) { + result.add(iterator.next()); + } + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIteratorToListUsingJava8_thenSuccess() { + List result = new ArrayList(); + iterator.forEachRemaining(result::add); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIteratorToListUsingJava8WithSpliterator_thenSuccess() { + List result = StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false) + .collect(Collectors.toList()); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIteratorToListUsingGuava_thenSuccess() { + List result = Lists.newArrayList(iterator); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIteratorToImmutableListUsingGuava_thenSuccess() { + List result = ImmutableList.copyOf(iterator); + + assertThat(result, contains("john", "tom", "jane")); + } + + @Test + public void whenConvertIteratorToListUsingApacheCommons_thenSuccess() { + List result = IteratorUtils.toList(iterator); + + assertThat(result, contains("john", "tom", "jane")); + } +} From 11a41d5036b2512635ef59c93c8f0c2d980d4df6 Mon Sep 17 00:00:00 2001 From: glopez Date: Thu, 13 Jun 2019 22:53:57 -0300 Subject: [PATCH 29/70] BAEL-2804 JPA Query Parameters Usage This is the code behind JPA Query Parameters Usage tutorial. Within these examples you can find the way to use named and positional query parameters either using plain jpql or criteria queries. --- persistence-modules/java-jpa/pom.xml | 57 ++++++++++++ .../baeldung/jpa/queryparams/Employee.java | 80 +++++++++++++++++ .../main/resources/META-INF/persistence.xml | 22 +++++ .../queryparams/JPAQueryParamsUnitTest.java | 90 +++++++++++++++++++ .../src/test/resources/employees2.sql | 2 + 5 files changed, 251 insertions(+) create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java create mode 100644 persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java create mode 100644 persistence-modules/java-jpa/src/test/resources/employees2.sql diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index f23040fbdc..51cc401332 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -19,6 +19,11 @@ hibernate-core ${hibernate.version} + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + com.h2database h2 @@ -47,6 +52,58 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + -proc:none + + + + org.bsc.maven + maven-processor-plugin + 3.3.3 + + + process + + process + + generate-sources + + target/metamodel + + org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + target/metamodel + + + + + + + 5.4.0.Final 2.7.4-RC1 diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java new file mode 100644 index 0000000000..e8f4a10156 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java @@ -0,0 +1,80 @@ +package com.baeldung.jpa.queryparams; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + + +@Entity +@Table(name = "employees") +public class Employee { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "employee_number", unique = true) + private String empNumber; + + @Column(name = "employee_name") + private String name; + + @Column(name = "employee_age") + private int age; + + public Employee() { + super(); + } + + public Employee(Long id, String empNumber) { + super(); + this.id = id; + this.empNumber = empNumber; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmpNumber() { + return empNumber; + } + + public void setEmpNumber(String empNumber) { + this.empNumber = empNumber; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + +} diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index 1f16bee3ba..6a236f0840 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -224,4 +224,26 @@ value="products_jpa.sql" /> + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.queryparams.Employee + true + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java new file mode 100644 index 0000000000..151a06a278 --- /dev/null +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.jpa.queryparams; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.ParameterExpression; +import javax.persistence.criteria.Root; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * JPAQueryParamsTest class tests. + * + * @author gmlopez.mackinnon@gmail.com + */ +public class JPAQueryParamsUnitTest { + + private static EntityManager entityManager; + + @BeforeClass + public static void setup() { + EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpa-h2-queryparams"); + entityManager = factory.createEntityManager(); + } + + @Test + public void givenEmpNumber_whenUsingPositionalParameter_thenReturnExpectedEmployee() { + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.empNumber = ?0" , Employee.class); + String empNumber = "A123"; + Employee employee = query.setParameter(0, empNumber).getSingleResult(); + Assert.assertNotNull("Employee not found", employee); + } + + @Test + public void givenEmpNumber_whenUsingNamedParameter_thenReturnExpectedEmployee() { + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.empNumber = :number" , Employee.class); + String empNumber = "A123"; + Employee employee = query.setParameter("number", empNumber).getSingleResult(); + Assert.assertNotNull("Employee not found", employee); + } + + @Test + public void givenEmpNumber_whenUsingTwoNamedParameters_thenReturnExpectedEmployees() { + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.name = :name AND e.age = :empAge" , Employee.class); + String empName = "John Doe"; + int empAge = 55; + List employees = query + .setParameter("name", empName) + .setParameter("empAge", empAge) + .getResultList(); + Assert.assertNotNull("Employees not found!", employees); + Assert.assertTrue("Employees not found!", !employees.isEmpty()); + } + + @Test + public void givenEmpNumber_whenUsingCriteriaQuery_thenReturnExpectedEmployee() { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + + CriteriaQuery cQuery = cb.createQuery(Employee.class); + Root c = cQuery.from(Employee.class); + ParameterExpression paramEmpNumber = cb.parameter(String.class); + cQuery.select(c).where(cb.equal(c.get(Employee_.empNumber), paramEmpNumber)); + + TypedQuery query = entityManager.createQuery(cQuery); + String empNumber = "A123"; + query.setParameter(paramEmpNumber, empNumber); + Employee employee = query.getSingleResult(); + Assert.assertNotNull("Employee not found!", employee); + } + + @Test + public void givenEmpNumber_whenUsingLiteral_thenReturnExpectedEmployee() { + String empNumber = "A123"; + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.empNumber = '" + empNumber + "'", Employee.class); + Employee employee = query.getSingleResult(); + Assert.assertNotNull("Employee not found!", employee); + } + +} diff --git a/persistence-modules/java-jpa/src/test/resources/employees2.sql b/persistence-modules/java-jpa/src/test/resources/employees2.sql new file mode 100644 index 0000000000..d3ae46f6a0 --- /dev/null +++ b/persistence-modules/java-jpa/src/test/resources/employees2.sql @@ -0,0 +1,2 @@ +INSERT INTO employees (employee_number, employee_name, employee_age) VALUES ('111', 'John Doe', 55); +INSERT INTO employees (employee_number, employee_name, employee_age) VALUES ('A123', 'John Doe Junior', 25); \ No newline at end of file From c45f9c9a6a1d8a98079a4d7b0c0f01bd7bb0ee83 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 13 Jun 2019 21:59:53 -0600 Subject: [PATCH 30/70] BAEL-2958: update pom.xml --- persistence-modules/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 2f4b8288ea..feb0b5fc7b 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -18,6 +18,7 @@ apache-cayenne core-java-persistence deltaspike + elasticsearch flyway hbase hibernate5 @@ -28,7 +29,6 @@ java-jdbi java-jpa java-mongodb - elasticsearch jnosql liquibase orientdb From 9d5e6519cca1564cf860bf1a841ecf2813701a9f Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Fri, 14 Jun 2019 11:04:37 -0300 Subject: [PATCH 31/70] Deleted duplicated readme file. It was generating issues in case unsensitive os --- core-java-modules/core-java-lambdas/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java-lambdas/README.md diff --git a/core-java-modules/core-java-lambdas/README.md b/core-java-modules/core-java-lambdas/README.md deleted file mode 100644 index 10b876735e..0000000000 --- a/core-java-modules/core-java-lambdas/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Why Do Local Variables Used in Lambdas Have to Be Final or Effectively Final?](https://www.baeldung.com/java-lambda-effectively-final-local-variables) From a11e0088ba0f0101ae9c6da84037b33d0bc9c033 Mon Sep 17 00:00:00 2001 From: Arho Huttunen Date: Sat, 15 Jun 2019 09:58:54 +0300 Subject: [PATCH 32/70] BAEL-2911 - JUnit Custom Display Name Generator API --- testing-modules/junit-5-advanced/pom.xml | 32 +++++++ .../DisplayNameGeneratorUnitTest.java | 87 +++++++++++++++++++ testing-modules/pom.xml | 1 + 3 files changed, 120 insertions(+) create mode 100644 testing-modules/junit-5-advanced/pom.xml create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/displayname/DisplayNameGeneratorUnitTest.java diff --git a/testing-modules/junit-5-advanced/pom.xml b/testing-modules/junit-5-advanced/pom.xml new file mode 100644 index 0000000000..f65f7e2a2f --- /dev/null +++ b/testing-modules/junit-5-advanced/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + junit-5-advanced + 1.0-SNAPSHOT + junit-5-advanced + Advanced JUnit 5 Topics + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + test + + + + + 5.4.2 + 2.21.0 + + + diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/displayname/DisplayNameGeneratorUnitTest.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/displayname/DisplayNameGeneratorUnitTest.java new file mode 100644 index 0000000000..311539f760 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/displayname/DisplayNameGeneratorUnitTest.java @@ -0,0 +1,87 @@ +package com.baeldung.displayname; + +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.lang.reflect.Method; + +@DisplayNameGeneration(DisplayNameGeneratorUnitTest.ReplaceCamelCase.class) +class DisplayNameGeneratorUnitTest { + + @Test + void camelCaseName() { + } + + @Nested + @DisplayNameGeneration(DisplayNameGeneratorUnitTest.IndicativeSentences.class) + class ANumberIsFizz { + @Test + void ifItIsDivisibleByThree() { + } + + @ParameterizedTest(name = "Number {0} is fizz.") + @ValueSource(ints = { 3, 12, 18 }) + void ifItIsOneOfTheFollowingNumbers(int number) { + } + } + + @Nested + @DisplayNameGeneration(DisplayNameGeneratorUnitTest.IndicativeSentences.class) + class ANumberIsBuzz { + @Test + void ifItIsDivisibleByFive() { + } + + @ParameterizedTest(name = "Number {0} is buzz.") + @ValueSource(ints = { 5, 10, 20 }) + void ifItIsOneOfTheFollowingNumbers(int number) { + } + } + + static class IndicativeSentences extends ReplaceCamelCase { + @Override + public String generateDisplayNameForNestedClass(Class nestedClass) { + return super.generateDisplayNameForNestedClass(nestedClass) + "..."; + } + + @Override + public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + return replaceCamelCase(testClass.getSimpleName() + " " + testMethod.getName()) + "."; + } + } + + static class ReplaceCamelCase extends DisplayNameGenerator.Standard { + @Override + public String generateDisplayNameForClass(Class testClass) { + return replaceCamelCase(super.generateDisplayNameForClass(testClass)); + } + + @Override + public String generateDisplayNameForNestedClass(Class nestedClass) { + return replaceCamelCase(super.generateDisplayNameForNestedClass(nestedClass)); + } + + @Override + public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + return this.replaceCamelCase(testMethod.getName()) + DisplayNameGenerator.parameterTypesAsString(testMethod); + } + + String replaceCamelCase(String camelCase) { + StringBuilder result = new StringBuilder(); + result.append(camelCase.charAt(0)); + for (int i=1; itesting testng junit-5-basics + junit-5-advanced From 97c1f79f32ebf9fff60efacc41a92ee4dff976be Mon Sep 17 00:00:00 2001 From: Andrew Shcherbakov Date: Sat, 15 Jun 2019 11:20:32 +0200 Subject: [PATCH 33/70] Implement illustration for the folding technique --- .../com/baeldung/folding/FoldingHash.java | 77 +++++++++++++++++++ .../baeldung/folding/FoldingHashUnitTest.java | 57 ++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java create mode 100644 core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java new file mode 100644 index 0000000000..a04513ed55 --- /dev/null +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java @@ -0,0 +1,77 @@ +package com.baeldung.folding; + +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +/** + * Calculate a hash value for the strings using the folding technique. + * + * The implementation serves only to the illustration purposes and is far + * from being the most efficient. + * + * @author veontomo + * + */ +public class FoldingHash { + + /** + * Calculate the hash value of a given string + * @param str + * @param groupSize + * @param maxValue + * @return + */ + public int hash(String str, int groupSize, int maxValue) { + final int[] codes = this.toAsciiCodes(str); + return IntStream.range(0, str.length()) + .filter(i -> i % groupSize == 0) + .mapToObj(i -> extract(codes, i, groupSize)) + .map(block -> concatenate(block)) + .reduce(0, (a, b) -> (a + b) % maxValue); + } + + /** + * Returns a new array of given length whose elements are take from + * the original one starting from the offset. + * + * If the original array has not enough elements, the returning array will contain + * element from the offset till the end of the original array. + * + * @param numbers + * @param offset + * @param length + * @return + */ + public int[] extract(int[] numbers, int offset, int length) { + final int defect = numbers.length - (offset + length); + final int s = defect < 0 ? length + defect : length; + int[] result = new int[s]; + for (int index = 0; index < s; index++) { + result[index] = numbers[index + offset]; + } + return result; + } + + /** + * Concatenate the numbers into a single number. + * Assume that the procedure does not suffer from the overflow. + * @param numbers + * @return + */ + public int concatenate(int[] numbers) { + final String merged = IntStream.of(numbers) + .mapToObj(number -> "" + number) + .collect(Collectors.joining()); + return Integer.parseInt(merged, 10); + } + + /** + * Convert the string into its characters' ascii codes. + * @param str + * @return + */ + private int[] toAsciiCodes(String str) { + return str.chars() + .toArray(); + } +} diff --git a/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java b/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java new file mode 100644 index 0000000000..b8e9adf435 --- /dev/null +++ b/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java @@ -0,0 +1,57 @@ +package com.baeldung.folding; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class FoldingHashUnitTest { + + @Test + public void givenStringJavaLanguage_whenSize2Capacity100000_then48933() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int value = hasher.hash("Java language", 2, 100_000); + assertEquals(value, 48933); + } + + + @Test + public void givenStringVaJaLanguage_whenSize2Capacity100000_thenSameAsJavaLanguage() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int java = hasher.hash("Java language", 2, 100_000); + final int vaja = hasher.hash("vaJa language", 2, 100_000); + assertTrue(java == vaja); + } + + + @Test + public void givenSingleElementArray_whenOffset0Size2_thenSingleElement() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int[] value = hasher.extract(new int[] {5}, 0, 2); + assertArrayEquals(new int[] {5}, value); + } + + @Test + public void givenFiveElementArray_whenOffset0Size3_thenFirstThreeElements() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 0, 3); + assertArrayEquals(new int[] {1, 2, 3}, value); + } + + @Test + public void givenFiveElementArray_whenOffset1Size2_thenTwoElements() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 1, 2); + assertArrayEquals(new int[] {2, 3}, value); + } + + @Test + public void givenFiveElementArray_whenOffset2SizeTooBig_thenElementsToTheEnd() throws Exception { + final FoldingHash hasher = new FoldingHash(); + final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 2, 2000); + assertArrayEquals(new int[] {3, 4, 5}, value); + } + + +} From bd80953ac42e0035735a7376a9fb98ff049f7dc3 Mon Sep 17 00:00:00 2001 From: TINO Date: Sat, 15 Jun 2019 12:29:59 +0300 Subject: [PATCH 34/70] BAEL - 2956 Fixed permission denied exception --- .../java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java index 067e3c9ef5..7f36a9abdb 100644 --- a/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/chroniclemap/ChronicleMapUnitTest.java @@ -42,7 +42,7 @@ public class ChronicleMapUnitTest { .name("country-map") .entries(50) .averageValue("America") - .createPersistedTo(new File(System.getProperty("java.io.tmpdir") + "country-details.dat")); + .createPersistedTo(new File(System.getProperty("user.home") + "/country-details.dat")); Set averageValue = IntStream.of(1, 2) .boxed() From 41502a75076abe89de6ca331fbc66209812a38d5 Mon Sep 17 00:00:00 2001 From: Andrew Shcherbakov Date: Sat, 15 Jun 2019 11:31:19 +0200 Subject: [PATCH 35/70] Clean the main method of the folding technique code snippet --- .../com/baeldung/folding/FoldingHash.java | 2 +- .../main/java/com/baeldung/folding/Main.java | 24 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java index a04513ed55..3cb0d55ca7 100644 --- a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java @@ -9,7 +9,7 @@ import java.util.stream.IntStream; * The implementation serves only to the illustration purposes and is far * from being the most efficient. * - * @author veontomo + * @author A.Shcherbakov * */ public class FoldingHash { diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java index 47ae11c80c..dec5b4850a 100644 --- a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java @@ -1,21 +1,17 @@ package com.baeldung.folding; -import java.util.stream.IntStream; - +/** + * Code snippet for article "A Guide to the Folding Technique". + * + * @author A.Shcherbakov + * + */ public class Main { public static void main(String... arg) { - final String key = "Java language"; - - toAsciiCodes(key).forEach(c -> System.out.println(c)); - // toAsciiCodes(key).reduce(new ArrayList(), (accum, i) -> i); - // List numbers = Arrays.asList(1, 2, 3, 4, 5, 6); - // numbers.stream() - // .reduce(new ArrayList(), (k, v) -> new ArrayList()); - // System.out.println(result); - } - - public static IntStream toAsciiCodes(String key) { - return key.chars(); + FoldingHash hasher = new FoldingHash(); + final String str = "Java language"; + System.out.println(hasher.hash(str, 2, 100_000)); + System.out.println(hasher.hash(str, 3, 1_000)); } } From 56984861789f4c2d194a41ac3e7aa55f13539ecb Mon Sep 17 00:00:00 2001 From: Andrew Shcherbakov Date: Sat, 15 Jun 2019 19:40:15 +0200 Subject: [PATCH 36/70] Add Javadoc to method arguments and format the code --- .../com/baeldung/folding/FoldingHash.java | 25 ++++++++--------- .../main/java/com/baeldung/folding/Main.java | 2 +- .../baeldung/folding/FoldingHashUnitTest.java | 27 +++++++++---------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java index 3cb0d55ca7..0ea128c1d9 100644 --- a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java @@ -15,11 +15,12 @@ import java.util.stream.IntStream; public class FoldingHash { /** - * Calculate the hash value of a given string - * @param str - * @param groupSize - * @param maxValue - * @return + * Calculate the hash value of a given string. + * + * @param str Assume it is not null + * @param groupSize the group size in the folding technique + * @param maxValue defines a max value that the hash may acquire (exclusive) + * @return integer value from 0 (inclusive) to maxValue (exclusive) */ public int hash(String str, int groupSize, int maxValue) { final int[] codes = this.toAsciiCodes(str); @@ -37,9 +38,9 @@ public class FoldingHash { * If the original array has not enough elements, the returning array will contain * element from the offset till the end of the original array. * - * @param numbers - * @param offset - * @param length + * @param numbers original array. Assume it is not null. + * @param offset index of the element to start from. Assume it is less than the size of the array + * @param length max size of the resulting array * @return */ public int[] extract(int[] numbers, int offset, int length) { @@ -53,9 +54,9 @@ public class FoldingHash { } /** - * Concatenate the numbers into a single number. + * Concatenate the numbers into a single number as if they were strings. * Assume that the procedure does not suffer from the overflow. - * @param numbers + * @param numbers integers to concatenate * @return */ public int concatenate(int[] numbers) { @@ -66,8 +67,8 @@ public class FoldingHash { } /** - * Convert the string into its characters' ascii codes. - * @param str + * Convert the string into its characters' ASCII codes. + * @param str input string * @return */ private int[] toAsciiCodes(String str) { diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java index dec5b4850a..3b055a0dbe 100644 --- a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java @@ -7,11 +7,11 @@ package com.baeldung.folding; * */ public class Main { + public static void main(String... arg) { FoldingHash hasher = new FoldingHash(); final String str = "Java language"; System.out.println(hasher.hash(str, 2, 100_000)); System.out.println(hasher.hash(str, 3, 1_000)); } - } diff --git a/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java b/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java index b8e9adf435..43e33d8378 100644 --- a/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java +++ b/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java @@ -14,44 +14,41 @@ public class FoldingHashUnitTest { final int value = hasher.hash("Java language", 2, 100_000); assertEquals(value, 48933); } - - + @Test public void givenStringVaJaLanguage_whenSize2Capacity100000_thenSameAsJavaLanguage() throws Exception { final FoldingHash hasher = new FoldingHash(); final int java = hasher.hash("Java language", 2, 100_000); final int vaja = hasher.hash("vaJa language", 2, 100_000); assertTrue(java == vaja); - } - + } @Test public void givenSingleElementArray_whenOffset0Size2_thenSingleElement() throws Exception { final FoldingHash hasher = new FoldingHash(); - final int[] value = hasher.extract(new int[] {5}, 0, 2); - assertArrayEquals(new int[] {5}, value); + final int[] value = hasher.extract(new int[] { 5 }, 0, 2); + assertArrayEquals(new int[] { 5 }, value); } - + @Test public void givenFiveElementArray_whenOffset0Size3_thenFirstThreeElements() throws Exception { final FoldingHash hasher = new FoldingHash(); - final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 0, 3); - assertArrayEquals(new int[] {1, 2, 3}, value); + final int[] value = hasher.extract(new int[] { 1, 2, 3, 4, 5 }, 0, 3); + assertArrayEquals(new int[] { 1, 2, 3 }, value); } @Test public void givenFiveElementArray_whenOffset1Size2_thenTwoElements() throws Exception { final FoldingHash hasher = new FoldingHash(); - final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 1, 2); - assertArrayEquals(new int[] {2, 3}, value); + final int[] value = hasher.extract(new int[] { 1, 2, 3, 4, 5 }, 1, 2); + assertArrayEquals(new int[] { 2, 3 }, value); } @Test public void givenFiveElementArray_whenOffset2SizeTooBig_thenElementsToTheEnd() throws Exception { final FoldingHash hasher = new FoldingHash(); - final int[] value = hasher.extract(new int[] {1, 2, 3, 4, 5}, 2, 2000); - assertArrayEquals(new int[] {3, 4, 5}, value); + final int[] value = hasher.extract(new int[] { 1, 2, 3, 4, 5 }, 2, 2000); + assertArrayEquals(new int[] { 3, 4, 5 }, value); } - - + } From 6aec4a6e0f5c92e1becc0a0d26d88b3ad57aeaa1 Mon Sep 17 00:00:00 2001 From: glopez Date: Sun, 16 Jun 2019 00:37:44 -0300 Subject: [PATCH 37/70] BAEL-2804 JPA Query Parameters Usage This is the code behind the JPA Query Parameters Usage tutorial. Within these examples you can find the way to use named and positional query parameters either using plain JPQL or criteria queries. --- .../queryparams/JPAQueryParamsUnitTest.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java index 151a06a278..fcac6415c9 100644 --- a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java @@ -1,5 +1,7 @@ package com.baeldung.jpa.queryparams; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import javax.persistence.EntityManager; @@ -33,12 +35,22 @@ public class JPAQueryParamsUnitTest { @Test public void givenEmpNumber_whenUsingPositionalParameter_thenReturnExpectedEmployee() { TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber = ?0" , Employee.class); + "SELECT e FROM Employee e WHERE e.empNumber = ?1" , Employee.class); String empNumber = "A123"; Employee employee = query.setParameter(0, empNumber).getSingleResult(); Assert.assertNotNull("Employee not found", employee); } + @Test + public void givenEmpNumberList_whenUsingPositionalParameter_thenReturnExpectedEmployee() { + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.empNumber IN (?1)" , Employee.class); + List empNumbers = Arrays.asList("A123", "A124"); + List employees = query.setParameter(1, empNumbers).getResultList(); + Assert.assertNotNull("Employees not found", employees); + Assert.assertFalse("Employees not found", employees.isEmpty()); + } + @Test public void givenEmpNumber_whenUsingNamedParameter_thenReturnExpectedEmployee() { TypedQuery query = entityManager.createQuery( @@ -49,7 +61,17 @@ public class JPAQueryParamsUnitTest { } @Test - public void givenEmpNumber_whenUsingTwoNamedParameters_thenReturnExpectedEmployees() { + public void givenEmpNumberList_whenUsingNamedParameter_thenReturnExpectedEmployee() { + TypedQuery query = entityManager.createQuery( + "SELECT e FROM Employee e WHERE e.empNumber IN (:numbers)" , Employee.class); + List empNumbers = Arrays.asList("A123", "A124"); + List employees = query.setParameter("numbers", empNumbers).getResultList(); + Assert.assertNotNull("Employees not found", employees); + Assert.assertFalse("Employees not found", employees.isEmpty()); + } + + @Test + public void givenEmpNameAndEmpAge_whenUsingTwoNamedParameters_thenReturnExpectedEmployees() { TypedQuery query = entityManager.createQuery( "SELECT e FROM Employee e WHERE e.name = :name AND e.age = :empAge" , Employee.class); String empName = "John Doe"; From 1d52e33e2db33e9a1450f3dbd246cfa315810cab Mon Sep 17 00:00:00 2001 From: Erhan KARAKAYA Date: Sun, 16 Jun 2019 09:31:29 +0300 Subject: [PATCH 38/70] Added tests & renamed classes --- ...va => BingTranslationServiceProvider.java} | 4 +-- ... => GoogleTranslationServiceProvider.java} | 4 +-- ...teService.java => TranslationService.java} | 2 +- .../TranslationServiceUnitTest.java | 34 +++++++++++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) rename autovalue/src/main/java/com/baeldung/autoservice/{BingTranslateServiceProvider.java => BingTranslationServiceProvider.java} (65%) rename autovalue/src/main/java/com/baeldung/autoservice/{GoogleTranslateServiceProvider.java => GoogleTranslationServiceProvider.java} (65%) rename autovalue/src/main/java/com/baeldung/autoservice/{TranslateService.java => TranslationService.java} (76%) create mode 100644 autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java similarity index 65% rename from autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java rename to autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java index 00f21a943e..74666b2f7d 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslateServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java @@ -4,8 +4,8 @@ import com.google.auto.service.AutoService; import java.util.Locale; -@AutoService(TranslateService.class) -public class BingTranslateServiceProvider implements TranslateService { +@AutoService(TranslationService.class) +public class BingTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { return "translated by Bing"; diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java similarity index 65% rename from autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java rename to autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java index 786d9bd443..68889472bf 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslateServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java @@ -4,8 +4,8 @@ import com.google.auto.service.AutoService; import java.util.Locale; -@AutoService(TranslateService.class) -public class GoogleTranslateServiceProvider implements TranslateService { +@AutoService(TranslationService.class) +public class GoogleTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { return "translated by Google"; diff --git a/autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java b/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java similarity index 76% rename from autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java rename to autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java index 6d68f6aca3..cfcff4015c 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/TranslateService.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java @@ -2,7 +2,7 @@ package com.baeldung.autoservice; import java.util.Locale; -public interface TranslateService { +public interface TranslationService { String translate(String message, Locale from, Locale to); } diff --git a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java new file mode 100644 index 0000000000..f167dad6bd --- /dev/null +++ b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.autoservice; + +import com.baeldung.autoservice.TranslationService; +import org.junit.Test; + +import java.util.ServiceLoader; +import java.util.stream.StreamSupport; + +import static org.junit.Assert.assertEquals; + +public class TranslationServiceUnitTest { + + @Test + public void whenServiceLoaderLoads_thenLoadsAllProviders() { + + ServiceLoader loader = ServiceLoader.load(TranslationService.class); + long count = StreamSupport.stream(loader.spliterator(), false).count(); + assertEquals(2, count); + } + + @Test + public void whenServiceLoaderLoadsGoogleService_thenGoogleIsLoaded() { + + ServiceLoader loader = ServiceLoader.load(TranslationService.class); + + TranslationService googleService = StreamSupport.stream(loader.spliterator(), false) + .filter(p -> p.getClass().getSimpleName().equals("GoogleTranslationServiceProvider")) + .findFirst() + .get(); + + assertEquals("translated by Google", googleService.translate("message", null, null)); + + } +} \ No newline at end of file From f69f95d13d2a4a6b095e351ca1ea872d54b0a809 Mon Sep 17 00:00:00 2001 From: Joel Juarez Date: Sun, 16 Jun 2019 23:23:36 +0200 Subject: [PATCH 39/70] fixed styles in pom.xml --- parent-boot-performance/README.md | 4 +-- parent-boot-performance/pom.xml | 54 +++++++++++++++---------------- spring-boot-performance/pom.xml | 12 +++---- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/parent-boot-performance/README.md b/parent-boot-performance/README.md index 24abd27048..fce9e101da 100644 --- a/parent-boot-performance/README.md +++ b/parent-boot-performance/README.md @@ -1,3 +1 @@ -This is a parent module for projects that want to take advantage of the latest Spring Boot improvements/features. - -Current version: Spring Boot 2.2 +This is a parent module for projects that want to take advantage of the latest Spring Boot improvements/features. \ No newline at end of file diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index 62a1689b7f..b1c6854eae 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -3,7 +3,7 @@ 4.0.0 parent-boot-performance 0.0.1-SNAPSHOT - parent-boot-performance + parent-boot-performance pom Parent for all modules that want to take advantage of the latest Spring Boot improvements/features. Current version: 2.2 @@ -13,7 +13,14 @@ 1.0.0-SNAPSHOT - + + 3.1.0 + + 1.0.21.RELEASE + 2.2.0.M3 + + + org.springframework.boot @@ -36,30 +43,30 @@ - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - ${start-class} - - - - - - - - + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + + + + + + + + spring-milestones Spring Milestones https://repo.spring.io/milestone - + thin-jar @@ -81,11 +88,4 @@ - - - 3.1.0 - - 1.0.21.RELEASE - 2.2.0.M3 - diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index 207cd06f9b..bbee7493cc 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -14,7 +14,12 @@ ../parent-boot-performance - + + + com.baeldung.lazyinitialization.Application + + + org.springframework.boot spring-boot-starter @@ -37,9 +42,4 @@ - - - - com.baeldung.lazyinitialization.Application - \ No newline at end of file From 44dfb1a07679d768d8a067d2b58c4545d437a64a Mon Sep 17 00:00:00 2001 From: Antonio Moreno Date: Mon, 17 Jun 2019 00:00:29 +0100 Subject: [PATCH 40/70] BAEL-2934 IntStreams conversions (cherry picked from commit 11abb325ecb2f299c318d82952e7718bab03510c) --- .../IntStreamsConversionsUnitTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java diff --git a/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java b/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java new file mode 100644 index 0000000000..88579cd97c --- /dev/null +++ b/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.intstreams.conversion; + +import org.junit.Test; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import static org.assertj.core.api.Assertions.assertThat; + +public class IntStreamsConversionsUnitTest { + + @Test + public void intStreamToArray() { + int[] first50EvenNumbers = IntStream.iterate(0, i -> i + 2) + .limit(50) + .toArray(); + + assertThat(first50EvenNumbers).hasSize(50); + assertThat(first50EvenNumbers[2]).isEqualTo(4); + } + + @Test + public void intStreamToList() { + List first50IntegerNumbers = IntStream.range(0, 50) + .boxed() + .collect(Collectors.toList()); + + assertThat(first50IntegerNumbers).hasSize(50); + assertThat(first50IntegerNumbers.get(2)).isEqualTo(2); + } + + @Test + public void intStreamToString() { + String first3numbers = IntStream.range(0, 3) + .mapToObj(String::valueOf) + .collect(Collectors.joining(", ", "[", "]")); + + assertThat(first3numbers).isEqualTo("[0, 1, 2]"); + } +} From 07adfc9e7037774c0fb0c7a26768b8b17df1d2df Mon Sep 17 00:00:00 2001 From: glopez Date: Mon, 17 Jun 2019 07:42:48 -0300 Subject: [PATCH 41/70] BAEL-2804 JPA Query Parameters Usage Fix givenEmpNumber_whenUsingPositionalParameter_thenReturnExpectedEmployee test case after adjustemnts. --- .../com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java index fcac6415c9..97f82f7914 100644 --- a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java @@ -37,7 +37,7 @@ public class JPAQueryParamsUnitTest { TypedQuery query = entityManager.createQuery( "SELECT e FROM Employee e WHERE e.empNumber = ?1" , Employee.class); String empNumber = "A123"; - Employee employee = query.setParameter(0, empNumber).getSingleResult(); + Employee employee = query.setParameter(1, empNumber).getSingleResult(); Assert.assertNotNull("Employee not found", employee); } From 2826baee3b6395a1c84729c470da5f18de37ba7b Mon Sep 17 00:00:00 2001 From: Erhan Karakaya Date: Mon, 17 Jun 2019 14:52:29 +0300 Subject: [PATCH 42/70] Changed sample impls & refactored test --- .../BingTranslationServiceProvider.java | 4 ++- .../GoogleTranslationServiceProvider.java | 4 ++- .../TranslationServiceUnitTest.java | 29 +++++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java index 74666b2f7d..0aed76b834 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java @@ -8,6 +8,8 @@ import java.util.Locale; public class BingTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { - return "translated by Bing"; + + // implementation details + return message + " (translated by Bing)"; } } diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java index 68889472bf..eb5d191a26 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java @@ -8,6 +8,8 @@ import java.util.Locale; public class GoogleTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { - return "translated by Google"; + + // implementation details + return message + " (translated by Google)"; } } diff --git a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java index f167dad6bd..2f39a306c2 100644 --- a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java +++ b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java @@ -9,26 +9,31 @@ import java.util.stream.StreamSupport; import static org.junit.Assert.assertEquals; public class TranslationServiceUnitTest { + + private ServiceLoader loader; + + @Before + public void setUp() { + + loader = ServiceLoader.load(TranslationService.class); + } @Test public void whenServiceLoaderLoads_thenLoadsAllProviders() { - ServiceLoader loader = ServiceLoader.load(TranslationService.class); - long count = StreamSupport.stream(loader.spliterator(), false).count(); - assertEquals(2, count); + long count = StreamSupport.stream(loader.spliterator(), false).count(); + assertEquals(2, count); } @Test public void whenServiceLoaderLoadsGoogleService_thenGoogleIsLoaded() { - ServiceLoader loader = ServiceLoader.load(TranslationService.class); - - TranslationService googleService = StreamSupport.stream(loader.spliterator(), false) - .filter(p -> p.getClass().getSimpleName().equals("GoogleTranslationServiceProvider")) - .findFirst() - .get(); - - assertEquals("translated by Google", googleService.translate("message", null, null)); - + TranslationService googleService = StreamSupport.stream(loader.spliterator(), false) + .filter(p -> p.getClass().getSimpleName().equals("GoogleTranslationServiceProvider")) + .findFirst() + .get(); + + String message = "message"; + assertEquals(message + " (translated by Google)", googleService.translate(message, null, null)); } } \ No newline at end of file From ac850bbc0b39ee45b3b93010e02c3d7ba0b9aa0b Mon Sep 17 00:00:00 2001 From: Erhan Karakaya Date: Mon, 17 Jun 2019 14:57:45 +0300 Subject: [PATCH 43/70] Fixed typos --- .../baeldung/autoservice/BingTranslationServiceProvider.java | 2 +- .../baeldung/autoservice/GoogleTranslationServiceProvider.java | 2 +- .../com/baeldung/autoservice/TranslationServiceUnitTest.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java index 0aed76b834..8ef4d6a45e 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java @@ -9,7 +9,7 @@ public class BingTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { - // implementation details + // implementation details return message + " (translated by Bing)"; } } diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java index eb5d191a26..3d6d1edc9f 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java @@ -9,7 +9,7 @@ public class GoogleTranslationServiceProvider implements TranslationService { public String translate(String message, Locale from, Locale to) { - // implementation details + // implementation details return message + " (translated by Google)"; } } diff --git a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java index 2f39a306c2..2d7c8d7b6d 100644 --- a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java +++ b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java @@ -1,6 +1,7 @@ package com.baeldung.autoservice; import com.baeldung.autoservice.TranslationService; +import org.junit.Before; import org.junit.Test; import java.util.ServiceLoader; From 7c21f2e2794cb133c3620515e05a93fa147a22a7 Mon Sep 17 00:00:00 2001 From: antmordel Date: Tue, 18 Jun 2019 08:25:42 +0200 Subject: [PATCH 44/70] Added IntStream.of constructor --- .../intstreams/conversion/IntStreamsConversionsUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java b/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java index 88579cd97c..6cd773e634 100644 --- a/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/intstreams/conversion/IntStreamsConversionsUnitTest.java @@ -31,7 +31,7 @@ public class IntStreamsConversionsUnitTest { @Test public void intStreamToString() { - String first3numbers = IntStream.range(0, 3) + String first3numbers = IntStream.of(0, 1, 2) .mapToObj(String::valueOf) .collect(Collectors.joining(", ", "[", "]")); From 9edcaa30d5b7619cf1dd649c5601208f3363fb03 Mon Sep 17 00:00:00 2001 From: Andrew Shcherbakov Date: Tue, 18 Jun 2019 21:22:13 +0200 Subject: [PATCH 45/70] Move the code into algorithms-miscellaneous-3 --- .../src/main/java/com/baeldung/folding/FoldingHash.java | 0 .../src/main/java/com/baeldung/folding/Main.java | 0 .../src/test/java/com/baeldung/folding/FoldingHashUnitTest.java | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {core-java-modules/core-java-security => algorithms-miscellaneous-3}/src/main/java/com/baeldung/folding/FoldingHash.java (100%) rename {core-java-modules/core-java-security => algorithms-miscellaneous-3}/src/main/java/com/baeldung/folding/Main.java (100%) rename {core-java-modules/core-java-security => algorithms-miscellaneous-3}/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java (100%) diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java b/algorithms-miscellaneous-3/src/main/java/com/baeldung/folding/FoldingHash.java similarity index 100% rename from core-java-modules/core-java-security/src/main/java/com/baeldung/folding/FoldingHash.java rename to algorithms-miscellaneous-3/src/main/java/com/baeldung/folding/FoldingHash.java diff --git a/core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java b/algorithms-miscellaneous-3/src/main/java/com/baeldung/folding/Main.java similarity index 100% rename from core-java-modules/core-java-security/src/main/java/com/baeldung/folding/Main.java rename to algorithms-miscellaneous-3/src/main/java/com/baeldung/folding/Main.java diff --git a/core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java b/algorithms-miscellaneous-3/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java similarity index 100% rename from core-java-modules/core-java-security/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java rename to algorithms-miscellaneous-3/src/test/java/com/baeldung/folding/FoldingHashUnitTest.java From 548890541cf2e44ef5ecd1a382e0591689c86d25 Mon Sep 17 00:00:00 2001 From: cscib Date: Tue, 18 Jun 2019 22:35:04 +0200 Subject: [PATCH 46/70] Bael 2434 (#6635) * BAEL-2434 * BAEL-2434 * Minor alterations to reflect changes in the article * Fixing Spel expression and removing extra code that is not referenced anymore in the article * Moved the files from spring-core to spring-static-resources. Renamed ResourceUtil to ResourceReader. * Changes due to change of article outline. * Changes due to change of article outline. * Removing Converter from article --- spring-static-resources/pom.xml | 10 ++++ .../LoadResourceConfig.java | 15 +++++ .../loadresourceasstring/ResourceReader.java | 30 ++++++++++ .../src/main/resources/resource.txt | 1 + .../LoadResourceAsStringIntegrationTest.java | 57 +++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/LoadResourceConfig.java create mode 100644 spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/ResourceReader.java create mode 100644 spring-static-resources/src/main/resources/resource.txt create mode 100644 spring-static-resources/src/test/java/com/baeldung/loadresourceasstring/LoadResourceAsStringIntegrationTest.java diff --git a/spring-static-resources/pom.xml b/spring-static-resources/pom.xml index f01e807919..84519a37c1 100644 --- a/spring-static-resources/pom.xml +++ b/spring-static-resources/pom.xml @@ -140,6 +140,13 @@ handlebars ${handlebars.version} + + + + commons-io + commons-io + ${commons.io.version} + org.springframework @@ -208,6 +215,9 @@ 1.5.1 + + + 2.5 \ No newline at end of file diff --git a/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/LoadResourceConfig.java b/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/LoadResourceConfig.java new file mode 100644 index 0000000000..32b9ba84d0 --- /dev/null +++ b/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/LoadResourceConfig.java @@ -0,0 +1,15 @@ +package com.baeldung.loadresourceasstring; + + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class LoadResourceConfig { + + @Bean + public String resourceString() { + return ResourceReader.readFileToString("resource.txt"); + } + +} diff --git a/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/ResourceReader.java b/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/ResourceReader.java new file mode 100644 index 0000000000..7bc1babe91 --- /dev/null +++ b/spring-static-resources/src/main/java/com/baeldung/loadresourceasstring/ResourceReader.java @@ -0,0 +1,30 @@ +package com.baeldung.loadresourceasstring; + +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.util.FileCopyUtils; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UncheckedIOException; + +import static java.nio.charset.StandardCharsets.UTF_8; + + +public class ResourceReader { + + public static String readFileToString(String path) { + ResourceLoader resourceLoader = new DefaultResourceLoader(); + Resource resource = resourceLoader.getResource(path); + return asString(resource); + } + + public static String asString(Resource resource) { + try (Reader reader = new InputStreamReader(resource.getInputStream(), UTF_8)) { + return FileCopyUtils.copyToString(reader); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/spring-static-resources/src/main/resources/resource.txt b/spring-static-resources/src/main/resources/resource.txt new file mode 100644 index 0000000000..e78cfa90c2 --- /dev/null +++ b/spring-static-resources/src/main/resources/resource.txt @@ -0,0 +1 @@ +This is a resource text file. This file will be loaded as a resource and use its contents as a string. \ No newline at end of file diff --git a/spring-static-resources/src/test/java/com/baeldung/loadresourceasstring/LoadResourceAsStringIntegrationTest.java b/spring-static-resources/src/test/java/com/baeldung/loadresourceasstring/LoadResourceAsStringIntegrationTest.java new file mode 100644 index 0000000000..c16c1a9720 --- /dev/null +++ b/spring-static-resources/src/test/java/com/baeldung/loadresourceasstring/LoadResourceAsStringIntegrationTest.java @@ -0,0 +1,57 @@ +package com.baeldung.loadresourceasstring; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.util.FileCopyUtils; + +import java.io.InputStreamReader; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.Assert.assertEquals; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = LoadResourceConfig.class) +public class LoadResourceAsStringIntegrationTest { + + private static final String EXPECTED_RESOURCE_VALUE = "This is a resource text file. This file will be loaded as a " + "resource and use its contents as a string."; + + @Value("#{T(com.baeldung.loadresourceasstring.ResourceReader).readFileToString('classpath:resource.txt')}") + private String resourceStringUsingSpel; + + @Autowired + @Qualifier("resourceString") + private String resourceString; + + @Autowired + private ResourceLoader resourceLoader; + + @Test + public void givenUsingResourceLoadAndFileCopyUtils_whenConvertingAResourceToAString_thenCorrect() { + Resource resource = resourceLoader.getResource("classpath:resource.txt"); + assertEquals(EXPECTED_RESOURCE_VALUE, ResourceReader.asString(resource)); + } + + @Test + public void givenUsingResourceStringBean_whenConvertingAResourceToAString_thenCorrect() { + assertEquals(EXPECTED_RESOURCE_VALUE, resourceString); + } + + @Test + public void givenUsingSpel_whenConvertingAResourceToAString_thenCorrect() { + assertEquals(EXPECTED_RESOURCE_VALUE, resourceStringUsingSpel); + } + + + + +} From c253f224bcb48fefcf726c00d895106304367856 Mon Sep 17 00:00:00 2001 From: Balaji Sivakumar <20585178+balaji13us@users.noreply.github.com> Date: Wed, 19 Jun 2019 10:13:19 +0530 Subject: [PATCH 47/70] BAEL-3022 - Converting Iterator to List (#7109) * BAEL-3022 - Converting Iterator to List * BAEL-3022 - Converting Iterator to List. Removed Service Class and moved logic to Junit class * BAEL-3022 - Converting Iterator to List Code Formatting. --- .../ConvertIteratorToListServiceUnitTest.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 java-collections-conversions/src/test/java/com/baeldung/convertiteratortolist/ConvertIteratorToListServiceUnitTest.java diff --git a/java-collections-conversions/src/test/java/com/baeldung/convertiteratortolist/ConvertIteratorToListServiceUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertiteratortolist/ConvertIteratorToListServiceUnitTest.java new file mode 100644 index 0000000000..4d6cba7d27 --- /dev/null +++ b/java-collections-conversions/src/test/java/com/baeldung/convertiteratortolist/ConvertIteratorToListServiceUnitTest.java @@ -0,0 +1,100 @@ +package com.baeldung.convertiteratortolist; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import org.apache.commons.collections4.IteratorUtils; +import org.junit.Before; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +public class ConvertIteratorToListServiceUnitTest { + + Iterator iterator; + + @Before + public void setUp() throws Exception { + iterator = Arrays.asList(1, 2, 3) + .iterator(); + } + + @Test + public void givenAnIterator_whenConvertIteratorToListUsingWhileLoop_thenReturnAList() { + + List actualList = new ArrayList(); + + // Convert Iterator to List using while loop dsf + while (iterator.hasNext()) { + actualList.add(iterator.next()); + } + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } + + @Test + public void givenAnIterator_whenConvertIteratorToListAfterJava8_thenReturnAList() { + List actualList = new ArrayList(); + + // Convert Iterator to List using Java 8 + iterator.forEachRemaining(actualList::add); + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } + + @Test + public void givenAnIterator_whenConvertIteratorToListJava8Stream_thenReturnAList() { + + // Convert iterator to iterable + Iterable iterable = () -> iterator; + + // Extract List from stream + List actualList = StreamSupport + .stream(iterable.spliterator(), false) + .collect(Collectors.toList()); + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } + + @Test + public void givenAnIterator_whenConvertIteratorToImmutableListWithGuava_thenReturnAList() { + + // Convert Iterator to an Immutable list using Guava library in Java + List actualList = ImmutableList.copyOf(iterator); + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } + + @Test + public void givenAnIterator_whenConvertIteratorToMutableListWithGuava_thenReturnAList() { + + // Convert Iterator to a mutable list using Guava library in Java + List actualList = Lists.newArrayList(iterator); + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } + + @Test + public void givenAnIterator_whenConvertIteratorToMutableListWithApacheCommons_thenReturnAList() { + + // Convert Iterator to a mutable list using Apache Commons library in Java + List actualList = IteratorUtils.toList(iterator); + + assertThat(actualList, hasSize(3)); + assertThat(actualList, containsInAnyOrder(1, 2, 3)); + } +} From 0b13fdf96cff9d01d644fdcc547e388caefea05b Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Wed, 19 Jun 2019 10:54:19 +0300 Subject: [PATCH 48/70] BAEL-773 - Ratpack with Groovy (#6985) * BAEL-773 - Ratpack with Groovy * BAEL-773 - Ratpack with Groovy - PR review changes * BAEL-773 - Ratpack with Groovy - PR review changes * Typo corrected * SQLs capitalised --- ratpack/build.gradle | 2 + ratpack/pom.xml | 13 +++- .../main/groovy/com/baeldung/Ratpack.groovy | 76 +++++++++++++++++++ .../com/baeldung/RatpackGroovyApp.groovy | 12 +++ .../groovy/com/baeldung/model/User.groovy | 9 +++ ratpack/src/main/resources/User.sql | 10 +++ .../com/baeldung/RatpackGroovySpec.groovy | 46 +++++++++++ 7 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 ratpack/src/main/groovy/com/baeldung/Ratpack.groovy create mode 100644 ratpack/src/main/groovy/com/baeldung/RatpackGroovyApp.groovy create mode 100644 ratpack/src/main/groovy/com/baeldung/model/User.groovy create mode 100644 ratpack/src/main/resources/User.sql create mode 100644 ratpack/src/test/groovy/com/baeldung/RatpackGroovySpec.groovy diff --git a/ratpack/build.gradle b/ratpack/build.gradle index 25af3ddb51..c997b4e697 100644 --- a/ratpack/build.gradle +++ b/ratpack/build.gradle @@ -14,6 +14,8 @@ if (!JavaVersion.current().java8Compatible) { apply plugin: "io.ratpack.ratpack-java" apply plugin: 'java' +apply plugin: 'groovy' +apply plugin: 'io.ratpack.ratpack-groovy' repositories { jcenter() diff --git a/ratpack/pom.xml b/ratpack/pom.xml index 7c145eff91..0df313c05e 100644 --- a/ratpack/pom.xml +++ b/ratpack/pom.xml @@ -26,11 +26,21 @@ ratpack-core ${ratpack.version} + + org.codehaus.groovy + groovy-sql + ${groovy.sql.version} + io.ratpack ratpack-hikari ${ratpack.version} + + io.ratpack + ratpack-groovy-test + ${ratpack.test.latest.version} + io.ratpack ratpack-hystrix @@ -91,6 +101,7 @@ 4.5.3 4.4.6 1.5.12 + 2.4.15 + 1.6.1 - diff --git a/ratpack/src/main/groovy/com/baeldung/Ratpack.groovy b/ratpack/src/main/groovy/com/baeldung/Ratpack.groovy new file mode 100644 index 0000000000..4d8814b627 --- /dev/null +++ b/ratpack/src/main/groovy/com/baeldung/Ratpack.groovy @@ -0,0 +1,76 @@ +package com.baeldung; + +@Grab('io.ratpack:ratpack-groovy:1.6.1') +import static ratpack.groovy.Groovy.ratpack + +import com.baeldung.model.User +import com.google.common.reflect.TypeToken +import ratpack.exec.Promise +import ratpack.handling.Context +import ratpack.jackson.Jackson +import groovy.sql.Sql +import java.sql.Connection +import java.sql.PreparedStatement +import java.sql.ResultSet +import ratpack.hikari.HikariModule +import javax.sql.DataSource; + +ratpack { + serverConfig { port(5050) } + bindings { + module(HikariModule) { config -> + config.dataSourceClassName = 'org.h2.jdbcx.JdbcDataSource' + config.addDataSourceProperty('URL', "jdbc:h2:mem:devDB;INIT=RUNSCRIPT FROM 'classpath:/User.sql'") + } + } + + handlers { + + get { render 'Hello World from Ratpack with Groovy!!' } + + get("greet/:name") { Context ctx -> + render "Hello " + ctx.getPathTokens().get("name") + "!!!" + } + + get("data") { + render Jackson.json([title: "Mr", name: "Norman", country: "USA"]) + } + + post("user") { + Promise user = parse(Jackson.fromJson(User)) + user.then { u -> render u.name } + } + + get('fetchUserName/:id') { Context ctx -> + Connection connection = ctx.get(DataSource.class).getConnection() + PreparedStatement queryStatement = connection.prepareStatement("SELECT NAME FROM USER WHERE ID=?") + queryStatement.setInt(1, Integer.parseInt(ctx.getPathTokens().get("id"))) + ResultSet resultSet = queryStatement.executeQuery() + resultSet.next() + render resultSet.getString(1) + } + + get('fetchUsers') { + def db = [url:'jdbc:h2:mem:devDB'] + def sql = Sql.newInstance(db.url, db.user, db.password) + def users = sql.rows("SELECT * FROM USER"); + render(Jackson.json(users)) + } + + post('addUser') { + parse(Jackson.fromJson(User)) + .then { u -> + def db = [url:'jdbc:h2:mem:devDB'] + Sql sql = Sql.newInstance(db.url, db.user, db.password) + sql.executeInsert("INSERT INTO USER VALUES (?,?,?,?)", [ + u.id, + u.title, + u.name, + u.country + ]) + render "User $u.name inserted" + } + } + } +} + diff --git a/ratpack/src/main/groovy/com/baeldung/RatpackGroovyApp.groovy b/ratpack/src/main/groovy/com/baeldung/RatpackGroovyApp.groovy new file mode 100644 index 0000000000..95ada25e60 --- /dev/null +++ b/ratpack/src/main/groovy/com/baeldung/RatpackGroovyApp.groovy @@ -0,0 +1,12 @@ +package com.baeldung; + +public class RatpackGroovyApp { + + public static void main(String[] args) { + File file = new File("src/main/groovy/com/baeldung/Ratpack.groovy"); + def shell = new GroovyShell() + shell.evaluate(file) + } + +} + diff --git a/ratpack/src/main/groovy/com/baeldung/model/User.groovy b/ratpack/src/main/groovy/com/baeldung/model/User.groovy new file mode 100644 index 0000000000..0fe4c6c367 --- /dev/null +++ b/ratpack/src/main/groovy/com/baeldung/model/User.groovy @@ -0,0 +1,9 @@ +package com.baeldung.model + +class User { + + long id + String title + String name + String country +} diff --git a/ratpack/src/main/resources/User.sql b/ratpack/src/main/resources/User.sql new file mode 100644 index 0000000000..a3e2242283 --- /dev/null +++ b/ratpack/src/main/resources/User.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS USER; +CREATE TABLE USER ( + ID BIGINT AUTO_INCREMENT PRIMARY KEY, + TITLE VARCHAR(255), + NAME VARCHAR(255), + COUNTRY VARCHAR(255) +); + +INSERT INTO USER VALUES(1,'Mr','Norman Potter', 'USA'); +INSERT INTO USER VALUES(2,'Miss','Ketty Smith', 'FRANCE'); \ No newline at end of file diff --git a/ratpack/src/test/groovy/com/baeldung/RatpackGroovySpec.groovy b/ratpack/src/test/groovy/com/baeldung/RatpackGroovySpec.groovy new file mode 100644 index 0000000000..726d703a06 --- /dev/null +++ b/ratpack/src/test/groovy/com/baeldung/RatpackGroovySpec.groovy @@ -0,0 +1,46 @@ +package com.baeldung; + +import ratpack.groovy.Groovy +import ratpack.groovy.test.GroovyRatpackMainApplicationUnderTest; +import ratpack.test.http.TestHttpClient; +import ratpack.test.ServerBackedApplicationUnderTest; +import org.junit.Test; +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import ratpack.test.MainClassApplicationUnderTest + +class RatpackGroovySpec { + + ServerBackedApplicationUnderTest ratpackGroovyApp = new MainClassApplicationUnderTest(RatpackGroovyApp.class) + @Delegate TestHttpClient client = TestHttpClient.testHttpClient(ratpackGroovyApp) + + @Test + void "test if app is started"() { + when: + get("") + + then: + assert response.statusCode == 200 + assert response.body.text == "Hello World from Ratpack with Groovy!!" + } + + @Test + void "test greet with name"() { + when: + get("greet/Lewis") + + then: + assert response.statusCode == 200 + assert response.body.text == "Hello Lewis!!!" + } + + @Test + void "test fetchUsers"() { + when: + get("fetchUsers") + + then: + assert response.statusCode == 200 + assert response.body.text == '[{"ID":1,"TITLE":"Mr","NAME":"Norman Potter","COUNTRY":"USA"},{"ID":2,"TITLE":"Miss","NAME":"Ketty Smith","COUNTRY":"FRANCE"}]' + } +} From 17191d02b22b8c668ee983a2c50836b7766a533c Mon Sep 17 00:00:00 2001 From: Marcos Lopez Gonzalez Date: Wed, 19 Jun 2019 13:40:25 +0200 Subject: [PATCH 49/70] BAEL-2977 - skip vs limit in streams --- .../baeldung/stream/SkipLimitComparison.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 core-java-modules/core-java-8-2/src/main/java/com/baeldung/stream/SkipLimitComparison.java diff --git a/core-java-modules/core-java-8-2/src/main/java/com/baeldung/stream/SkipLimitComparison.java b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/stream/SkipLimitComparison.java new file mode 100644 index 0000000000..65f12ada45 --- /dev/null +++ b/core-java-modules/core-java-8-2/src/main/java/com/baeldung/stream/SkipLimitComparison.java @@ -0,0 +1,46 @@ +package com.baeldung.stream; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class SkipLimitComparison { + + public static void main(String[] args) { + skipExample(); + limitExample(); + limitInfiniteStreamExample(); + getEvenNumbers(10, 10).stream() + .forEach(System.out::println); + } + + public static void skipExample() { + Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + .filter(i -> i % 2 == 0) + .skip(2) + .forEach(i -> System.out.print(i + " ")); + } + + public static void limitExample() { + Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + .filter(i -> i % 2 == 0) + .limit(2) + .forEach(i -> System.out.print(i + " ")); + } + + public static void limitInfiniteStreamExample() { + Stream.iterate(0, i -> i + 1) + .filter(i -> i % 2 == 0) + .limit(10) + .forEach(System.out::println); + } + + private static List getEvenNumbers(int offset, int limit) { + return Stream.iterate(0, i -> i + 1) + .filter(i -> i % 2 == 0) + .skip(offset) + .limit(limit) + .collect(Collectors.toList()); + } + +} From 0ef4938069fcdde02f42ae0bd95217f64d4511c3 Mon Sep 17 00:00:00 2001 From: glopez Date: Wed, 19 Jun 2019 20:15:56 -0300 Subject: [PATCH 50/70] BAEL-2804 JPA Query Parameters Usage - formatting style Fix formatting style. --- .../baeldung/jpa/queryparams/Employee.java | 105 +++++++++-------- .../queryparams/JPAQueryParamsUnitTest.java | 107 +++++++++--------- 2 files changed, 104 insertions(+), 108 deletions(-) diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java index e8f4a10156..bf3d459530 100644 --- a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/queryparams/Employee.java @@ -7,74 +7,73 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; - @Entity @Table(name = "employees") public class Employee { - /** - * - */ - private static final long serialVersionUID = 1L; + /** + * + */ + private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private Long id; - - @Column(name = "employee_number", unique = true) - private String empNumber; - - @Column(name = "employee_name") - private String name; - - @Column(name = "employee_age") - private int age; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; - public Employee() { - super(); - } + @Column(name = "employee_number", unique = true) + private String empNumber; - public Employee(Long id, String empNumber) { - super(); - this.id = id; - this.empNumber = empNumber; - } + @Column(name = "employee_name") + private String name; - public Long getId() { - return id; - } + @Column(name = "employee_age") + private int age; - public void setId(Long id) { - this.id = id; - } + public Employee() { + super(); + } - public String getName() { - return name; - } + public Employee(Long id, String empNumber) { + super(); + this.id = id; + this.empNumber = empNumber; + } - public int getAge() { - return age; - } + public Long getId() { + return id; + } - public void setAge(int age) { - this.age = age; - } + public void setId(Long id) { + this.id = id; + } - public void setName(String name) { - this.name = name; - } + public String getName() { + return name; + } - public String getEmpNumber() { - return empNumber; - } + public int getAge() { + return age; + } - public void setEmpNumber(String empNumber) { - this.empNumber = empNumber; - } + public void setAge(int age) { + this.age = age; + } - public static long getSerialversionuid() { - return serialVersionUID; - } + public void setName(String name) { + this.name = name; + } + + public String getEmpNumber() { + return empNumber; + } + + public void setEmpNumber(String empNumber) { + this.empNumber = empNumber; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } } diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java index 97f82f7914..4f320935cf 100644 --- a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/queryparams/JPAQueryParamsUnitTest.java @@ -1,7 +1,6 @@ package com.baeldung.jpa.queryparams; import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.persistence.EntityManager; @@ -24,89 +23,87 @@ import org.junit.Test; */ public class JPAQueryParamsUnitTest { - private static EntityManager entityManager; - - @BeforeClass - public static void setup() { + private static EntityManager entityManager; + + @BeforeClass + public static void setup() { EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpa-h2-queryparams"); entityManager = factory.createEntityManager(); - } + } - @Test + @Test public void givenEmpNumber_whenUsingPositionalParameter_thenReturnExpectedEmployee() { - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber = ?1" , Employee.class); - String empNumber = "A123"; - Employee employee = query.setParameter(1, empNumber).getSingleResult(); + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.empNumber = ?1", Employee.class); + String empNumber = "A123"; + Employee employee = query.setParameter(1, empNumber) + .getSingleResult(); Assert.assertNotNull("Employee not found", employee); } - @Test + @Test public void givenEmpNumberList_whenUsingPositionalParameter_thenReturnExpectedEmployee() { - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber IN (?1)" , Employee.class); - List empNumbers = Arrays.asList("A123", "A124"); - List employees = query.setParameter(1, empNumbers).getResultList(); + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.empNumber IN (?1)", Employee.class); + List empNumbers = Arrays.asList("A123", "A124"); + List employees = query.setParameter(1, empNumbers) + .getResultList(); Assert.assertNotNull("Employees not found", employees); Assert.assertFalse("Employees not found", employees.isEmpty()); } - + @Test public void givenEmpNumber_whenUsingNamedParameter_thenReturnExpectedEmployee() { - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber = :number" , Employee.class); - String empNumber = "A123"; - Employee employee = query.setParameter("number", empNumber).getSingleResult(); - Assert.assertNotNull("Employee not found", employee); + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.empNumber = :number", Employee.class); + String empNumber = "A123"; + Employee employee = query.setParameter("number", empNumber) + .getSingleResult(); + Assert.assertNotNull("Employee not found", employee); } @Test public void givenEmpNumberList_whenUsingNamedParameter_thenReturnExpectedEmployee() { - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber IN (:numbers)" , Employee.class); - List empNumbers = Arrays.asList("A123", "A124"); - List employees = query.setParameter("numbers", empNumbers).getResultList(); - Assert.assertNotNull("Employees not found", employees); - Assert.assertFalse("Employees not found", employees.isEmpty()); + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.empNumber IN (:numbers)", Employee.class); + List empNumbers = Arrays.asList("A123", "A124"); + List employees = query.setParameter("numbers", empNumbers) + .getResultList(); + Assert.assertNotNull("Employees not found", employees); + Assert.assertFalse("Employees not found", employees.isEmpty()); } - + @Test public void givenEmpNameAndEmpAge_whenUsingTwoNamedParameters_thenReturnExpectedEmployees() { - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.name = :name AND e.age = :empAge" , Employee.class); - String empName = "John Doe"; - int empAge = 55; - List employees = query - .setParameter("name", empName) - .setParameter("empAge", empAge) - .getResultList(); - Assert.assertNotNull("Employees not found!", employees); - Assert.assertTrue("Employees not found!", !employees.isEmpty()); + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.name = :name AND e.age = :empAge", Employee.class); + String empName = "John Doe"; + int empAge = 55; + List employees = query.setParameter("name", empName) + .setParameter("empAge", empAge) + .getResultList(); + Assert.assertNotNull("Employees not found!", employees); + Assert.assertTrue("Employees not found!", !employees.isEmpty()); } @Test public void givenEmpNumber_whenUsingCriteriaQuery_thenReturnExpectedEmployee() { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery cQuery = cb.createQuery(Employee.class); - Root c = cQuery.from(Employee.class); - ParameterExpression paramEmpNumber = cb.parameter(String.class); - cQuery.select(c).where(cb.equal(c.get(Employee_.empNumber), paramEmpNumber)); - - TypedQuery query = entityManager.createQuery(cQuery); - String empNumber = "A123"; - query.setParameter(paramEmpNumber, empNumber); - Employee employee = query.getSingleResult(); - Assert.assertNotNull("Employee not found!", employee); + CriteriaQuery cQuery = cb.createQuery(Employee.class); + Root c = cQuery.from(Employee.class); + ParameterExpression paramEmpNumber = cb.parameter(String.class); + cQuery.select(c) + .where(cb.equal(c.get(Employee_.empNumber), paramEmpNumber)); + + TypedQuery query = entityManager.createQuery(cQuery); + String empNumber = "A123"; + query.setParameter(paramEmpNumber, empNumber); + Employee employee = query.getSingleResult(); + Assert.assertNotNull("Employee not found!", employee); } @Test public void givenEmpNumber_whenUsingLiteral_thenReturnExpectedEmployee() { - String empNumber = "A123"; - TypedQuery query = entityManager.createQuery( - "SELECT e FROM Employee e WHERE e.empNumber = '" + empNumber + "'", Employee.class); - Employee employee = query.getSingleResult(); - Assert.assertNotNull("Employee not found!", employee); + String empNumber = "A123"; + TypedQuery query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.empNumber = '" + empNumber + "'", Employee.class); + Employee employee = query.getSingleResult(); + Assert.assertNotNull("Employee not found!", employee); } } From d0b2aa86351f7fe9ce39329a45f28aad986051b1 Mon Sep 17 00:00:00 2001 From: Erhan Karakaya Date: Thu, 20 Jun 2019 11:00:12 +0300 Subject: [PATCH 51/70] removed empty beggining lines & added override annotation --- .../baeldung/autoservice/BingTranslationServiceProvider.java | 3 +-- .../autoservice/GoogleTranslationServiceProvider.java | 3 +-- .../java/com/baeldung/autoservice/TranslationService.java | 3 +-- .../com/baeldung/autoservice/TranslationServiceUnitTest.java | 5 +---- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java index 8ef4d6a45e..86d42e80fa 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/BingTranslationServiceProvider.java @@ -6,9 +6,8 @@ import java.util.Locale; @AutoService(TranslationService.class) public class BingTranslationServiceProvider implements TranslationService { - + @Override public String translate(String message, Locale from, Locale to) { - // implementation details return message + " (translated by Bing)"; } diff --git a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java index 3d6d1edc9f..0bf91ee5ec 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/GoogleTranslationServiceProvider.java @@ -6,9 +6,8 @@ import java.util.Locale; @AutoService(TranslationService.class) public class GoogleTranslationServiceProvider implements TranslationService { - + @Override public String translate(String message, Locale from, Locale to) { - // implementation details return message + " (translated by Google)"; } diff --git a/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java b/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java index cfcff4015c..580db46cd1 100644 --- a/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java +++ b/autovalue/src/main/java/com/baeldung/autoservice/TranslationService.java @@ -3,6 +3,5 @@ package com.baeldung.autoservice; import java.util.Locale; public interface TranslationService { - String translate(String message, Locale from, Locale to); -} +} \ No newline at end of file diff --git a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java index 2d7c8d7b6d..9e1bd6d291 100644 --- a/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java +++ b/autovalue/src/test/java/com/baeldung/autoservice/TranslationServiceUnitTest.java @@ -10,25 +10,22 @@ import java.util.stream.StreamSupport; import static org.junit.Assert.assertEquals; public class TranslationServiceUnitTest { - + private ServiceLoader loader; @Before public void setUp() { - loader = ServiceLoader.load(TranslationService.class); } @Test public void whenServiceLoaderLoads_thenLoadsAllProviders() { - long count = StreamSupport.stream(loader.spliterator(), false).count(); assertEquals(2, count); } @Test public void whenServiceLoaderLoadsGoogleService_thenGoogleIsLoaded() { - TranslationService googleService = StreamSupport.stream(loader.spliterator(), false) .filter(p -> p.getClass().getSimpleName().equals("GoogleTranslationServiceProvider")) .findFirst() From 5ddae76ae115a3ac74a463efb3e0164fad4109c9 Mon Sep 17 00:00:00 2001 From: Marcos Lopez Gonzalez Date: Thu, 20 Jun 2019 19:46:17 +0200 Subject: [PATCH 52/70] code moved from core-java to core-java-exceptions --- .../core-java-exceptions/pom.xml | 51 +++++++++++-------- .../baeldung/exceptions/RootCauseFinder.java | 0 .../error/ErrorGeneratorUnitTest.java | 3 +- .../exceptions/RootCauseFinderUnitTest.java | 0 4 files changed, 31 insertions(+), 23 deletions(-) rename core-java-modules/{core-java => core-java-exceptions}/src/main/java/com/baeldung/exceptions/RootCauseFinder.java (100%) rename core-java-modules/{core-java => core-java-exceptions}/src/test/java/com/baeldung/exceptions/RootCauseFinderUnitTest.java (100%) diff --git a/core-java-modules/core-java-exceptions/pom.xml b/core-java-modules/core-java-exceptions/pom.xml index 51c4e51341..37f65882c3 100644 --- a/core-java-modules/core-java-exceptions/pom.xml +++ b/core-java-modules/core-java-exceptions/pom.xml @@ -1,26 +1,35 @@ - 4.0.0 - com.baeldung.exception.numberformat - core-java-exceptions - 0.0.1-SNAPSHOT - core-java-exceptions + 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 + com.baeldung.exception.numberformat + core-java-exceptions + 0.0.1-SNAPSHOT + core-java-exceptions - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../../parent-java - + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + - - - junit - junit - 4.12 - test - - + + 3.9 + + + + + junit + junit + 4.12 + test + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/exceptions/RootCauseFinder.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/RootCauseFinder.java similarity index 100% rename from core-java-modules/core-java/src/main/java/com/baeldung/exceptions/RootCauseFinder.java rename to core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/RootCauseFinder.java diff --git a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exception/error/ErrorGeneratorUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exception/error/ErrorGeneratorUnitTest.java index de56fb7113..6dcd0d72e0 100644 --- a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exception/error/ErrorGeneratorUnitTest.java +++ b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exception/error/ErrorGeneratorUnitTest.java @@ -1,7 +1,6 @@ -package com.baeldung.error; +package com.baeldung.exception.error; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; public class ErrorGeneratorUnitTest { diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/exceptions/RootCauseFinderUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/RootCauseFinderUnitTest.java similarity index 100% rename from core-java-modules/core-java/src/test/java/com/baeldung/exceptions/RootCauseFinderUnitTest.java rename to core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/RootCauseFinderUnitTest.java From b748c86ce3d87f71e0f9e205d9d5e306c03e50b3 Mon Sep 17 00:00:00 2001 From: Laurentiu Delcea Date: Thu, 20 Jun 2019 22:53:47 +0300 Subject: [PATCH 53/70] BAEL-2982 NanoHTTPD guide (#7148) --- libraries-server/pom.xml | 14 +++++++ .../nanohttpd/ApplicationController.java | 38 +++++++++++++++++++ .../baeldung/nanohttpd/ItemGetController.java | 22 +++++++++++ .../ApplicationControllerUnitTest.java | 37 ++++++++++++++++++ .../nanohttpd/ItemGetControllerUnitTest.java | 37 ++++++++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 libraries-server/src/main/java/com/baeldung/nanohttpd/ApplicationController.java create mode 100644 libraries-server/src/main/java/com/baeldung/nanohttpd/ItemGetController.java create mode 100644 libraries-server/src/test/java/com/baeldung/nanohttpd/ApplicationControllerUnitTest.java create mode 100644 libraries-server/src/test/java/com/baeldung/nanohttpd/ItemGetControllerUnitTest.java diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index a6ead8fb31..873cca9b9b 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -96,6 +96,19 @@ smack-java7 ${smack.version} + + + + org.nanohttpd + nanohttpd + ${nanohttpd.version} + + + org.nanohttpd + nanohttpd-nanolets + ${nanohttpd.version} + + @@ -108,6 +121,7 @@ 8.5.24 4.3.1 1.2.0 + 2.3.1 \ No newline at end of file diff --git a/libraries-server/src/main/java/com/baeldung/nanohttpd/ApplicationController.java b/libraries-server/src/main/java/com/baeldung/nanohttpd/ApplicationController.java new file mode 100644 index 0000000000..2fa54c3ae2 --- /dev/null +++ b/libraries-server/src/main/java/com/baeldung/nanohttpd/ApplicationController.java @@ -0,0 +1,38 @@ +package com.baeldung.nanohttpd; + +import fi.iki.elonen.NanoHTTPD; +import fi.iki.elonen.router.RouterNanoHTTPD; + +import java.io.IOException; + +public class ApplicationController extends RouterNanoHTTPD { + + ApplicationController() throws IOException { + super(8072); + addMappings(); + start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); + } + + @Override + public void addMappings() { + addRoute("/", IndexHandler.class); + addRoute("/users", UserHandler.class); + } + + public static class UserHandler extends DefaultHandler { + @Override + public String getText() { + return "UserA, UserB, UserC"; + } + + @Override + public String getMimeType() { + return MIME_PLAINTEXT; + } + + @Override + public Response.IStatus getStatus() { + return Response.Status.OK; + } + } +} \ No newline at end of file diff --git a/libraries-server/src/main/java/com/baeldung/nanohttpd/ItemGetController.java b/libraries-server/src/main/java/com/baeldung/nanohttpd/ItemGetController.java new file mode 100644 index 0000000000..4a9c48fbfd --- /dev/null +++ b/libraries-server/src/main/java/com/baeldung/nanohttpd/ItemGetController.java @@ -0,0 +1,22 @@ +package com.baeldung.nanohttpd; + +import fi.iki.elonen.NanoHTTPD; + +import java.io.IOException; + +public class ItemGetController extends NanoHTTPD { + + ItemGetController() throws IOException { + super(8071); + start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); + } + + @Override + public Response serve(IHTTPSession session) { + if (session.getMethod() == Method.GET) { + String itemIdRequestParam = session.getParameters().get("itemId").get(0); + return newFixedLengthResponse("Requested itemId = " + itemIdRequestParam); + } + return newFixedLengthResponse(Response.Status.NOT_FOUND, MIME_PLAINTEXT, "The requested resource does not exist"); + } +} \ No newline at end of file diff --git a/libraries-server/src/test/java/com/baeldung/nanohttpd/ApplicationControllerUnitTest.java b/libraries-server/src/test/java/com/baeldung/nanohttpd/ApplicationControllerUnitTest.java new file mode 100644 index 0000000000..003f6ee3b7 --- /dev/null +++ b/libraries-server/src/test/java/com/baeldung/nanohttpd/ApplicationControllerUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.nanohttpd; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.*; + +public class ApplicationControllerUnitTest { + + private static final String BASE_URL = "http://localhost:8072/"; + private static final HttpClient CLIENT = HttpClientBuilder.create().build(); + + @BeforeClass + public static void setUp() throws IOException { + new ApplicationController(); + } + + @Test + public void givenServer_whenRootRouteRequested_thenHelloWorldReturned() throws IOException { + HttpResponse response = CLIENT.execute(new HttpGet(BASE_URL)); + assertTrue(IOUtils.toString(response.getEntity().getContent()).contains("Hello world!")); + assertEquals(200, response.getStatusLine().getStatusCode()); + } + + @Test + public void givenServer_whenUsersRequested_thenThenAllUsersReturned() throws IOException { + HttpResponse response = CLIENT.execute(new HttpGet(BASE_URL + "users")); + assertEquals("UserA, UserB, UserC", IOUtils.toString(response.getEntity().getContent())); + } +} \ No newline at end of file diff --git a/libraries-server/src/test/java/com/baeldung/nanohttpd/ItemGetControllerUnitTest.java b/libraries-server/src/test/java/com/baeldung/nanohttpd/ItemGetControllerUnitTest.java new file mode 100644 index 0000000000..3a4f0a4d98 --- /dev/null +++ b/libraries-server/src/test/java/com/baeldung/nanohttpd/ItemGetControllerUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.nanohttpd; + +import static org.junit.Assert.*; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.HttpClientBuilder; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; + +public class ItemGetControllerUnitTest { + + private static final String URL = "http://localhost:8071"; + private static final HttpClient CLIENT = HttpClientBuilder.create().build(); + + @BeforeClass + public static void setUp() throws IOException { + new ItemGetController(); + } + + @Test + public void givenServer_whenDoingGet_thenParamIsReadCorrectly() throws IOException { + HttpResponse response = CLIENT.execute(new HttpGet(URL + "?itemId=1234")); + assertEquals("Requested itemId = 1234", IOUtils.toString(response.getEntity().getContent())); + } + + @Test + public void givenServer_whenDoingPost_then404IsReturned() throws IOException { + HttpResponse response = CLIENT.execute(new HttpPost(URL)); + assertEquals(404, response.getStatusLine().getStatusCode()); + } +} \ No newline at end of file From 01bfd6a35321caf259318b67f0916101567c5164 Mon Sep 17 00:00:00 2001 From: nikunjgandhi1987 <51273165+nikunjgandhi1987@users.noreply.github.com> Date: Thu, 20 Jun 2019 23:19:33 -0500 Subject: [PATCH 54/70] Mini article raw type in java (#7142) * Raw type example implementation --- .../com/baeldung/rawtype/RawTypeDemo.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core-java-modules/core-java-lang-oop-2/src/main/java/com/baeldung/rawtype/RawTypeDemo.java diff --git a/core-java-modules/core-java-lang-oop-2/src/main/java/com/baeldung/rawtype/RawTypeDemo.java b/core-java-modules/core-java-lang-oop-2/src/main/java/com/baeldung/rawtype/RawTypeDemo.java new file mode 100644 index 0000000000..e358219d24 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-2/src/main/java/com/baeldung/rawtype/RawTypeDemo.java @@ -0,0 +1,25 @@ +package com.baeldung.rawtype; + +import java.util.ArrayList; +import java.util.List; + +public class RawTypeDemo { + + public static void main(String[] args) { + RawTypeDemo rawTypeDemo = new RawTypeDemo(); + rawTypeDemo.methodA(); + } + + public void methodA() { + // parameterized type + List listStr = new ArrayList<>(); + listStr.add("Hello Folks!"); + methodB(listStr); + String s = listStr.get(1); // ClassCastException at run time + } + + public void methodB(List rawList) { // Inexpressive raw type + rawList.add(1); // Unsafe operation + } + +} From d2ae74a037f18eda1da06a921b6bfcd43b7658a2 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Fri, 21 Jun 2019 06:59:26 +0200 Subject: [PATCH 55/70] BAEL-2933 The Difference Between Collection.stream().forEach() and Collection.forEach() (#7137) --- .../com/baeldung/forEach/ReverseList.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 core-java-modules/core-java-8/src/main/java/com/baeldung/forEach/ReverseList.java diff --git a/core-java-modules/core-java-8/src/main/java/com/baeldung/forEach/ReverseList.java b/core-java-modules/core-java-8/src/main/java/com/baeldung/forEach/ReverseList.java new file mode 100644 index 0000000000..b2ce77a9f6 --- /dev/null +++ b/core-java-modules/core-java-8/src/main/java/com/baeldung/forEach/ReverseList.java @@ -0,0 +1,84 @@ +package com.baeldung.forEach; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.function.Consumer; + +class ReverseList extends ArrayList { + + List list = Arrays.asList("A", "B", "C", "D"); + + Consumer removeElement = s -> { + System.out.println(s + " " + list.size()); + if (s != null && s.equals("A")) { + list.remove("D"); + } + }; + + @Override + public Iterator iterator() { + + final int startIndex = this.size() - 1; + final List list = this; + return new Iterator() { + + int currentIndex = startIndex; + + @Override + public boolean hasNext() { + return currentIndex >= 0; + } + + @Override + public String next() { + String next = list.get(currentIndex); + currentIndex--; + return next; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + + public void forEach(Consumer action) { + for (String s : this) { + action.accept(s); + } + } + + public void iterateParallel() { + list.forEach(System.out::print); + System.out.print(" "); + list.parallelStream().forEach(System.out::print); + } + + public void iterateReverse() { + List myList = new ReverseList(); + myList.addAll(list); + myList.forEach(System.out::print); + System.out.print(" "); + myList.stream().forEach(System.out::print); + } + + public void removeInCollectionForEach() { + list.forEach(removeElement); + } + + public void removeInStreamForEach() { + list.stream().forEach(removeElement); + } + + public static void main(String[] argv) { + + ReverseList collectionForEach = new ReverseList(); + collectionForEach.iterateParallel(); + collectionForEach.iterateReverse(); + collectionForEach.removeInCollectionForEach(); + collectionForEach.removeInStreamForEach(); + } +} \ No newline at end of file From ddc85d20b9fff36a6e2b6b48325f7e896ea3b162 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 8 Jun 2019 14:58:07 +0200 Subject: [PATCH 56/70] [BAEL-2996] Apache Commons Math3 example --- .../commons/math3/MatrixMultiplication.java | 6 +++ .../commons/math/RealMatrixUnitTest.java | 41 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java create mode 100644 libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java diff --git a/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java b/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java new file mode 100644 index 0000000000..12252d8d14 --- /dev/null +++ b/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java @@ -0,0 +1,6 @@ +package com.baeldung.commons.math3; + +public class MatrixMultiplication { + + +} diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java b/libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java new file mode 100644 index 0000000000..fca2bf6dd1 --- /dev/null +++ b/libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.commons.math; + +import org.apache.commons.math3.linear.Array2DRowRealMatrix; +import org.apache.commons.math3.linear.RealMatrix; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class RealMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + RealMatrix firstMatrix = new Array2DRowRealMatrix( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + } + ); + + RealMatrix secondMatrix = new Array2DRowRealMatrix( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + RealMatrix expected = new Array2DRowRealMatrix( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + RealMatrix actual = firstMatrix.multiply(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + +} From 7d71c3ac94a144df6c1b14bbdf8475ba1ee33572 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 8 Jun 2019 15:17:36 +0200 Subject: [PATCH 57/70] [BAEL-2996] Added ejml example --- libraries-2/pom.xml | 14 ++++-- .../baeldung/ejml/SimpleMatrixUnitTest.java | 47 +++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 32f3f23812..a734685b80 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -50,6 +50,11 @@ picocli ${picocli.version} + + org.ejml + ejml-all + ${ejml.version} + org.springframework.boot spring-boot-starter @@ -93,10 +98,10 @@ test - - edu.uci.ics - crawler4j - ${crawler4j.version} + + edu.uci.ics + crawler4j + ${crawler4j.version} @@ -109,5 +114,6 @@ 3.17.2 4.4.0 2.1.4.RELEASE + 0.37.1 diff --git a/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java new file mode 100644 index 0000000000..0f394889c0 --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.ejml; + +import org.ejml.simple.SimpleMatrix; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class SimpleMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + SimpleMatrix firstMatrix = new SimpleMatrix( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + } + ); + + SimpleMatrix secondMatrix = new SimpleMatrix( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + SimpleMatrix expected = new SimpleMatrix( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + SimpleMatrix actual = firstMatrix.mult(secondMatrix); + + assertThat(actual.numRows()).isEqualTo(expected.numRows()); + assertThat(actual.numCols()).isEqualTo(expected.numCols()); + for (int row = 0; row < actual.numRows(); row++) { + for (int col = 0; col < actual.numCols(); col++) { + assertThat(actual.get(row, col)) + .describedAs("Cells at [%d, %d] don't match", row, col) + .isEqualTo(expected.get(row, col)); + } + } + } +} From 4b14001cb3aace5c793ae1033abbc765a68710a7 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 8 Jun 2019 22:03:00 +0200 Subject: [PATCH 58/70] [BAEL-2996] Added Colt library example --- libraries-2/pom.xml | 6 +++ .../baeldung/colt/DoubleMatrix2DUniTest.java | 43 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index a734685b80..b936465e82 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -55,6 +55,11 @@ ejml-all ${ejml.version} + + colt + colt + ${colt.version} + org.springframework.boot spring-boot-starter @@ -115,5 +120,6 @@ 4.4.0 2.1.4.RELEASE 0.37.1 + 1.2.0 diff --git a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java new file mode 100644 index 0000000000..54d10e8cef --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java @@ -0,0 +1,43 @@ +package com.baeldung.colt; + +import cern.colt.matrix.DoubleFactory2D; +import cern.colt.matrix.DoubleMatrix2D; +import cern.colt.matrix.linalg.Algebra; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class DoubleMatrix2DUniTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; + + DoubleMatrix2D firstMatrix = doubleFactory2D.make( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + }); + + DoubleMatrix2D secondMatrix = doubleFactory2D.make( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + DoubleMatrix2D expected = doubleFactory2D.make( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + Algebra algebra = new Algebra(); + DoubleMatrix2D actual = algebra.mult(firstMatrix, secondMatrix); + + assertThat(actual).isEqualTo(expected); + } +} From 082aa7d0a6a369407a589499b57b06f0f4516fc8 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 8 Jun 2019 22:19:02 +0200 Subject: [PATCH 59/70] [BAEL-2996] Added la4j library example --- libraries-2/pom.xml | 6 +++ ...iTest.java => DoubleMatrix2DUnitTest.java} | 2 +- .../baeldung/la4j/Basic2DMatrixUnitTest.java | 39 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) rename libraries-2/src/test/java/com/baeldung/colt/{DoubleMatrix2DUniTest.java => DoubleMatrix2DUnitTest.java} (97%) create mode 100644 libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index b936465e82..aca47f957d 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -60,6 +60,11 @@ colt ${colt.version} + + org.la4j + la4j + ${la4j.version} + org.springframework.boot spring-boot-starter @@ -121,5 +126,6 @@ 2.1.4.RELEASE 0.37.1 1.2.0 + 0.6.0 diff --git a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java similarity index 97% rename from libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java rename to libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java index 54d10e8cef..d88d1a150a 100644 --- a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUniTest.java +++ b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -class DoubleMatrix2DUniTest { +class DoubleMatrix2DUnitTest { @Test void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { diff --git a/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java new file mode 100644 index 0000000000..cf0f132cae --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.la4j; + +import org.junit.jupiter.api.Test; +import org.la4j.Matrix; +import org.la4j.matrix.dense.Basic2DMatrix; + +import static org.assertj.core.api.Assertions.assertThat; + +class Basic2DMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + Matrix firstMatrix = new Basic2DMatrix( + new double[][]{ + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + }); + + Matrix secondMatrix = new Basic2DMatrix( + new double[][]{ + new double[]{1d, 2d, 3d, 7d}, + new double[]{5d, 2d, 8d, 1d} + } + ); + + Matrix expected = new Basic2DMatrix( + new double[][]{ + new double[]{26d, 12d, 43d, 12d}, + new double[]{17d, 10d, 30d, 17d}, + new double[]{36d, 16d, 59d, 14d} + } + ); + + Matrix actual = firstMatrix.multiply(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } +} From 8a8f880d336c2564fe015ea48877ba26de78a35a Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 16 Jun 2019 14:40:02 +0200 Subject: [PATCH 60/70] [BAEL-2996] Improved test with simpler matrix validation --- .../java/com/baeldung/ejml/SimpleMatrixUnitTest.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java index 0f394889c0..7fba7e00a2 100644 --- a/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java @@ -34,14 +34,6 @@ class SimpleMatrixUnitTest { SimpleMatrix actual = firstMatrix.mult(secondMatrix); - assertThat(actual.numRows()).isEqualTo(expected.numRows()); - assertThat(actual.numCols()).isEqualTo(expected.numCols()); - for (int row = 0; row < actual.numRows(); row++) { - for (int col = 0; col < actual.numCols(); col++) { - assertThat(actual.get(row, col)) - .describedAs("Cells at [%d, %d] don't match", row, col) - .isEqualTo(expected.get(row, col)); - } - } + assertThat(actual).matches(m -> m.isIdentical(expected, 0d)); } } From e885264b5f2a29cb153b2d58b8acd301f69f2754 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 16 Jun 2019 15:58:30 +0200 Subject: [PATCH 61/70] [BAEL-2996] Added ND4J dependency and matrices multiplication test --- libraries-2/pom.xml | 8 +++- .../com/baeldung/nd4j/INDArrayUnitTest.java | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index aca47f957d..bcb4f51bc2 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -55,6 +55,11 @@ ejml-all ${ejml.version} + + org.nd4j + nd4j-native + ${nd4j.version} + colt colt @@ -124,7 +129,8 @@ 3.17.2 4.4.0 2.1.4.RELEASE - 0.37.1 + 0.38 + 1.0.0-beta4 1.2.0 0.6.0 diff --git a/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java b/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java new file mode 100644 index 0000000000..a09eef9a57 --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.nd4j; + +import org.junit.jupiter.api.Test; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.factory.Nd4j; + +import static org.assertj.core.api.Assertions.assertThat; + +class INDArrayUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + INDArray firstMatrix = Nd4j.create( + new double[][]{ + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + } + ); + + INDArray secondMatrix = Nd4j.create( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + INDArray expected = Nd4j.create( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + INDArray actual = firstMatrix.mmul(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } +} From 874f8d07c87325ddf729a500b468ea61dd6645e2 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sun, 16 Jun 2019 15:58:56 +0200 Subject: [PATCH 62/70] [BAEL-2996] Fixed formatting --- .../src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java index cf0f132cae..af6274998e 100644 --- a/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java @@ -15,7 +15,8 @@ class Basic2DMatrixUnitTest { new double[]{1d, 5d}, new double[]{2d, 3d}, new double[]{1d, 7d} - }); + } + ); Matrix secondMatrix = new Basic2DMatrix( new double[][]{ From 5296f37727eff8c634f940666513516cad59bc54 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 21 Jun 2019 06:03:09 +0200 Subject: [PATCH 63/70] [BAEL-2996] Small fixes --- libraries-2/pom.xml | 20 +++++++++---------- .../baeldung/colt/DoubleMatrix2DUnitTest.java | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index bcb4f51bc2..8f223e7ea0 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -60,16 +60,16 @@ nd4j-native ${nd4j.version} - - colt - colt - ${colt.version} - - - org.la4j - la4j - ${la4j.version} - + + org.la4j + la4j + ${la4j.version} + + + colt + colt + ${colt.version} + org.springframework.boot spring-boot-starter diff --git a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java index d88d1a150a..8b541f3974 100644 --- a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java @@ -18,7 +18,8 @@ class DoubleMatrix2DUnitTest { new double[] {1d, 5d}, new double[] {2d, 3d}, new double[] {1d ,7d} - }); + } + ); DoubleMatrix2D secondMatrix = doubleFactory2D.make( new double[][] { From bc498d61b3659364c61869f374f7c40b93773245 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 21 Jun 2019 06:40:30 +0200 Subject: [PATCH 64/70] [BAEL-2996] Moved previous tests and added own implementation --- .../colt/DoubleMatrix2DUnitTest.java | 2 +- .../ejml/SimpleMatrixUnitTest.java | 2 +- .../matrices/homemade/MatrixUnitTest.java | 52 +++++++++++++++++++ .../la4j/Basic2DMatrixUnitTest.java | 2 +- .../{ => matrices}/nd4j/INDArrayUnitTest.java | 2 +- 5 files changed, 56 insertions(+), 4 deletions(-) rename libraries-2/src/test/java/com/baeldung/{ => matrices}/colt/DoubleMatrix2DUnitTest.java (97%) rename libraries-2/src/test/java/com/baeldung/{ => matrices}/ejml/SimpleMatrixUnitTest.java (96%) create mode 100644 libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java rename libraries-2/src/test/java/com/baeldung/{ => matrices}/la4j/Basic2DMatrixUnitTest.java (96%) rename libraries-2/src/test/java/com/baeldung/{ => matrices}/nd4j/INDArrayUnitTest.java (96%) diff --git a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java similarity index 97% rename from libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java index 8b541f3974..f21d6ab12c 100644 --- a/libraries-2/src/test/java/com/baeldung/colt/DoubleMatrix2DUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.colt; +package com.baeldung.matrices.colt; import cern.colt.matrix.DoubleFactory2D; import cern.colt.matrix.DoubleMatrix2D; diff --git a/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java similarity index 96% rename from libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java index 7fba7e00a2..eb022d752f 100644 --- a/libraries-2/src/test/java/com/baeldung/ejml/SimpleMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.ejml; +package com.baeldung.matrices.ejml; import org.ejml.simple.SimpleMatrix; import org.junit.jupiter.api.Test; diff --git a/libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java new file mode 100644 index 0000000000..b118e5503d --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.matrices.homemade; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class MatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + double[][] firstMatrix = { + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + }; + + double[][] secondMatrix = { + new double[]{1d, 2d, 3d, 7d}, + new double[]{5d, 2d, 8d, 1d} + }; + + double[][] expected = { + new double[]{26d, 12d, 43d, 12d}, + new double[]{17d, 10d, 30d, 17d}, + new double[]{36d, 16d, 59d, 14d} + }; + + double[][] actual = multiplyMatrices(firstMatrix, secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + + private double[][] multiplyMatrices(double[][] firstMatrix, double[][] secondMatrix) { + double[][] result = new double[firstMatrix.length][secondMatrix[0].length]; + + for (int row = 0; row < result.length; row++) { + for (int col = 0; col < result[row].length; col++) { + result[row][col] = multiplyMatricesCell(firstMatrix, secondMatrix, row, col); + } + } + + return result; + } + + private double multiplyMatricesCell(double[][] firstMatrix, double[][] secondMatrix, int row, int col) { + double cell = 0; + for (int i = 0; i < secondMatrix.length; i++) { + cell += firstMatrix[row][i] * secondMatrix[i][col]; + } + return cell; + } +} diff --git a/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java similarity index 96% rename from libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java index af6274998e..ef2d50aa08 100644 --- a/libraries-2/src/test/java/com/baeldung/la4j/Basic2DMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.la4j; +package com.baeldung.matrices.la4j; import org.junit.jupiter.api.Test; import org.la4j.Matrix; diff --git a/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java similarity index 96% rename from libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java index a09eef9a57..6f3502726c 100644 --- a/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.nd4j; +package com.baeldung.matrices.nd4j; import org.junit.jupiter.api.Test; import org.nd4j.linalg.api.ndarray.INDArray; From 327fc24a4b8ee533951959255e3a266d970ead12 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 21 Jun 2019 07:42:20 +0200 Subject: [PATCH 65/70] [BAEL-2996] Moving all test under this module and adding benchmarking --- libraries-2/pom.xml | 13 +++++++++++++ .../matrices/MatrixMultiplicationBenchmarking.java | 11 +++++++++++ .../matrices/apache}/RealMatrixUnitTest.java | 12 +++++++++--- .../matrices/colt/DoubleMatrix2DUnitTest.java | 11 +++++++++-- .../matrices/ejml/SimpleMatrixUnitTest.java | 11 +++++++++-- ...rixUnitTest.java => HomemadeMatrixUnitTest.java} | 10 ++++++++-- .../matrices/la4j/Basic2DMatrixUnitTest.java | 11 +++++++++-- .../baeldung/matrices/nd4j/INDArrayUnitTest.java | 10 ++++++++-- 8 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java rename {libraries-apache-commons/src/test/java/com/baeldung/commons/math => libraries-2/src/test/java/com/baeldung/matrices/apache}/RealMatrixUnitTest.java (76%) rename libraries-2/src/test/java/com/baeldung/matrices/homemade/{MatrixUnitTest.java => HomemadeMatrixUnitTest.java} (84%) diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 8f223e7ea0..c18b4aae64 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -118,6 +118,18 @@ crawler4j ${crawler4j.version} + + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + @@ -133,5 +145,6 @@ 1.0.0-beta4 1.2.0 0.6.0 + 1.19 diff --git a/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java b/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java new file mode 100644 index 0000000000..fff6805a89 --- /dev/null +++ b/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java @@ -0,0 +1,11 @@ +package com.baeldung.matrices; + +import org.openjdk.jmh.Main; + +public class MatrixMultiplicationBenchmarking { + + public static void main(String[] args) throws Exception { + Main.main(args); + } + +} diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java similarity index 76% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java index fca2bf6dd1..05944e7b3a 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/commons/math/RealMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java @@ -1,15 +1,21 @@ -package com.baeldung.commons.math; +package com.baeldung.matrices.apache; import org.apache.commons.math3.linear.Array2DRowRealMatrix; import org.apache.commons.math3.linear.RealMatrix; import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class RealMatrixUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class RealMatrixUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + @Benchmark + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { RealMatrix firstMatrix = new Array2DRowRealMatrix( new double[][] { new double[] {1d, 5d}, diff --git a/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java index f21d6ab12c..fb4a419eb0 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java @@ -4,13 +4,19 @@ import cern.colt.matrix.DoubleFactory2D; import cern.colt.matrix.DoubleMatrix2D; import cern.colt.matrix.linalg.Algebra; import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class DoubleMatrix2DUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class DoubleMatrix2DUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + @Benchmark + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; DoubleMatrix2D firstMatrix = doubleFactory2D.make( @@ -41,4 +47,5 @@ class DoubleMatrix2DUnitTest { assertThat(actual).isEqualTo(expected); } + } diff --git a/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java index eb022d752f..b025266a1d 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java @@ -2,13 +2,19 @@ package com.baeldung.matrices.ejml; import org.ejml.simple.SimpleMatrix; import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class SimpleMatrixUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class SimpleMatrixUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + @Benchmark + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { SimpleMatrix firstMatrix = new SimpleMatrix( new double[][] { new double[] {1d, 5d}, @@ -36,4 +42,5 @@ class SimpleMatrixUnitTest { assertThat(actual).matches(m -> m.isIdentical(expected, 0d)); } + } diff --git a/libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java similarity index 84% rename from libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java rename to libraries-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java index b118e5503d..be9e483d5b 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/homemade/MatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java @@ -1,13 +1,19 @@ package com.baeldung.matrices.homemade; import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class MatrixUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class HomemadeMatrixUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + @Benchmark + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { double[][] firstMatrix = { new double[]{1d, 5d}, new double[]{2d, 3d}, diff --git a/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java index ef2d50aa08..afb84ff3db 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java @@ -3,13 +3,19 @@ package com.baeldung.matrices.la4j; import org.junit.jupiter.api.Test; import org.la4j.Matrix; import org.la4j.matrix.dense.Basic2DMatrix; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class Basic2DMatrixUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class Basic2DMatrixUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + @Benchmark + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { Matrix firstMatrix = new Basic2DMatrix( new double[][]{ new double[]{1d, 5d}, @@ -37,4 +43,5 @@ class Basic2DMatrixUnitTest { assertThat(actual).isEqualTo(expected); } + } diff --git a/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java b/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java index 6f3502726c..fb3030bccf 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java @@ -3,13 +3,18 @@ package com.baeldung.matrices.nd4j; import org.junit.jupiter.api.Test; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; +import org.openjdk.jmh.annotations.*; import static org.assertj.core.api.Assertions.assertThat; -class INDArrayUnitTest { +@BenchmarkMode(Mode.AverageTime) +@Fork(value = 2) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +public class INDArrayUnitTest { @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + public void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { INDArray firstMatrix = Nd4j.create( new double[][]{ new double[]{1d, 5d}, @@ -37,4 +42,5 @@ class INDArrayUnitTest { assertThat(actual).isEqualTo(expected); } + } From bc8fbaf579054b968b9708bf8fa44b9e65c32cff Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 22 Jun 2019 11:40:10 +0200 Subject: [PATCH 66/70] =?UTF-8?q?=C3=83[BAEL-2996]=20Used=20qualified=20cl?= =?UTF-8?q?ass=20for=20benchmarking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baeldung/matrices/MatrixMultiplicationBenchmarking.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java b/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java index fff6805a89..1e3b183aa7 100644 --- a/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java +++ b/libraries-2/src/test/java/com/baeldung/matrices/MatrixMultiplicationBenchmarking.java @@ -1,11 +1,9 @@ package com.baeldung.matrices; -import org.openjdk.jmh.Main; - public class MatrixMultiplicationBenchmarking { public static void main(String[] args) throws Exception { - Main.main(args); + org.openjdk.jmh.Main.main(args); } } From 9ec362f520b10f01ae749a793e6181e034de19fe Mon Sep 17 00:00:00 2001 From: dupirefr Date: Sat, 22 Jun 2019 11:43:33 +0200 Subject: [PATCH 67/70] =?UTF-8?q?[BAEL-2996]=20Removed=20useless=20class?= =?UTF-8?q?=C3=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/baeldung/commons/math3/MatrixMultiplication.java | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java diff --git a/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java b/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java deleted file mode 100644 index 12252d8d14..0000000000 --- a/libraries-apache-commons/src/main/java/com/baeldung/commons/math3/MatrixMultiplication.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.commons.math3; - -public class MatrixMultiplication { - - -} From ca560514a0b7c55093f2a17fe2709c76a6a89ab8 Mon Sep 17 00:00:00 2001 From: Drazen Nikolic Date: Mon, 24 Jun 2019 12:44:13 +0200 Subject: [PATCH 68/70] BAEL-2486: Spring Data MongoDB Tailable Cursor example. (#7182) --- spring-5-data-reactive/pom.xml | 5 + .../LogsCounterApplication.java | 11 ++ .../baeldung/tailablecursor/domain/Log.java | 21 ++++ .../tailablecursor/domain/LogLevel.java | 5 + .../repository/LogsRepository.java | 12 ++ .../service/ErrorLogsCounter.java | 62 ++++++++++ .../service/InfoLogsCounter.java | 36 ++++++ .../tailablecursor/service/LogsCounter.java | 5 + .../service/WarnLogsCounter.java | 41 +++++++ .../service/ErrorLogsCounterManualTest.java | 112 ++++++++++++++++++ .../service/InfoLogsCounterManualTest.java | 75 ++++++++++++ .../service/WarnLogsCounterManualTest.java | 75 ++++++++++++ 12 files changed, 460 insertions(+) create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/LogsCounterApplication.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/Log.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/LogLevel.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/repository/LogsRepository.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/ErrorLogsCounter.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/InfoLogsCounter.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/LogsCounter.java create mode 100644 spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/WarnLogsCounter.java create mode 100644 spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java create mode 100644 spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/InfoLogsCounterManualTest.java create mode 100644 spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/WarnLogsCounterManualTest.java diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index aa73cf11ae..8c16851de0 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -63,6 +63,11 @@ spring-boot-starter-test test + + de.flapdoodle.embed + de.flapdoodle.embed.mongo + test + diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/LogsCounterApplication.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/LogsCounterApplication.java new file mode 100644 index 0000000000..8b2511a8f3 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/LogsCounterApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.tailablecursor; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LogsCounterApplication { + public static void main(String[] args) { + SpringApplication.run(LogsCounterApplication.class, args); + } +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/Log.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/Log.java new file mode 100644 index 0000000000..717a367751 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/Log.java @@ -0,0 +1,21 @@ +package com.baeldung.tailablecursor.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +@Data +@Document +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class Log { + @Id + private String id; + private String service; + private LogLevel level; + private String message; +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/LogLevel.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/LogLevel.java new file mode 100644 index 0000000000..6826fbffd3 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/domain/LogLevel.java @@ -0,0 +1,5 @@ +package com.baeldung.tailablecursor.domain; + +public enum LogLevel { + ERROR, WARN, INFO +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/repository/LogsRepository.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/repository/LogsRepository.java new file mode 100644 index 0000000000..dce11c548c --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/repository/LogsRepository.java @@ -0,0 +1,12 @@ +package com.baeldung.tailablecursor.repository; + +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import org.springframework.data.mongodb.repository.Tailable; +import org.springframework.data.repository.reactive.ReactiveCrudRepository; +import reactor.core.publisher.Flux; + +public interface LogsRepository extends ReactiveCrudRepository { + @Tailable + Flux findByLevel(LogLevel level); +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/ErrorLogsCounter.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/ErrorLogsCounter.java new file mode 100644 index 0000000000..c243e64f97 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/ErrorLogsCounter.java @@ -0,0 +1,62 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.messaging.DefaultMessageListenerContainer; +import org.springframework.data.mongodb.core.messaging.MessageListener; +import org.springframework.data.mongodb.core.messaging.MessageListenerContainer; +import org.springframework.data.mongodb.core.messaging.TailableCursorRequest; + +import javax.annotation.PreDestroy; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.springframework.data.mongodb.core.query.Criteria.where; +import static org.springframework.data.mongodb.core.query.Query.query; + +@Slf4j +public class ErrorLogsCounter implements LogsCounter { + + private static final String LEVEL_FIELD_NAME = "level"; + + private final String collectionName; + private final MessageListenerContainer container; + + private final AtomicInteger counter = new AtomicInteger(); + + public ErrorLogsCounter(MongoTemplate mongoTemplate, + String collectionName) { + this.collectionName = collectionName; + this.container = new DefaultMessageListenerContainer(mongoTemplate); + + container.start(); + TailableCursorRequest request = getTailableCursorRequest(); + container.register(request, Log.class); + } + + @SuppressWarnings("unchecked") + private TailableCursorRequest getTailableCursorRequest() { + MessageListener listener = message -> { + log.info("ERROR log received: {}", message.getBody()); + counter.incrementAndGet(); + }; + + return TailableCursorRequest.builder() + .collection(collectionName) + .filter(query(where(LEVEL_FIELD_NAME).is(LogLevel.ERROR))) + .publishTo(listener) + .build(); + } + + @Override + public int count() { + return counter.get(); + } + + @PreDestroy + public void close() { + container.stop(); + } +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/InfoLogsCounter.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/InfoLogsCounter.java new file mode 100644 index 0000000000..b30eba0b25 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/InfoLogsCounter.java @@ -0,0 +1,36 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import com.baeldung.tailablecursor.repository.LogsRepository; +import lombok.extern.slf4j.Slf4j; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; + +import javax.annotation.PreDestroy; +import java.util.concurrent.atomic.AtomicInteger; + +@Slf4j +public class InfoLogsCounter implements LogsCounter { + + private final AtomicInteger counter = new AtomicInteger(); + private final Disposable subscription; + + public InfoLogsCounter(LogsRepository repository) { + Flux stream = repository.findByLevel(LogLevel.INFO); + this.subscription = stream.subscribe(l -> { + log.info("INFO log received: " + l); + counter.incrementAndGet(); + }); + } + + @Override + public int count() { + return this.counter.get(); + } + + @PreDestroy + public void close() { + this.subscription.dispose(); + } +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/LogsCounter.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/LogsCounter.java new file mode 100644 index 0000000000..e14a3eadd7 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/LogsCounter.java @@ -0,0 +1,5 @@ +package com.baeldung.tailablecursor.service; + +public interface LogsCounter { + int count(); +} diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/WarnLogsCounter.java b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/WarnLogsCounter.java new file mode 100644 index 0000000000..b21f61fa88 --- /dev/null +++ b/spring-5-data-reactive/src/main/java/com/baeldung/tailablecursor/service/WarnLogsCounter.java @@ -0,0 +1,41 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.mongodb.core.ReactiveMongoTemplate; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; + +import javax.annotation.PreDestroy; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.springframework.data.mongodb.core.query.Criteria.where; +import static org.springframework.data.mongodb.core.query.Query.query; + +@Slf4j +public class WarnLogsCounter implements LogsCounter { + + private static final String LEVEL_FIELD_NAME = "level"; + + private final AtomicInteger counter = new AtomicInteger(); + private final Disposable subscription; + + public WarnLogsCounter(ReactiveMongoTemplate template) { + Flux stream = template.tail(query(where(LEVEL_FIELD_NAME).is(LogLevel.WARN)), Log.class); + subscription = stream.subscribe(l -> { + log.warn("WARN log received: " + l); + counter.incrementAndGet(); + }); + } + + @Override + public int count() { + return counter.get(); + } + + @PreDestroy + public void close() { + subscription.dispose(); + } +} diff --git a/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java new file mode 100644 index 0000000000..5e20d3ec79 --- /dev/null +++ b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java @@ -0,0 +1,112 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import com.mongodb.MongoClient; +import com.mongodb.client.MongoCollection; +import com.mongodb.client.MongoDatabase; +import com.mongodb.client.model.CreateCollectionOptions; +import de.flapdoodle.embed.mongo.MongodExecutable; +import de.flapdoodle.embed.mongo.MongodProcess; +import de.flapdoodle.embed.mongo.MongodStarter; +import de.flapdoodle.embed.mongo.config.MongodConfigBuilder; +import de.flapdoodle.embed.mongo.config.Net; +import de.flapdoodle.embed.mongo.distribution.Version; +import de.flapdoodle.embed.process.runtime.Network; +import org.bson.Document; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.util.SocketUtils; + +import java.io.IOException; +import java.util.stream.IntStream; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class ErrorLogsCounterManualTest { + + private static final String SERVER = "localhost"; + private static final int PORT = SocketUtils.findAvailableTcpPort(10000); + private static final String DB_NAME = "test"; + private static final String COLLECTION_NAME = Log.class.getName().toLowerCase(); + + private static final MongodStarter starter = MongodStarter.getDefaultInstance(); + private static final int MAX_DOCUMENTS_IN_COLLECTION = 3; + + private ErrorLogsCounter errorLogsCounter; + private MongodExecutable mongodExecutable; + private MongodProcess mongoDaemon; + private MongoDatabase db; + + @Before + public void setup() throws Exception { + MongoTemplate mongoTemplate = initMongoTemplate(); + + MongoCollection collection = createCappedCollection(); + + persistDocument(collection, -1, LogLevel.ERROR, "my-service", "Initial log"); + + errorLogsCounter = new ErrorLogsCounter(mongoTemplate, COLLECTION_NAME); + Thread.sleep(1000L); // wait for initialization + } + + private MongoTemplate initMongoTemplate() throws IOException { + mongodExecutable = starter.prepare(new MongodConfigBuilder() + .version(Version.Main.PRODUCTION) + .net(new Net(SERVER, PORT, Network.localhostIsIPv6())) + .build()); + mongoDaemon = mongodExecutable.start(); + + MongoClient mongoClient = new MongoClient(SERVER, PORT); + db = mongoClient.getDatabase(DB_NAME); + + return new MongoTemplate(mongoClient, DB_NAME); + } + + private MongoCollection createCappedCollection() { + db.createCollection(COLLECTION_NAME, new CreateCollectionOptions() + .capped(true) + .sizeInBytes(100000) + .maxDocuments(MAX_DOCUMENTS_IN_COLLECTION)); + return db.getCollection(COLLECTION_NAME); + } + + private void persistDocument(MongoCollection collection, + int i, LogLevel level, String service, String message) { + Document logMessage = new Document(); + logMessage.append("_id", i); + logMessage.append("level", level.toString()); + logMessage.append("service", service); + logMessage.append("message", message); + collection.insertOne(logMessage); + } + + @After + public void tearDown() { + errorLogsCounter.close(); + mongoDaemon.stop(); + mongodExecutable.stop(); + } + + @Test + public void whenErrorLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception { + MongoCollection collection = db.getCollection(COLLECTION_NAME); + + IntStream.range(1, 10) + .forEach(i -> persistDocument(collection, + i, + i > 5 ? LogLevel.ERROR : LogLevel.INFO, + "service" + i, + "Message from service " + i) + ); + + Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver + + assertThat(collection.countDocuments(), is((long) MAX_DOCUMENTS_IN_COLLECTION)); + assertThat(errorLogsCounter.count(), is(5)); + } + +} diff --git a/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/InfoLogsCounterManualTest.java b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/InfoLogsCounterManualTest.java new file mode 100644 index 0000000000..cd8bd68257 --- /dev/null +++ b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/InfoLogsCounterManualTest.java @@ -0,0 +1,75 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.LogsCounterApplication; +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import com.baeldung.tailablecursor.repository.LogsRepository; +import lombok.extern.slf4j.Slf4j; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.mongodb.core.CollectionOptions; +import org.springframework.data.mongodb.core.ReactiveMongoTemplate; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Flux; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = LogsCounterApplication.class) +@Slf4j +public class InfoLogsCounterManualTest { + @Autowired + private LogsRepository repository; + + @Autowired + private ReactiveMongoTemplate template; + + @Before + public void setUp() { + createCappedCollectionUsingReactiveMongoTemplate(template); + + persistDocument(Log.builder() + .level(LogLevel.INFO) + .service("Service 2") + .message("Initial INFO message") + .build()); + } + + private void createCappedCollectionUsingReactiveMongoTemplate(ReactiveMongoTemplate reactiveMongoTemplate) { + reactiveMongoTemplate.dropCollection(Log.class).block(); + reactiveMongoTemplate.createCollection(Log.class, CollectionOptions.empty() + .maxDocuments(5) + .size(1024 * 1024L) + .capped()).block(); + } + + private void persistDocument(Log log) { + repository.save(log).block(); + } + + @Test + public void wheInfoLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception { + InfoLogsCounter infoLogsCounter = new InfoLogsCounter(repository); + + Thread.sleep(1000L); // wait for initialization + + Flux.range(0,10) + .map(i -> Log.builder() + .level(i > 5 ? LogLevel.WARN : LogLevel.INFO) + .service("some-service") + .message("some log message") + .build()) + .map(entity -> repository.save(entity).subscribe()) + .blockLast(); + + Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver + + assertThat(infoLogsCounter.count(), is(7)); + infoLogsCounter.close(); + } +} \ No newline at end of file diff --git a/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/WarnLogsCounterManualTest.java b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/WarnLogsCounterManualTest.java new file mode 100644 index 0000000000..79d94b6784 --- /dev/null +++ b/spring-5-data-reactive/src/test/java/com/baeldung/tailablecursor/service/WarnLogsCounterManualTest.java @@ -0,0 +1,75 @@ +package com.baeldung.tailablecursor.service; + +import com.baeldung.tailablecursor.LogsCounterApplication; +import com.baeldung.tailablecursor.domain.Log; +import com.baeldung.tailablecursor.domain.LogLevel; +import com.baeldung.tailablecursor.repository.LogsRepository; +import lombok.extern.slf4j.Slf4j; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.mongodb.core.CollectionOptions; +import org.springframework.data.mongodb.core.ReactiveMongoTemplate; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Flux; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = LogsCounterApplication.class) +@Slf4j +public class WarnLogsCounterManualTest { + @Autowired + private LogsRepository repository; + + @Autowired + private ReactiveMongoTemplate template; + + @Before + public void setUp() { + createCappedCollectionUsingReactiveMongoTemplate(template); + + persistDocument(Log.builder() + .level(LogLevel.WARN) + .service("Service 1") + .message("Initial Warn message") + .build()); + } + + private void createCappedCollectionUsingReactiveMongoTemplate(ReactiveMongoTemplate reactiveMongoTemplate) { + reactiveMongoTemplate.dropCollection(Log.class).block(); + reactiveMongoTemplate.createCollection(Log.class, CollectionOptions.empty() + .maxDocuments(5) + .size(1024 * 1024L) + .capped()).block(); + } + + private void persistDocument(Log log) { + repository.save(log).block(); + } + + @Test + public void whenWarnLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception { + WarnLogsCounter warnLogsCounter = new WarnLogsCounter(template); + + Thread.sleep(1000L); // wait for initialization + + Flux.range(0,10) + .map(i -> Log.builder() + .level(i > 5 ? LogLevel.WARN : LogLevel.INFO) + .service("some-service") + .message("some log message") + .build()) + .map(entity -> repository.save(entity).subscribe()) + .blockLast(); + + Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver + + assertThat(warnLogsCounter.count(), is(5)); + warnLogsCounter.close(); + } +} \ No newline at end of file From 49bafb030077847d2c30c1d2acaa3d4933111596 Mon Sep 17 00:00:00 2001 From: Kamlesh Kumar Date: Tue, 25 Jun 2019 08:42:34 +0530 Subject: [PATCH 69/70] Code example: Checking If a List Is Sorted in Java (#7139) --- algorithms-miscellaneous-3/pom.xml | 15 ++- .../algorithms/checksortedlist/Employee.java | 34 ++++++ .../checksortedlist/SortedListChecker.java | 85 ++++++++++++++ .../SortedListCheckerUnitTest.java | 106 ++++++++++++++++++ 4 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/Employee.java create mode 100644 algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/SortedListChecker.java create mode 100644 algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/checksortedlist/SortedListCheckerUnitTest.java diff --git a/algorithms-miscellaneous-3/pom.xml b/algorithms-miscellaneous-3/pom.xml index c4017144c8..3cebdd09ac 100644 --- a/algorithms-miscellaneous-3/pom.xml +++ b/algorithms-miscellaneous-3/pom.xml @@ -18,6 +18,18 @@ ${org.assertj.core.version} test + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + + com.google.guava + guava + ${guava.version} + @@ -34,6 +46,7 @@ 3.9.0 + 4.3 + 28.0-jre - \ No newline at end of file diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/Employee.java b/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/Employee.java new file mode 100644 index 0000000000..796932728b --- /dev/null +++ b/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/Employee.java @@ -0,0 +1,34 @@ +package com.baeldung.algorithms.checksortedlist; + +public class Employee { + + long id; + + String name; + + public Employee() { + } + + public Employee(long id, String name) { + super(); + this.id = id; + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/SortedListChecker.java b/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/SortedListChecker.java new file mode 100644 index 0000000000..d2aa159e6d --- /dev/null +++ b/algorithms-miscellaneous-3/src/main/java/com/baeldung/algorithms/checksortedlist/SortedListChecker.java @@ -0,0 +1,85 @@ +package com.baeldung.algorithms.checksortedlist; + +import static org.apache.commons.collections4.CollectionUtils.isEmpty; + +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import com.google.common.collect.Comparators; +import com.google.common.collect.Ordering;; + +public class SortedListChecker { + + private SortedListChecker() { + throw new AssertionError(); + } + + public static boolean checkIfSortedUsingIterativeApproach(List listOfStrings) { + if (isEmpty(listOfStrings) || listOfStrings.size() == 1) { + return true; + } + + Iterator iter = listOfStrings.iterator(); + String current, previous = iter.next(); + while (iter.hasNext()) { + current = iter.next(); + if (previous.compareTo(current) > 0) { + return false; + } + } + return true; + } + + public static boolean checkIfSortedUsingIterativeApproach(List employees, Comparator employeeComparator) { + if (isEmpty(employees) || employees.size() == 1) { + return true; + } + + Iterator iter = employees.iterator(); + Employee current, previous = iter.next(); + while (iter.hasNext()) { + current = iter.next(); + if (employeeComparator.compare(previous, current) > 0) { + return false; + } + } + return true; + } + + public static boolean checkIfSortedUsingRecursion(List listOfStrings) { + return isSortedRecursive(listOfStrings, listOfStrings.size()); + } + + public static boolean isSortedRecursive(List listOfStrings, int index) { + if (index < 2) { + return true; + } else if (listOfStrings.get(index - 2) + .compareTo(listOfStrings.get(index - 1)) > 0) { + return false; + } else { + return isSortedRecursive(listOfStrings, index - 1); + } + } + + public static boolean checkIfSortedUsingOrderingClass(List listOfStrings) { + return Ordering. natural() + .isOrdered(listOfStrings); + } + + public static boolean checkIfSortedUsingOrderingClass(List employees, Comparator employeeComparator) { + return Ordering.from(employeeComparator) + .isOrdered(employees); + } + + public static boolean checkIfSortedUsingOrderingClassHandlingNull(List listOfStrings) { + return Ordering. natural() + .nullsLast() + .isOrdered(listOfStrings); + } + + public static boolean checkIfSortedUsingComparators(List listOfStrings) { + return Comparators.isInOrder(listOfStrings, Comparator. naturalOrder()); + } + +} diff --git a/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/checksortedlist/SortedListCheckerUnitTest.java b/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/checksortedlist/SortedListCheckerUnitTest.java new file mode 100644 index 0000000000..44c4388e6c --- /dev/null +++ b/algorithms-miscellaneous-3/src/test/java/com/baeldung/algorithms/checksortedlist/SortedListCheckerUnitTest.java @@ -0,0 +1,106 @@ +package com.baeldung.algorithms.checksortedlist; + +import static com.baeldung.algorithms.checksortedlist.SortedListChecker.checkIfSortedUsingComparators; +import static com.baeldung.algorithms.checksortedlist.SortedListChecker.checkIfSortedUsingIterativeApproach; +import static com.baeldung.algorithms.checksortedlist.SortedListChecker.checkIfSortedUsingOrderingClass; +import static com.baeldung.algorithms.checksortedlist.SortedListChecker.checkIfSortedUsingRecursion; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +public class SortedListCheckerUnitTest { + + private List sortedListOfString; + private List unsortedListOfString; + private List singletonList; + + private List employeesSortedByName; + private List employeesNotSortedByName; + + @Before + public void setUp() { + sortedListOfString = asList("Canada", "HK", "LA", "NJ", "NY"); + unsortedListOfString = asList("LA", "HK", "NJ", "NY", "Canada"); + singletonList = Collections.singletonList("NY"); + + employeesSortedByName = asList(new Employee(1L, "John"), new Employee(2L, "Kevin"), new Employee(3L, "Mike")); + employeesNotSortedByName = asList(new Employee(1L, "Kevin"), new Employee(2L, "John"), new Employee(3L, "Mike")); + } + + @Test + public void givenSortedList_whenUsingIterativeApproach_thenReturnTrue() { + assertThat(checkIfSortedUsingIterativeApproach(sortedListOfString)).isTrue(); + } + + @Test + public void givenSingleElementList_whenUsingIterativeApproach_thenReturnTrue() { + assertThat(checkIfSortedUsingIterativeApproach(singletonList)).isTrue(); + } + + @Test + public void givenUnsortedList_whenUsingIterativeApproach_thenReturnFalse() { + assertThat(checkIfSortedUsingIterativeApproach(unsortedListOfString)).isFalse(); + } + + @Test + public void givenSortedListOfEmployees_whenUsingIterativeApproach_thenReturnTrue() { + assertThat(checkIfSortedUsingIterativeApproach(employeesSortedByName, Comparator.comparing(Employee::getName))).isTrue(); + } + + @Test + public void givenUnsortedListOfEmployees_whenUsingIterativeApproach_thenReturnFalse() { + assertThat(checkIfSortedUsingIterativeApproach(employeesNotSortedByName, Comparator.comparing(Employee::getName))).isFalse(); + } + + @Test + public void givenSortedList_whenUsingRecursion_thenReturnTrue() { + assertThat(checkIfSortedUsingRecursion(sortedListOfString)).isTrue(); + } + + @Test + public void givenSingleElementList_whenUsingRecursion_thenReturnTrue() { + assertThat(checkIfSortedUsingRecursion(singletonList)).isTrue(); + } + + @Test + public void givenUnsortedList_whenUsingRecursion_thenReturnFalse() { + assertThat(checkIfSortedUsingRecursion(unsortedListOfString)).isFalse(); + } + + @Test + public void givenSortedList_whenUsingGuavaOrdering_thenReturnTrue() { + assertThat(checkIfSortedUsingOrderingClass(sortedListOfString)).isTrue(); + } + + @Test + public void givenUnsortedList_whenUsingGuavaOrdering_thenReturnFalse() { + assertThat(checkIfSortedUsingOrderingClass(unsortedListOfString)).isFalse(); + } + + @Test + public void givenSortedListOfEmployees_whenUsingGuavaOrdering_thenReturnTrue() { + assertThat(checkIfSortedUsingOrderingClass(employeesSortedByName, Comparator.comparing(Employee::getName))).isTrue(); + } + + @Test + public void givenUnsortedListOfEmployees_whenUsingGuavaOrdering_thenReturnFalse() { + assertThat(checkIfSortedUsingOrderingClass(employeesNotSortedByName, Comparator.comparing(Employee::getName))).isFalse(); + } + + @Test + public void givenSortedList_whenUsingGuavaComparators_thenReturnTrue() { + assertThat(checkIfSortedUsingComparators(sortedListOfString)).isTrue(); + } + + @Test + public void givenUnsortedList_whenUsingGuavaComparators_thenReturnFalse() { + assertThat(checkIfSortedUsingComparators(unsortedListOfString)).isFalse(); + } + +} From 8470ca7c5b096b77609f8a8cb06efc873bcf6d10 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 25 Jun 2019 06:07:26 +0200 Subject: [PATCH 70/70] BAEL-2926 Guide to @EnableConfigurationProperties (#7186) --- .../properties/AdditionalConfiguration.java | 14 ++++++++++ .../properties/AdditionalProperties.java | 26 +++++++++++++++++++ .../ConfigPropertiesDemoApplication.java | 7 +++-- .../ConfigPropertiesIntegrationTest.java | 10 +++++++ .../resources/configprops-test.properties | 4 +++ 5 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 spring-boot/src/main/java/org/baeldung/properties/AdditionalConfiguration.java create mode 100644 spring-boot/src/main/java/org/baeldung/properties/AdditionalProperties.java diff --git a/spring-boot/src/main/java/org/baeldung/properties/AdditionalConfiguration.java b/spring-boot/src/main/java/org/baeldung/properties/AdditionalConfiguration.java new file mode 100644 index 0000000000..499666c143 --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/properties/AdditionalConfiguration.java @@ -0,0 +1,14 @@ +package org.baeldung.properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableConfigurationProperties(AdditionalProperties.class) +public class AdditionalConfiguration { + + @Autowired + private AdditionalProperties additionalProperties; + +} diff --git a/spring-boot/src/main/java/org/baeldung/properties/AdditionalProperties.java b/spring-boot/src/main/java/org/baeldung/properties/AdditionalProperties.java new file mode 100644 index 0000000000..64e39b1475 --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/properties/AdditionalProperties.java @@ -0,0 +1,26 @@ +package org.baeldung.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "additional") +public class AdditionalProperties { + + private String unit; + private int max; + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public int getMax() { + return max; + } + + public void setMax(int max) { + this.max = max; + } +} diff --git a/spring-boot/src/main/java/org/baeldung/properties/ConfigPropertiesDemoApplication.java b/spring-boot/src/main/java/org/baeldung/properties/ConfigPropertiesDemoApplication.java index 395d68060b..7b8f2c3411 100644 --- a/spring-boot/src/main/java/org/baeldung/properties/ConfigPropertiesDemoApplication.java +++ b/spring-boot/src/main/java/org/baeldung/properties/ConfigPropertiesDemoApplication.java @@ -5,11 +5,14 @@ import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@ComponentScan(basePackageClasses = { ConfigProperties.class, JsonProperties.class, CustomJsonProperties.class }) +@ComponentScan(basePackageClasses = {ConfigProperties.class, + JsonProperties.class, + CustomJsonProperties.class, + AdditionalConfiguration.class}) public class ConfigPropertiesDemoApplication { public static void main(String[] args) { new SpringApplicationBuilder(ConfigPropertiesDemoApplication.class).initializers(new JsonPropertyContextInitializer()) - .run(); + .run(); } } diff --git a/spring-boot/src/test/java/com/baeldung/properties/ConfigPropertiesIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/properties/ConfigPropertiesIntegrationTest.java index 3a4b6551b1..8f07b2da35 100644 --- a/spring-boot/src/test/java/com/baeldung/properties/ConfigPropertiesIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/properties/ConfigPropertiesIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.properties; +import org.baeldung.properties.AdditionalProperties; import org.baeldung.properties.ConfigProperties; import org.baeldung.properties.ConfigPropertiesDemoApplication; import org.junit.Assert; @@ -18,6 +19,9 @@ public class ConfigPropertiesIntegrationTest { @Autowired private ConfigProperties properties; + @Autowired + private AdditionalProperties additionalProperties; + @Test public void whenSimplePropertyQueriedthenReturnsProperty() throws Exception { Assert.assertTrue("From address is read as null!", properties.getFrom() != null); @@ -42,4 +46,10 @@ public class ConfigPropertiesIntegrationTest { Assert.assertTrue("Incorrectly bound object property!", properties.getCredentials().getUsername().equals("john")); Assert.assertTrue("Incorrectly bound object property!", properties.getCredentials().getPassword().equals("password")); } + + @Test + public void whenAdditionalPropertyQueriedthenReturnsProperty() { + Assert.assertTrue(additionalProperties.getUnit().equals("km")); + Assert.assertTrue(additionalProperties.getMax() == 100); + } } diff --git a/spring-boot/src/test/resources/configprops-test.properties b/spring-boot/src/test/resources/configprops-test.properties index ea11f2159e..5eed93a22b 100644 --- a/spring-boot/src/test/resources/configprops-test.properties +++ b/spring-boot/src/test/resources/configprops-test.properties @@ -20,3 +20,7 @@ mail.credentials.authMethod=SHA1 #Bean method properties item.name=Test item name item.size=21 + +#Additional properties +additional.unit=km +additional.max=100