From 1203bb5d692e1c694366cc3e7f985587201b5512 Mon Sep 17 00:00:00 2001 From: Kevin Gilmore Date: Sat, 2 Jul 2016 20:20:49 -0500 Subject: [PATCH 01/32] Couchbase SDK Intro Tutorial --- couchbase-sdk-intro/.classpath | 31 +++ .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 49502 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + couchbase-sdk-intro/.project | 23 ++ couchbase-sdk-intro/mvnw | 233 ++++++++++++++++++ couchbase-sdk-intro/mvnw.cmd | 145 +++++++++++ couchbase-sdk-intro/pom.xml | 40 +++ .../couchbase/examples/CodeSnippets.java | 96 ++++++++ 8 files changed, 569 insertions(+) create mode 100644 couchbase-sdk-intro/.classpath create mode 100644 couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.jar create mode 100644 couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.properties create mode 100644 couchbase-sdk-intro/.project create mode 100755 couchbase-sdk-intro/mvnw create mode 100644 couchbase-sdk-intro/mvnw.cmd create mode 100644 couchbase-sdk-intro/pom.xml create mode 100644 couchbase-sdk-intro/src/main/java/com/baeldung/couchbase/examples/CodeSnippets.java diff --git a/couchbase-sdk-intro/.classpath b/couchbase-sdk-intro/.classpath new file mode 100644 index 0000000000..698778fef3 --- /dev/null +++ b/couchbase-sdk-intro/.classpath @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.jar b/couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5fd4d5023f1463b5ba3970e33c460c1eb26d748d GIT binary patch literal 49502 zcmb@tV|1n6wzeBvGe*U>ZQHh;%-Bg)Y}={WHY%yuwkkF%MnzxVwRUS~wY|@J_gP;% z^VfXZ{5793?z><89(^dufT2xlYVOQnYG>@?lA@vQF|UF0&X7tk8BUf?wq2J& zZe&>>paKUg4@;fwk0yeUPvM$y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W`1+jPPicN} zhgOBZJau)7R=(j9e&@_!Y{d>iX#+|6|i>`&Q={(}Kji+O zpFcjFOMd9Ss|3O?C362PVeDvZY6)PztKhZE=cg?HTJXn${I25H4xgVwR(eM*+@Z8Irh^0H1^@(vM%fLB8x9<0IcS*cf20Th OJOEd-=rxTO#Qy`$*1Hh^ literal 0 HcmV?d00001 diff --git a/couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.properties b/couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..eb91947648 --- /dev/null +++ b/couchbase-sdk-intro/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip \ No newline at end of file diff --git a/couchbase-sdk-intro/.project b/couchbase-sdk-intro/.project new file mode 100644 index 0000000000..b5b2a86ff9 --- /dev/null +++ b/couchbase-sdk-intro/.project @@ -0,0 +1,23 @@ + + + couchbase-intro + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/couchbase-sdk-intro/mvnw b/couchbase-sdk-intro/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/couchbase-sdk-intro/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# http://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + 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 Migwn, 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 + +# 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"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +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} "$@" diff --git a/couchbase-sdk-intro/mvnw.cmd b/couchbase-sdk-intro/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/couchbase-sdk-intro/mvnw.cmd @@ -0,0 +1,145 @@ +@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 http://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 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 + +set MAVEN_CMD_LINE_ARGS=%* + +@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="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +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% \ No newline at end of file diff --git a/couchbase-sdk-intro/pom.xml b/couchbase-sdk-intro/pom.xml new file mode 100644 index 0000000000..1c2ca5ee05 --- /dev/null +++ b/couchbase-sdk-intro/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + com.baeldung + couchbase-sdk-intro + 0.1-SNAPSHOT + jar + couchbase-sdk-intro + Intro to the Couchbase SDK + + + + + com.couchbase.client + java-client + ${couchbase.client.version} + + + + + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + + + + 1.7 + UTF-8 + 2.2.6 + + + diff --git a/couchbase-sdk-intro/src/main/java/com/baeldung/couchbase/examples/CodeSnippets.java b/couchbase-sdk-intro/src/main/java/com/baeldung/couchbase/examples/CodeSnippets.java new file mode 100644 index 0000000000..088f7af7b1 --- /dev/null +++ b/couchbase-sdk-intro/src/main/java/com/baeldung/couchbase/examples/CodeSnippets.java @@ -0,0 +1,96 @@ +package com.baeldung.couchbase.examples; + +import java.util.List; +import java.util.UUID; + +import com.couchbase.client.core.CouchbaseException; +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.CouchbaseCluster; +import com.couchbase.client.java.ReplicaMode; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.document.json.JsonObject; +import com.couchbase.client.java.env.CouchbaseEnvironment; +import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; + +public class CodeSnippets { + + static Cluster loadClusterWithDefaultEnvironment() { + return CouchbaseCluster.create("localhost"); + } + + static Cluster loadClusterWithCustomEnvironment() { + CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder() + .connectTimeout(10000) + .kvTimeout(3000) + .build(); + return CouchbaseCluster.create(env, "localhost"); + } + + static Bucket loadDefaultBucketWithBlankPassword(Cluster cluster) { + return cluster.openBucket(); + } + + static Bucket loadBaeldungBucket(Cluster cluster) { + return cluster.openBucket("baeldung", ""); + } + + static JsonDocument insertExample(Bucket bucket) { + JsonObject content = JsonObject.empty() + .put("name", "John Doe") + .put("type", "Person") + .put("email", "john.doe@mydomain.com") + .put("homeTown", "Chicago") + ; + String id = UUID.randomUUID().toString(); + JsonDocument document = JsonDocument.create(id, content); + JsonDocument inserted = bucket.insert(document); + return inserted; + } + + static JsonDocument retrieveAndUpsertExample(Bucket bucket, String id) { + JsonDocument document = bucket.get(id); + JsonObject content = document.content(); + content.put("homeTown", "Kansas City"); + JsonDocument upserted = bucket.upsert(document); + return upserted; + } + + static JsonDocument replaceExample(Bucket bucket, String id) { + JsonDocument document = bucket.get(id); + JsonObject content = document.content(); + content.put("homeTown", "Milwaukee"); + JsonDocument replaced = bucket.replace(document); + return replaced; + } + + static JsonDocument removeExample(Bucket bucket, String id) { + JsonDocument removed = bucket.remove(id); + return removed; + } + + static JsonDocument getFirstFromReplicaExample(Bucket bucket, String id) { + try{ + return bucket.get(id); + } + catch(CouchbaseException e) { + List list = bucket.getFromReplica(id, ReplicaMode.FIRST); + if(!list.isEmpty()) { + return list.get(0); + } + } + return null; + } + + static JsonDocument getLatestReplicaVersion(Bucket bucket, String id) { + long maxCasValue = -1; + JsonDocument latest = null; + for(JsonDocument replica : bucket.getFromReplica(id, ReplicaMode.ALL)) { + if(replica.cas() > maxCasValue) { + latest = replica; + maxCasValue = replica.cas(); + } + } + return latest; + } +} From 69bd36adb2155b667800d0e691572c0fb35e9e37 Mon Sep 17 00:00:00 2001 From: Zeger Hendrikse Date: Fri, 8 Jul 2016 13:35:45 +0200 Subject: [PATCH 02/32] Replaced tabs by spaces --- redis/pom.xml | 62 +++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/redis/pom.xml b/redis/pom.xml index 98775b7e13..72f8268a80 100644 --- a/redis/pom.xml +++ b/redis/pom.xml @@ -1,41 +1,41 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - 4.0.0 - com.baeldung - redis - 0.1-SNAPSHOT + 4.0.0 + com.baeldung + redis + 0.1-SNAPSHOT - redis - http://maven.apache.org + redis + http://maven.apache.org - - - redis.clients - jedis - 2.8.1 - + + + redis.clients + jedis + 2.8.1 + - - com.github.kstyrc - embedded-redis - 0.6 - + + com.github.kstyrc + embedded-redis + 0.6 + - - junit - junit - ${junit.version} - test - - + + junit + junit + ${junit.version} + test + + - - UTF-8 + + UTF-8 - - 4.12 - + + 4.12 + From abf570a80b93c5e959ef3b3990a8e0321ac17166 Mon Sep 17 00:00:00 2001 From: Zeger Hendrikse Date: Fri, 8 Jul 2016 23:30:35 +0200 Subject: [PATCH 03/32] Removed tabs --- apache-cxf/pom.xml | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index 7732490576..41ae75a1de 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,40 +1,40 @@ - 4.0.0 - com.baeldung - apache-cxf - 0.0.1-SNAPSHOT - pom - - cxf-introduction - - - - junit - junit - 4.12 - test - - - - install - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - org.codehaus.mojo - exec-maven-plugin - 1.5.0 - - - - - \ No newline at end of file + 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 + apache-cxf + 0.0.1-SNAPSHOT + pom + + cxf-introduction + + + + junit + junit + 4.12 + test + + + + install + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.codehaus.mojo + exec-maven-plugin + 1.5.0 + + + + + From 5bfb12d09101951c668ba8cbc82d6eee10aa49c8 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 13 Jul 2016 02:02:56 +0300 Subject: [PATCH 04/32] Remove unnecessary file --- core-java-8/.project | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 core-java-8/.project diff --git a/core-java-8/.project b/core-java-8/.project deleted file mode 100644 index a23ff42ae0..0000000000 --- a/core-java-8/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - core-java8 - - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - - From e93772ae605aabfeb95efc86ad7c1ff465e8f433 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 13 Jul 2016 02:13:26 +0300 Subject: [PATCH 05/32] TDD --- core-java-8/pom.xml | 3 +- .../collectors/Java8CollectorsTest.java | 76 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index 8c9bb36f7d..63df0e1b95 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -66,7 +66,8 @@ org.assertj assertj-core - 3.4.1 + 3.5.1 + test diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java new file mode 100644 index 0000000000..bfcdf27a9c --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java @@ -0,0 +1,76 @@ +package com.baeldung.collectors; + +import org.junit.Test; + +public class Java8CollectorsTest { + + @Test + public void whenCollectingToList_shouldCollectToList() throws Exception { + + } + + @Test + public void whenCollectingToList_shouldCollectToSet() throws Exception { + + } + + @Test + public void whenCollectingToCollection_shouldCollectToCollection() throws Exception { + + } + + @Test + public void whenCollectingToImmutableCollection_shouldThrowException() throws Exception { + + } + + @Test + public void whenCollectingToMap_shouldCollectToMap() throws Exception { + + } + + @Test + public void whenCollectingAndThen_shouldCollect() throws Exception { + + } + + @Test + public void whenJoining_shouldJoin() throws Exception { + + } + + @Test + public void whenPartitioningBy_shouldPartition() throws Exception { + + } + + @Test + public void whenCounting_shouldCount() throws Exception { + + } + + @Test + public void whenSummarizing_shouldSummarize() throws Exception { + + } + + @Test + public void whenAveraging_shouldAverage() throws Exception { + + } + + @Test + public void whenSumming_shouldSum() throws Exception { + + } + + @Test + public void whenMaxingBy_shouldMaxBy() throws Exception { + + } + + @Test + public void whenCreatingCustomCollector_shouldCollect() throws Exception { + + } +} From 2d0f3b2c7d491117d878c701519f48665dd4be97 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 13 Jul 2016 09:28:36 +0300 Subject: [PATCH 06/32] Add Java8 Collectors examples --- .../collectors/Java8CollectorsTest.java | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java index bfcdf27a9c..11699463d5 100644 --- a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java +++ b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java @@ -1,76 +1,300 @@ package com.baeldung.collectors; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import org.junit.Test; +import java.util.Arrays; +import java.util.Comparator; +import java.util.DoubleSummaryStatistics; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.BinaryOperator; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collector; + +import static com.google.common.collect.Sets.newHashSet; +import static java.util.stream.Collectors.averagingDouble; +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.counting; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.maxBy; +import static java.util.stream.Collectors.partitioningBy; +import static java.util.stream.Collectors.summarizingDouble; +import static java.util.stream.Collectors.summingDouble; +import static java.util.stream.Collectors.toCollection; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; +import static java.util.stream.Collectors.toSet; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + public class Java8CollectorsTest { @Test public void whenCollectingToList_shouldCollectToList() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final List result = givenList.stream() + .collect(toList()); + + assertThat(result) + .containsAll(givenList); } @Test public void whenCollectingToList_shouldCollectToSet() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final Set result = givenList.stream() + .collect(toSet()); + + assertThat(result) + .containsAll(givenList); } @Test public void whenCollectingToCollection_shouldCollectToCollection() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final List result = givenList.stream() + .collect(toCollection(LinkedList::new)); + + assertThat(result) + .containsAll(givenList) + .isInstanceOf(LinkedList.class); } @Test public void whenCollectingToImmutableCollection_shouldThrowException() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + + assertThatThrownBy(() -> { + givenList.stream() + .collect(toCollection(ImmutableList::of)); + }).isInstanceOf(UnsupportedOperationException.class); } @Test public void whenCollectingToMap_shouldCollectToMap() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final Map result = givenList.stream() + .collect(toMap(Function.identity(), String::length)); + + assertThat(result) + .containsEntry("a", 1) + .containsEntry("bb", 2) + .containsEntry("ccc", 3) + .containsEntry("dddd", 4); + } + + @Test + public void whenCollectingToMap_shouldCollectToMapMerging() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + + final Map result = givenList.stream() + .collect(toMap(Function.identity(), String::length, (i1, i2) -> i1)); + + assertThat(result) + .containsEntry("a", 1) + .containsEntry("bb", 2) + .containsEntry("ccc", 3) + .containsEntry("dddd", 4); } @Test public void whenCollectingAndThen_shouldCollect() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final List result = givenList.stream() + .collect(collectingAndThen(toList(), ImmutableList::copyOf)); + + assertThat(result) + .containsAll(givenList) + .isInstanceOf(ImmutableList.class); } @Test public void whenJoining_shouldJoin() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final String result = givenList.stream() + .collect(joining()); + + assertThat(result) + .isEqualTo("abbcccdddd"); + } + + @Test + public void whenJoiningWithSeparator_shouldJoinWithSeparator() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + + final String result = givenList.stream() + .collect(joining(" ")); + + assertThat(result) + .isEqualTo("a bb ccc dddd"); + } + + @Test + public void whenJoiningWithSeparatorAndPrefixAndPostfix_shouldJoinWithSeparatorPrePost() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + + final String result = givenList.stream() + .collect(joining(" ", "PRE-", "-POST")); + + assertThat(result) + .isEqualTo("PRE-a bb ccc dddd-POST"); } @Test public void whenPartitioningBy_shouldPartition() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final Map> result = givenList.stream() + .collect(partitioningBy(s -> s.length() > 2)); + + assertThat(result) + .containsKeys(true, false) + .satisfies(booleanListMap -> { + assertThat(booleanListMap.get(true)) + .contains("ccc", "dddd"); + + assertThat(booleanListMap.get(false)) + .contains("a", "bb"); + }); } @Test public void whenCounting_shouldCount() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final Long result = givenList.stream() + .collect(counting()); + + assertThat(result) + .isEqualTo(4); } @Test public void whenSummarizing_shouldSummarize() throws Exception { + final List givenList = Arrays.asList(1d, 2d, 3d, 2d); + final DoubleSummaryStatistics result = givenList.stream() + .collect(summarizingDouble(d -> d)); + + assertThat(result.getAverage()) + .isEqualTo(2); + assertThat(result.getCount()) + .isEqualTo(4); + assertThat(result.getMax()) + .isEqualTo(3); + assertThat(result.getMin()) + .isEqualTo(1); + assertThat(result.getSum()) + .isEqualTo(8); } @Test public void whenAveraging_shouldAverage() throws Exception { + final List givenList = Arrays.asList(1d, 2d, 3d, 2d); + final Double result = givenList.stream() + .collect(averagingDouble(d -> d)); + + assertThat(result) + .isEqualTo(2); } @Test public void whenSumming_shouldSum() throws Exception { + final List givenList = Arrays.asList(1d, 2d, 3d, 2d); + final Double result = givenList.stream() + .collect(summingDouble(d -> d)); + + assertThat(result) + .isEqualTo(8); } @Test public void whenMaxingBy_shouldMaxBy() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + final Optional result = givenList.stream() + .collect(maxBy(Comparator.naturalOrder())); + + assertThat(result) + .isPresent() + .hasValue("dddd"); } + @Test + public void whenGroupingBy_shouldGroupBy() throws Exception { + final List givenList = Arrays.asList("a", "b", "bb", "ccc", "dddd"); + + final Map> result = givenList.stream() + .collect(groupingBy(String::length, toSet())); + + assertThat(result) + .containsEntry(1, newHashSet("a", "b")) + .containsEntry(2, newHashSet("bb")) + .containsEntry(3, newHashSet("ccc")) + .containsEntry(4, newHashSet("dddd")); + } + + @Test public void whenCreatingCustomCollector_shouldCollect() throws Exception { + final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); + + final ImmutableSet result = givenList.stream() + .collect(toImmutableSet()); + + assertThat(result) + .isInstanceOf(ImmutableSet.class) + .contains("a", "bb", "ccc", "dddd"); } + + private static ImmutableSetCollector toImmutableSet() { + return new ImmutableSetCollector<>(); + } + + private static class ImmutableSetCollector implements Collector, ImmutableSet> { + + @Override + public Supplier> supplier() { + return ImmutableSet::builder; + } + + @Override + public BiConsumer, T> accumulator() { + return ImmutableSet.Builder::add; + } + + @Override + public BinaryOperator> combiner() { + return (left, right) -> left.addAll(right.build()); + } + + @Override + public Function, ImmutableSet> finisher() { + return ImmutableSet.Builder::build; + } + + @Override + public Set characteristics() { + return Sets.immutableEnumSet(Characteristics.UNORDERED); + } + } } From fca98463d40a41e8c76de83c25977ed315214f2a Mon Sep 17 00:00:00 2001 From: Kevin Gilmore Date: Wed, 13 Jul 2016 19:53:08 -0500 Subject: [PATCH 07/32] BAEL-201: Using Couchbase SDK in a Spring Application --- .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 49502 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + couchbase-sdk-spring-service/.springBeans | 15 ++ couchbase-sdk-spring-service/mvnw | 233 ++++++++++++++++++ couchbase-sdk-spring-service/mvnw.cmd | 145 +++++++++++ couchbase-sdk-spring-service/pom.xml | 102 ++++++++ .../person/FluentPersonDocumentConverter.java | 31 +++ .../com/baeldung/couchbase/person/Person.java | 85 +++++++ .../couchbase/person/PersonCrudService.java | 68 +++++ .../person/PersonDocumentConverter.java | 31 +++ .../couchbase/person/RegistrationService.java | 29 +++ .../couchbase/service/BucketService.java | 9 + .../couchbase/service/ClusterService.java | 17 ++ .../couchbase/service/ClusterServiceImpl.java | 84 +++++++ .../couchbase/service/CrudService.java | 16 ++ .../service/JsonDocumentConverter.java | 10 + .../service/TutorialBucketService.java | 29 +++ .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 17 ++ .../baeldung/couchbase/IntegrationTest.java | 13 + .../couchbase/IntegrationTestConfig.java | 9 + .../person/PersonCrudServiceTest.java | 82 ++++++ .../couchbase/service/ClusterServiceTest.java | 34 +++ 23 files changed, 1060 insertions(+) create mode 100644 couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.jar create mode 100644 couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.properties create mode 100644 couchbase-sdk-spring-service/.springBeans create mode 100755 couchbase-sdk-spring-service/mvnw create mode 100644 couchbase-sdk-spring-service/mvnw.cmd create mode 100644 couchbase-sdk-spring-service/pom.xml create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/FluentPersonDocumentConverter.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/Person.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonCrudService.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonDocumentConverter.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/RegistrationService.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/BucketService.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterService.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterServiceImpl.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/CrudService.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/JsonDocumentConverter.java create mode 100644 couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/TutorialBucketService.java create mode 100644 couchbase-sdk-spring-service/src/main/resources/application.properties create mode 100644 couchbase-sdk-spring-service/src/main/resources/logback.xml create mode 100644 couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTest.java create mode 100644 couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTestConfig.java create mode 100644 couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/person/PersonCrudServiceTest.java create mode 100644 couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/service/ClusterServiceTest.java diff --git a/couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.jar b/couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5fd4d5023f1463b5ba3970e33c460c1eb26d748d GIT binary patch literal 49502 zcmb@tV|1n6wzeBvGe*U>ZQHh;%-Bg)Y}={WHY%yuwkkF%MnzxVwRUS~wY|@J_gP;% z^VfXZ{5793?z><89(^dufT2xlYVOQnYG>@?lA@vQF|UF0&X7tk8BUf?wq2J& zZe&>>paKUg4@;fwk0yeUPvM$yk)=f>TSFFB^a8f|_@mbE#MaBnd5qf6;hXq}c%IeK zn7gB0Kldbedq-vl@2wxJi{$%lufroKUjQLSFmt|<;M8~<5otM5ur#Dgc@ivmwRiYZW(Oco7kb8DWmo|a{coqYMU2raB9r6e9viK6MI3c&%jp05-Tf*O#6@8Ra=egYy01 z-V!G;_omANEvU-8!*>*)lWka9M<+IkNsrsenbXOfLc6qrYe`;lpst;vfs*70$z9UM zq%L>pFCOr$X*|9&3L2h;?VA9-IU*iR6FiGlJ=b~DzE5s^thxXUs4%~*zD#K&k>wZAU8 zpaa!M+Z-zjkfGK15N!&o<3=cgbZV7%ex@j^)Q9V`q^i;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yN(KE{v8Flf2F|VM_l1=DI&Z}(RBvZ-?=MJurdV+bx}qc zMM>r#Mp-#9xf(Dlj7$ur%9-=K=m+1QT9ro_U?#&Wv%M{`+o5WT)8b>jv9 z{(W;{+`KsjQAHU^2{m;l1<5DCcK8k!lt%~8FU9>xGEa>%xpxcvNwk|}rEBVH6gs&y zcc%2{>C}&E29pz0OWd`^u-ES8cTVPzX`)(qt=d?&K@&=Rotx78SlqgrEVG_qUo)_mC$8U`F#qlHOCD&RSroexT?YJLzvne^0W z@;=|QRR6AVW@n3W0fEJOGM5gbEhzW#FFa{0FL+k>kgt~r3DnajgxZvn2mk*LWvgsJNdYFw~S!X4cFe+Q;Q-_W%N z9+%cg5D+rIfU$v>NB;`!-|$Y|w(+s#2VpgER|yU}|IL~d1DHEF1OAnnMj?dmwqP?|!Tm)27hExl-^LX;b^(CT z!UODGtX!?!0czl=9(xOLEjt>6{g40iN!)JVBc;&q!{D7LBTNX0>kPC%g@yXJ??CR3 z^oF;AH}dO}OTni1fx&;Ra!+t5|8G{gf|ZL4*w`O!41NfJAE&N>zi#R(&V#)+FzyN% z_g90{z|?BLiTfv@hp{u@$1u7B_-1N#iJ#RBzM2BR!2c8QKQ->n9NpJB+kXlz_@(`y zApg-W%GVs=-$=u6Jp_Mfr34rf;5=qxnT`lG`0>Z&B#n)_ODW`1+jPPicN} zhgOBZJau)7R=(j9e&@_!Y{d>iX#+|6|i>`&Q={(}Kji+O zpFcjFOMd9Ss|3O?C362PVeDvZY6)PztKhZE=cg?HTJXn${I25H4xgVwR(eM*+@Z8Irh^0H1^@(vM%fLB8x9<0IcS*cf20Th OJOEd-=rxTO#Qy`$*1Hh^ literal 0 HcmV?d00001 diff --git a/couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.properties b/couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..eb91947648 --- /dev/null +++ b/couchbase-sdk-spring-service/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip \ No newline at end of file diff --git a/couchbase-sdk-spring-service/.springBeans b/couchbase-sdk-spring-service/.springBeans new file mode 100644 index 0000000000..ff32b84d3b --- /dev/null +++ b/couchbase-sdk-spring-service/.springBeans @@ -0,0 +1,15 @@ + + + 1 + + + + + + + + + + + + diff --git a/couchbase-sdk-spring-service/mvnw b/couchbase-sdk-spring-service/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/couchbase-sdk-spring-service/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# http://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + 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 Migwn, 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 + +# 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"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +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} "$@" diff --git a/couchbase-sdk-spring-service/mvnw.cmd b/couchbase-sdk-spring-service/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/couchbase-sdk-spring-service/mvnw.cmd @@ -0,0 +1,145 @@ +@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 http://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 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 + +set MAVEN_CMD_LINE_ARGS=%* + +@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="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +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% \ No newline at end of file diff --git a/couchbase-sdk-spring-service/pom.xml b/couchbase-sdk-spring-service/pom.xml new file mode 100644 index 0000000000..d344f8c756 --- /dev/null +++ b/couchbase-sdk-spring-service/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + com.baeldung + couchbase-sdk-spring-service + 0.1-SNAPSHOT + jar + couchbase-sdk-spring-service + Intro to the Couchbase SDK + + + + + com.couchbase.client + java-client + ${couchbase.client.version} + + + + + org.springframework + spring-context + ${spring-framework.version} + + + org.springframework + spring-context-support + ${spring-framework.version} + + + + + org.slf4j + slf4j-api + ${org.slf4j.version} + compile + + + ch.qos.logback + logback-classic + ${logback.version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + + org.springframework + spring-test + ${spring-framework.version} + test + + + junit + junit + ${junit.version} + test + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + test + + + + + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + + + + 1.7 + UTF-8 + 2.2.6 + 4.2.4.RELEASE + 1.1.3 + 1.7.12 + 4.11 + 3.4 + + + diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/FluentPersonDocumentConverter.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/FluentPersonDocumentConverter.java new file mode 100644 index 0000000000..8210c10b3a --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/FluentPersonDocumentConverter.java @@ -0,0 +1,31 @@ +package com.baeldung.couchbase.person; + +import org.springframework.stereotype.Service; + +import com.baeldung.couchbase.service.JsonDocumentConverter; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.document.json.JsonObject; + +@Service +public class FluentPersonDocumentConverter implements JsonDocumentConverter { + + @Override + public JsonDocument toDocument(Person p) { + JsonObject content = JsonObject.empty() + .put("type", "Person") + .put("name", p.getName()) + .put("homeTown", p.getHomeTown()); + return JsonDocument.create(p.getId(), content); + } + + @Override + public Person fromDocument(JsonDocument doc) { + JsonObject content = doc.content(); + return Person.Builder.newInstance() + .id(doc.id()) + .type("Person") + .name(content.getString("name")) + .homeTown(content.getString("homeTown")) + .build(); + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/Person.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/Person.java new file mode 100644 index 0000000000..48b7a38780 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/Person.java @@ -0,0 +1,85 @@ +package com.baeldung.couchbase.person; + +public class Person { + + private String id; + private String type; + private String name; + private String homeTown; + + Person() {} + + public Person(Builder b) { + this.id = b.id; + this.type = b.type; + this.name = b.name; + this.homeTown = b.homeTown; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getHomeTown() { + return homeTown; + } + + public void setHomeTown(String homeTown) { + this.homeTown = homeTown; + } + + public static class Builder { + private String id; + private String type; + private String name; + private String homeTown; + + public static Builder newInstance() { + return new Builder(); + } + + public Person build() { + return new Person(this); + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder homeTown(String homeTown) { + this.homeTown = homeTown; + return this; + } + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonCrudService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonCrudService.java new file mode 100644 index 0000000000..0203bf30bb --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonCrudService.java @@ -0,0 +1,68 @@ +package com.baeldung.couchbase.person; + +import java.util.List; +import java.util.UUID; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.couchbase.service.CrudService; +import com.baeldung.couchbase.service.TutorialBucketService;import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.ReplicaMode; +import com.couchbase.client.java.document.JsonDocument; + +@Service +public class PersonCrudService implements CrudService { + + @Autowired + private TutorialBucketService bucketService; + + @Autowired + private PersonDocumentConverter converter; + + private Bucket bucket; + + @PostConstruct + private void init() { + bucket = bucketService.getBucket(); + } + + @Override + public void create(Person person) { + if(person.getId() == null) { + person.setId(UUID.randomUUID().toString()); + } + JsonDocument document = converter.toDocument(person); + bucket.insert(document); + } + + @Override + public Person read(String id) { + JsonDocument doc = bucket.get(id); + return (doc != null ? converter.fromDocument(doc) : null); + } + + @Override + public Person readFromReplica(String id) { + List docs = bucket.getFromReplica(id, ReplicaMode.FIRST); + return (docs.isEmpty() ? null : converter.fromDocument(docs.get(0))); + } + + @Override + public void update(Person person) { + JsonDocument document = converter.toDocument(person); + bucket.upsert(document); + } + + @Override + public void delete(String id) { + bucket.remove(id); + } + + @Override + public boolean exists(String id) { + return bucket.exists(id); + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonDocumentConverter.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonDocumentConverter.java new file mode 100644 index 0000000000..cfb20a2bfb --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/PersonDocumentConverter.java @@ -0,0 +1,31 @@ +package com.baeldung.couchbase.person; + +import org.springframework.stereotype.Service; + +import com.baeldung.couchbase.service.JsonDocumentConverter; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.document.json.JsonObject; + +@Service +public class PersonDocumentConverter implements JsonDocumentConverter { + + @Override + public JsonDocument toDocument(Person p) { + JsonObject content = JsonObject.empty() + .put("type", "Person") + .put("name", p.getName()) + .put("homeTown", p.getHomeTown()); + return JsonDocument.create(p.getId(), content); + } + + @Override + public Person fromDocument(JsonDocument doc) { + JsonObject content = doc.content(); + Person p = new Person(); + p.setId(doc.id()); + p.setType("Person"); + p.setName(content.getString("name")); + p.setHomeTown(content.getString("homeTown")); + return p; + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/RegistrationService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/RegistrationService.java new file mode 100644 index 0000000000..53af1c4041 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/person/RegistrationService.java @@ -0,0 +1,29 @@ +package com.baeldung.couchbase.person; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.couchbase.client.core.CouchbaseException; + +@Service +public class RegistrationService { + + @Autowired + private PersonCrudService crud; + + public void registerNewPerson(String name, String homeTown) { + Person person = new Person(); + person.setName(name); + person.setHomeTown(homeTown); + crud.create(person); + } + + public Person findRegistrant(String id) { + try{ + return crud.read(id); + } + catch(CouchbaseException e) { + return crud.readFromReplica(id); + } + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/BucketService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/BucketService.java new file mode 100644 index 0000000000..c2562dd38e --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/BucketService.java @@ -0,0 +1,9 @@ +package com.baeldung.couchbase.service; + +import com.couchbase.client.java.Bucket; + +public interface BucketService { + + Bucket getBucket(); + +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterService.java new file mode 100644 index 0000000000..4713893899 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterService.java @@ -0,0 +1,17 @@ +package com.baeldung.couchbase.service; + +import java.util.List; + +import com.couchbase.client.java.AsyncBucket; +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.document.JsonDocument; + +public interface ClusterService { + + Bucket openBucket(String name, String password); + + List getDocuments(Bucket bucket, Iterable keys); + + List getDocumentsAsync(AsyncBucket bucket, Iterable keys); + +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterServiceImpl.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterServiceImpl.java new file mode 100644 index 0000000000..3c355d2a27 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/ClusterServiceImpl.java @@ -0,0 +1,84 @@ +package com.baeldung.couchbase.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import javax.annotation.PostConstruct; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.couchbase.client.java.AsyncBucket; +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.CouchbaseCluster; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.env.CouchbaseEnvironment; +import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; + +import rx.Observable; +import rx.functions.Action1; +import rx.functions.Func1; + +@Service +public class ClusterServiceImpl implements ClusterService { + private static final Logger logger = LoggerFactory.getLogger(ClusterServiceImpl.class); + + private Cluster cluster; + private Map buckets = new ConcurrentHashMap<>(); + + @PostConstruct + private void init() { + CouchbaseEnvironment env = DefaultCouchbaseEnvironment.create(); + cluster = CouchbaseCluster.create(env, "localhost"); + } + + @Override + synchronized public Bucket openBucket(String name, String password) { + if(!buckets.containsKey(name)) { + Bucket bucket = cluster.openBucket(name, password); + buckets.put(name, bucket); + } + return buckets.get(name); + } + + @Override + public List getDocuments(Bucket bucket, Iterable keys) { + List docs = new ArrayList<>(); + for(String key : keys) { + JsonDocument doc = bucket.get(key); + if(doc != null) { + docs.add(doc); + } + } + return docs; + } + + @Override + public List getDocumentsAsync(final AsyncBucket asyncBucket, Iterable keys) { + Observable asyncBulkGet = Observable + .from(keys) + .flatMap(new Func1>() { + public Observable call(String key) { + return asyncBucket.get(key); + } + }); + + final List docs = new ArrayList<>(); + try { + asyncBulkGet.toBlocking() + .forEach(new Action1() { + public void call(JsonDocument doc) { + docs.add(doc); + } + }); + } catch (Exception e) { + logger.error("Error during bulk get", e); + } + + return docs; + } +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/CrudService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/CrudService.java new file mode 100644 index 0000000000..20ee851b39 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/CrudService.java @@ -0,0 +1,16 @@ +package com.baeldung.couchbase.service; + +public interface CrudService { + + void create(T t); + + T read(String id); + + T readFromReplica(String id); + + void update(T t); + + void delete(String id); + + boolean exists(String id); +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/JsonDocumentConverter.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/JsonDocumentConverter.java new file mode 100644 index 0000000000..87331d2a17 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/JsonDocumentConverter.java @@ -0,0 +1,10 @@ +package com.baeldung.couchbase.service; + +import com.couchbase.client.java.document.JsonDocument; + +public interface JsonDocumentConverter { + + JsonDocument toDocument(T t); + + T fromDocument(JsonDocument doc); +} diff --git a/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/TutorialBucketService.java b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/TutorialBucketService.java new file mode 100644 index 0000000000..903a568399 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/java/com/baeldung/couchbase/service/TutorialBucketService.java @@ -0,0 +1,29 @@ +package com.baeldung.couchbase.service; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import com.couchbase.client.java.Bucket; + +@Service +@Qualifier("TutorialBucketService") +public class TutorialBucketService implements BucketService { + + @Autowired + private ClusterService couchbase; + + private Bucket bucket; + + @PostConstruct + private void init() { + bucket = couchbase.openBucket("baeldung-tutorial", ""); + } + + @Override + public Bucket getBucket() { + return bucket; + } +} diff --git a/couchbase-sdk-spring-service/src/main/resources/application.properties b/couchbase-sdk-spring-service/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/couchbase-sdk-spring-service/src/main/resources/logback.xml b/couchbase-sdk-spring-service/src/main/resources/logback.xml new file mode 100644 index 0000000000..efcc6fb4c7 --- /dev/null +++ b/couchbase-sdk-spring-service/src/main/resources/logback.xml @@ -0,0 +1,17 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + \ No newline at end of file diff --git a/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTest.java b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTest.java new file mode 100644 index 0000000000..d1cc807f7a --- /dev/null +++ b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTest.java @@ -0,0 +1,13 @@ +package com.baeldung.couchbase; + +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { IntegrationTestConfig.class }) +@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class }) +public abstract class IntegrationTest { +} diff --git a/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTestConfig.java b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTestConfig.java new file mode 100644 index 0000000000..d593aac52d --- /dev/null +++ b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/IntegrationTestConfig.java @@ -0,0 +1,9 @@ +package com.baeldung.couchbase; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages={"com.baeldung.couchbase"}) +public class IntegrationTestConfig { +} diff --git a/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/person/PersonCrudServiceTest.java b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/person/PersonCrudServiceTest.java new file mode 100644 index 0000000000..e19e90769c --- /dev/null +++ b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/person/PersonCrudServiceTest.java @@ -0,0 +1,82 @@ +package com.baeldung.couchbase.person; + +import static org.junit.Assert.*; + +import javax.annotation.PostConstruct; + +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.baeldung.couchbase.IntegrationTest; + +public class PersonCrudServiceTest extends IntegrationTest { + + private static final String CLARK_KENT = "Clark Kent"; + private static final String SMALLVILLE = "Smallville"; + private static final String CLARK_KENT_ID = "Person:ClarkKent"; + + private Person clarkKent; + + @Autowired + private PersonCrudService personService; + + @PostConstruct + private void init() { + clarkKent = personService.read(CLARK_KENT_ID); + if(clarkKent == null) { + clarkKent = buildClarkKent(); + personService.create(clarkKent); + } + } + + @Test + public final void givenRandomPerson_whenCreate_thenPersonPersisted() { + Person person = randomPerson(); + personService.create(person); + String id = person.getId(); + assertNotNull(personService.read(id)); + } + + @Test + public final void givenClarkKentId_whenRead_thenReturnsClarkKent() { + Person person = personService.read(CLARK_KENT_ID); + assertNotNull(person); + } + + @Test + public final void givenNewHometown_whenUpdate_thenNewHometownPersisted() { + Person expected = randomPerson(); + personService.create(expected); + String updatedHomeTown = RandomStringUtils.randomAlphabetic(12); + expected.setHomeTown(updatedHomeTown); + personService.update(expected); + Person actual = personService.read(expected.getId()); + assertNotNull(actual); + assertEquals(expected.getHomeTown(), actual.getHomeTown()); + } + + @Test + public final void givenRandomPerson_whenDelete_thenPersonNotInBucket() { + Person person = randomPerson(); + personService.create(person); + String id = person.getId(); + personService.delete(id); + assertNull(personService.read(id)); + } + + private Person buildClarkKent() { + return Person.Builder.newInstance() + .id(CLARK_KENT_ID) + .name(CLARK_KENT) + .homeTown(SMALLVILLE) + .build(); + } + + private Person randomPerson() { + return Person.Builder.newInstance() + .name(RandomStringUtils.randomAlphabetic(10)) + .homeTown(RandomStringUtils.randomAlphabetic(10)) + .build(); + } +} diff --git a/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/service/ClusterServiceTest.java b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/service/ClusterServiceTest.java new file mode 100644 index 0000000000..7795f41c93 --- /dev/null +++ b/couchbase-sdk-spring-service/src/test/java/com/baeldung/couchbase/service/ClusterServiceTest.java @@ -0,0 +1,34 @@ +package com.baeldung.couchbase.service; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; + +import com.baeldung.couchbase.IntegrationTest; +import com.baeldung.couchbase.IntegrationTestConfig; +import com.couchbase.client.java.Bucket; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { IntegrationTestConfig.class }) +@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class }) +public class ClusterServiceTest extends IntegrationTest { + + @Autowired + private ClusterService couchbaseService; + + private Bucket defaultBucket; + + @Test + public void whenOpenBucket_thenBucketIsNotNull() throws Exception { + defaultBucket = couchbaseService.openBucket("default", ""); + assertNotNull(defaultBucket); + assertFalse(defaultBucket.isClosed()); + defaultBucket.close(); + } +} From 7e8f3e6f15cec2546d13894a90af62c8fe01b1fb Mon Sep 17 00:00:00 2001 From: Sergey Petunin Date: Thu, 14 Jul 2016 10:55:57 +0600 Subject: [PATCH 08/32] Code samples and tests for the article "What's New in Spring 4.3?" (#497) * Spring 4.3 New features in Spring 4.3 * Added Spring-4.3 as a new module Added Spring-4.3 as a new module. * Adding read file Adding read file * Re-written examples as tests * Added attribute annotations and default methods --- pom.xml | 2 +- spring-4.3/README.md | 9 ++ spring-4.3/pom.xml | 122 ++++++++++++++++++ .../AttributeAnnotationsTestController.java | 14 ++ .../ParamInterceptor.java | 17 +++ .../java/com/baeldung/spring43/cache/Foo.java | 29 +++++ .../baeldung/spring43/cache/FooService.java | 14 ++ .../spring43/composedmapping/Appointment.java | 5 + .../composedmapping/AppointmentService.java | 9 ++ .../AppointmentsController.java | 26 ++++ .../baeldung/spring43/ctor/FooRepository.java | 5 + .../baeldung/spring43/ctor/FooService.java | 15 +++ .../spring43/defaultmethods/DateHolder.java | 18 +++ .../spring43/defaultmethods/IDateHolder.java | 16 +++ .../spring43/depresolution/FooRepository.java | 8 ++ .../spring43/depresolution/FooService.java | 18 +++ .../scopeannotations/AppPreferences.java | 10 ++ .../InstanceCountingService.java | 15 +++ .../scopeannotations/LoginAction.java | 10 ++ .../scopeannotations/ScopeTestController.java | 36 ++++++ .../scopeannotations/UserPreferences.java | 10 ++ .../AttributeAnnotationConfiguration.java | 30 +++++ .../AttributeAnnotationTest.java | 45 +++++++ .../cache/CacheRefinementsConfiguration.java | 25 ++++ .../spring43/cache/CacheRefinementsTest.java | 31 +++++ .../ComposedMappingConfiguration.java | 35 +++++ .../composedmapping/ComposedMappingTest.java | 44 +++++++ ...ConfigurationConstructorInjectionTest.java | 21 +++ .../ctor/FooRepositoryConfiguration.java | 14 ++ .../ctor/FooServiceConfiguration.java | 19 +++ .../ctor/ImplicitConstructorTest.java | 21 +++ .../DefaultMethodsInjectionTest.java | 23 ++++ .../defaultmethods/ITransactionalTest.java | 22 ++++ .../defaultmethods/TransactionalTest.java | 14 ++ .../TransactionalTestConfiguration.java | 30 +++++ .../ObjectProviderConfiguration.java | 9 ++ .../depresolution/ObjectProviderTest.java | 23 ++++ .../ScopeAnnotationsConfiguration.java | 23 ++++ .../ScopeAnnotationsTest.java | 110 ++++++++++++++++ .../test/resources/defaultmethods-context.xml | 10 ++ .../test/resources/implicit-ctor-context.xml | 10 ++ spring-4.3/src/test/resources/logback.xml | 32 +++++ 42 files changed, 998 insertions(+), 1 deletion(-) create mode 100644 spring-4.3/README.md create mode 100644 spring-4.3/pom.xml create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java create mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java create mode 100644 spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java create mode 100644 spring-4.3/src/test/resources/defaultmethods-context.xml create mode 100644 spring-4.3/src/test/resources/implicit-ctor-context.xml create mode 100644 spring-4.3/src/test/resources/logback.xml diff --git a/pom.xml b/pom.xml index 562aaf896b..4808e614f6 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ spring-zuul jsf xml - + spring-4.3 lombok redis diff --git a/spring-4.3/README.md b/spring-4.3/README.md new file mode 100644 index 0000000000..df7a07959d --- /dev/null +++ b/spring-4.3/README.md @@ -0,0 +1,9 @@ +In this tutorial we cover few of the new features of Spring 4.3: + + + Implicit Constructor Injection + Improved Resolution of Dependency + Cache Abstraction Refinements + Composed @RequestMapping Variants + @RequestScope, @SessionScope, @ApplicationScope annotations + Libraries/Application Servers Versions Support \ No newline at end of file diff --git a/spring-4.3/pom.xml b/spring-4.3/pom.xml new file mode 100644 index 0000000000..940bd92f68 --- /dev/null +++ b/spring-4.3/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + com.baeldung + spring-4.3 + 0.0.1-SNAPSHOT + + jar + + Spring 4.3 Demo + + + UTF-8 + 1.8 + + + + + + org.springframework + spring-core + + + + org.springframework + spring-context + + + + org.springframework + spring-webmvc + + + + org.springframework + spring-tx + + + + org.springframework + spring-jdbc + + + + javax.validation + validation-api + 1.1.0.Final + + + + ch.qos.logback + logback-classic + 1.1.3 + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + org.springframework + spring-test + test + + + + org.easymock + easymock + 3.4 + test + + + + junit + junit + 4.12 + test + + + + com.h2database + h2 + 1.4.190 + test + + + + + + + + + + org.springframework + spring-framework-bom + 4.3.1.RELEASE + pom + import + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + + + + + + diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java b/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java new file mode 100644 index 0000000000..d11ca10873 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java @@ -0,0 +1,14 @@ +package com.baeldung.spring43.attributeannotations; + +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/test") +public class AttributeAnnotationsTestController { + + @GetMapping + public String get(@SessionAttribute String login, @RequestAttribute String query) { + return String.format("login = %s, query = %s", login, query); + } + +} \ No newline at end of file diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java b/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java new file mode 100644 index 0000000000..3d6e0ad8b9 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java @@ -0,0 +1,17 @@ +package com.baeldung.spring43.attributeannotations; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +public class ParamInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + request.getSession().setAttribute("login", "john"); + request.setAttribute("query", "invoices"); + return super.preHandle(request, response, handler); + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java b/spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java new file mode 100644 index 0000000000..8a26d2164c --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java @@ -0,0 +1,29 @@ +package com.baeldung.spring43.cache; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Foo { + + private static final Logger log = LoggerFactory.getLogger(Foo.class); + + private static final AtomicInteger instanceCount = new AtomicInteger(0); + + + private final int instanceNum; + + public Foo() { + instanceNum = instanceCount.incrementAndGet(); + } + + public static int getInstanceCount() { + return instanceCount.get(); + } + + public void printInstanceNumber() { + log.info("Foo instance number: {}", instanceNum); + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java b/spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java new file mode 100644 index 0000000000..9c0aa583c5 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java @@ -0,0 +1,14 @@ +package com.baeldung.spring43.cache; + +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class FooService { + + @Cacheable(cacheNames = "foos", sync = true) + public Foo getFoo(String id) { + return new Foo(); + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java new file mode 100644 index 0000000000..4d8ba86f4b --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java @@ -0,0 +1,5 @@ +package com.baeldung.spring43.composedmapping; + +public class Appointment { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java new file mode 100644 index 0000000000..1ca389e16b --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java @@ -0,0 +1,9 @@ +package com.baeldung.spring43.composedmapping; + +import java.util.Map; + +public interface AppointmentService { + + Map getAppointmentsForToday(); + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java new file mode 100644 index 0000000000..756766e1a7 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java @@ -0,0 +1,26 @@ +package com.baeldung.spring43.composedmapping; + +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/appointments") +public class AppointmentsController { + + private final AppointmentService appointmentService; + + @Autowired + public AppointmentsController(AppointmentService appointmentService) { + this.appointmentService = appointmentService; + } + + @GetMapping + public Map get() { + return appointmentService.getAppointmentsForToday(); + } + +} \ No newline at end of file diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java b/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java new file mode 100644 index 0000000000..f1d8425682 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java @@ -0,0 +1,5 @@ +package com.baeldung.spring43.ctor; + +public class FooRepository { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java b/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java new file mode 100644 index 0000000000..cb481f99b2 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java @@ -0,0 +1,15 @@ +package com.baeldung.spring43.ctor; + +public class FooService { + + private final FooRepository repository; + + public FooService(FooRepository repository) { + this.repository = repository; + } + + public FooRepository getRepository() { + return repository; + } + +} \ No newline at end of file diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java b/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java new file mode 100644 index 0000000000..a5307ec37c --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java @@ -0,0 +1,18 @@ +package com.baeldung.spring43.defaultmethods; + +import java.time.LocalDate; + +public class DateHolder implements IDateHolder { + + private LocalDate localDate; + + @Override + public LocalDate getLocalDate() { + return localDate; + } + + @Override + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; + } +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java b/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java new file mode 100644 index 0000000000..66eca031c0 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java @@ -0,0 +1,16 @@ +package com.baeldung.spring43.defaultmethods; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +public interface IDateHolder { + + LocalDate getLocalDate(); + + void setLocalDate(LocalDate localDate); + + default void setStringDate(String stringDate) { + setLocalDate(LocalDate.parse(stringDate, DateTimeFormatter.ofPattern("dd.MM.yyyy"))); + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java b/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java new file mode 100644 index 0000000000..281a4f29fd --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.spring43.depresolution; + +import org.springframework.stereotype.Repository; + +@Repository +public class FooRepository { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java b/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java new file mode 100644 index 0000000000..1a6b13dc23 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java @@ -0,0 +1,18 @@ +package com.baeldung.spring43.depresolution; + +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.stereotype.Service; + +@Service +public class FooService { + + private final FooRepository repository; + + public FooService(ObjectProvider repositoryProvider) { + this.repository = repositoryProvider.getIfUnique(); + } + + public FooRepository getRepository() { + return repository; + } +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java new file mode 100644 index 0000000000..ede2849a51 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java @@ -0,0 +1,10 @@ +package com.baeldung.spring43.scopeannotations; + +import org.springframework.stereotype.Component; +import org.springframework.web.context.annotation.ApplicationScope; + +@Component +@ApplicationScope +public class AppPreferences extends InstanceCountingService { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java new file mode 100644 index 0000000000..e6879e0544 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java @@ -0,0 +1,15 @@ +package com.baeldung.spring43.scopeannotations; + +import java.util.concurrent.atomic.AtomicInteger; + +public class InstanceCountingService { + + private static final AtomicInteger instanceCount = new AtomicInteger(0); + + private final int instanceNumber = instanceCount.incrementAndGet(); + + public int getInstanceNumber() { + return instanceNumber; + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java new file mode 100644 index 0000000000..132e701b5a --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java @@ -0,0 +1,10 @@ +package com.baeldung.spring43.scopeannotations; + +import org.springframework.stereotype.Component; +import org.springframework.web.context.annotation.RequestScope; + +@Component +@RequestScope +public class LoginAction extends InstanceCountingService { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java new file mode 100644 index 0000000000..bd3e3e9b92 --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java @@ -0,0 +1,36 @@ +package com.baeldung.spring43.scopeannotations; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/appointments") +public class ScopeTestController { + + @Autowired + private LoginAction loginAction; + + @Autowired + private UserPreferences userPreferences; + + @Autowired + private AppPreferences appPreferences; + + @GetMapping("/request") + public String getRequestNumber() { + return Integer.toString(loginAction.getInstanceNumber()); + } + + @GetMapping("/session") + public String getSessionNumber() { + return Integer.toString(userPreferences.getInstanceNumber()); + } + + @GetMapping("/application") + public String getApplicationNumber() { + return Integer.toString(appPreferences.getInstanceNumber()); + } + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java new file mode 100644 index 0000000000..27f313b2cb --- /dev/null +++ b/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java @@ -0,0 +1,10 @@ +package com.baeldung.spring43.scopeannotations; + +import org.springframework.stereotype.Component; +import org.springframework.web.context.annotation.SessionScope; + +@Component +@SessionScope +public class UserPreferences extends InstanceCountingService { + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java new file mode 100644 index 0000000000..97b92a943c --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java @@ -0,0 +1,30 @@ +package com.baeldung.spring43.attributeannotations; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +@Configuration +@ComponentScan +@EnableWebMvc +public class AttributeAnnotationConfiguration extends WebMvcConfigurerAdapter { + + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setPrefix("/WEB-INF/jsp/view/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new ParamInterceptor()); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java new file mode 100644 index 0000000000..f368fd4818 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java @@ -0,0 +1,45 @@ +package com.baeldung.spring43.attributeannotations; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@ContextConfiguration(classes = AttributeAnnotationConfiguration.class) +@WebAppConfiguration +public class AttributeAnnotationTest extends AbstractJUnit4SpringContextTests { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @Test + public void whenInterceptorAddsRequestAndSessionParams_thenParamsInjectedWithAttributesAnnotations() throws Exception { + String result = this.mockMvc.perform(get("/test") + .accept(MediaType.ALL)) + .andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + Assert.assertEquals("login = john, query = invoices", result); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java new file mode 100644 index 0000000000..45acb11f72 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java @@ -0,0 +1,25 @@ +package com.baeldung.spring43.cache; + +import java.util.Collections; + +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.concurrent.ConcurrentMapCache; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan +@EnableCaching +public class CacheRefinementsConfiguration { + + @Bean + public CacheManager cacheManager() { + SimpleCacheManager manager = new SimpleCacheManager(); + manager.setCaches(Collections.singletonList(new ConcurrentMapCache("foos"))); + return manager; + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java new file mode 100644 index 0000000000..3f06465c34 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java @@ -0,0 +1,31 @@ +package com.baeldung.spring43.cache; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + +import static org.junit.Assert.assertEquals; + +@ContextConfiguration(classes = CacheRefinementsConfiguration.class) +public class CacheRefinementsTest extends AbstractJUnit4SpringContextTests { + + private ExecutorService executorService = Executors.newFixedThreadPool(10); + + @Autowired + private FooService service; + + @Test + public void whenMultipleThreadsExecuteCacheableMethodWithSyncTrue_thenMethodIsExecutedOnlyOnce() throws InterruptedException { + for (int i = 0; i < 10; i++) { + executorService.execute(() -> service.getFoo("test").printInstanceNumber()); + } + executorService.awaitTermination(1, TimeUnit.SECONDS); + assertEquals(Foo.getInstanceCount(), 1); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java new file mode 100644 index 0000000000..7d92d4cecf --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java @@ -0,0 +1,35 @@ +package com.baeldung.spring43.composedmapping; + +import java.util.Collections; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +import static org.easymock.EasyMock.*; + +@Configuration +@ComponentScan +@EnableWebMvc +public class ComposedMappingConfiguration { + + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setPrefix("/WEB-INF/jsp/view/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } + + @Bean + public AppointmentService appointmentBook() { + AppointmentService book = mock(AppointmentService.class); + expect(book.getAppointmentsForToday()).andReturn(Collections.emptyMap()); + replay(book); + return book; + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java new file mode 100644 index 0000000000..a3c4f818a5 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java @@ -0,0 +1,44 @@ +package com.baeldung.spring43.composedmapping; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import static org.easymock.EasyMock.verify; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@ContextConfiguration(classes = ComposedMappingConfiguration.class) +@WebAppConfiguration +public class ComposedMappingTest extends AbstractJUnit4SpringContextTests { + + @Autowired + private AppointmentService appointmentService; + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @Test + public void whenRequestingMethodWithGetMapping_thenReceiving200Answer() throws Exception { + this.mockMvc.perform(get("/appointments") + .accept(MediaType.ALL)) + .andExpect(status().isOk()); + verify(appointmentService); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java new file mode 100644 index 0000000000..3d001cdb78 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java @@ -0,0 +1,21 @@ +package com.baeldung.spring43.ctor; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + +import static org.junit.Assert.assertNotNull; + +@ContextConfiguration(classes = {FooRepositoryConfiguration.class, FooServiceConfiguration.class}) +public class ConfigurationConstructorInjectionTest extends AbstractJUnit4SpringContextTests { + + @Autowired + public FooService fooService; + + @Test + public void whenSingleCtorInConfiguration_thenContextLoadsNormally() { + assertNotNull(fooService.getRepository()); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java new file mode 100644 index 0000000000..fb33942844 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java @@ -0,0 +1,14 @@ +package com.baeldung.spring43.ctor; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class FooRepositoryConfiguration { + + @Bean + public FooRepository fooRepository() { + return new FooRepository(); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java new file mode 100644 index 0000000000..5ab09e37ec --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java @@ -0,0 +1,19 @@ +package com.baeldung.spring43.ctor; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class FooServiceConfiguration { + + private final FooRepository repository; + + public FooServiceConfiguration(FooRepository repository) { + this.repository = repository; + } + + @Bean + public FooService fooService() { + return new FooService(this.repository); + } +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java new file mode 100644 index 0000000000..62c3eed091 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java @@ -0,0 +1,21 @@ +package com.baeldung.spring43.ctor; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + +import static org.junit.Assert.assertNotNull; + +@ContextConfiguration("classpath:implicit-ctor-context.xml") +public class ImplicitConstructorTest extends AbstractJUnit4SpringContextTests { + + @Autowired + private FooService fooService; + + @Test + public void whenBeanWithoutAutowiredCtor_thenInjectIntoSingleCtor() { + assertNotNull(fooService.getRepository()); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java new file mode 100644 index 0000000000..8c4fa580d7 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java @@ -0,0 +1,23 @@ +package com.baeldung.spring43.defaultmethods; + +import java.time.LocalDate; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + +import static org.junit.Assert.assertEquals; + +@ContextConfiguration("classpath:defaultmethods-context.xml") +public class DefaultMethodsInjectionTest extends AbstractJUnit4SpringContextTests { + + @Autowired + private IDateHolder dateHolder; + + @Test + public void whenInjectingToDefaultInterfaceMethod_thenInjectionShouldHappen() { + assertEquals(LocalDate.of(1982, 10, 15), dateHolder.getLocalDate()); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java new file mode 100644 index 0000000000..b3cca5f21f --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java @@ -0,0 +1,22 @@ +package com.baeldung.spring43.defaultmethods; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.test.context.transaction.AfterTransaction; +import org.springframework.test.context.transaction.BeforeTransaction; + +public interface ITransactionalTest { + + Logger log = LoggerFactory.getLogger(ITransactionalTest.class); + + @BeforeTransaction + default void beforeTransaction() { + log.info("Opening transaction"); + } + + @AfterTransaction + default void afterTransaction() { + log.info("Closing transaction"); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java new file mode 100644 index 0000000000..a7a693102c --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java @@ -0,0 +1,14 @@ +package com.baeldung.spring43.defaultmethods; + +import org.junit.Test; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; + +@ContextConfiguration(classes = TransactionalTestConfiguration.class) +public class TransactionalTest extends AbstractTransactionalJUnit4SpringContextTests implements ITransactionalTest { + + @Test + public void whenDefaultMethodAnnotatedWithBeforeTransaction_thenDefaultMethodIsExecuted() { + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java new file mode 100644 index 0000000000..c5b5a6574f --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java @@ -0,0 +1,30 @@ +package com.baeldung.spring43.defaultmethods; + + +import javax.sql.DataSource; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.SimpleDriverDataSource; +import org.springframework.transaction.PlatformTransactionManager; + +@Configuration +public class TransactionalTestConfiguration { + + @Bean + public DataSource getDataSource() { + SimpleDriverDataSource simpleDriverDataSource = new SimpleDriverDataSource(); + simpleDriverDataSource.setDriverClass(org.h2.Driver.class); + simpleDriverDataSource.setUrl("jdbc:h2:mem:~test"); + simpleDriverDataSource.setUsername("sa"); + simpleDriverDataSource.setPassword(""); + return simpleDriverDataSource; + } + + @Bean + public PlatformTransactionManager transactionManager() { + return new DataSourceTransactionManager(getDataSource()); + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java new file mode 100644 index 0000000000..020b50ceb2 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java @@ -0,0 +1,9 @@ +package com.baeldung.spring43.depresolution; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan +public class ObjectProviderConfiguration { +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java new file mode 100644 index 0000000000..6ae6b1eda3 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java @@ -0,0 +1,23 @@ +package com.baeldung.spring43.depresolution; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + +import static org.junit.Assert.assertNotNull; + +@ContextConfiguration(classes = ObjectProviderConfiguration.class) +public class ObjectProviderTest extends AbstractJUnit4SpringContextTests { + + @Autowired + private FooService fooService; + + @Test + public void whenArgumentIsObjectProvider_thenObjectProviderInjected() { + + assertNotNull(fooService.getRepository()); + + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java b/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java new file mode 100644 index 0000000000..a7d9c16721 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java @@ -0,0 +1,23 @@ +package com.baeldung.spring43.scopeannotations; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +@Configuration +@ComponentScan +@EnableWebMvc +public class ScopeAnnotationsConfiguration { + + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setPrefix("/WEB-INF/jsp/view/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } + +} diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java b/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java new file mode 100644 index 0000000000..5bd07437c1 --- /dev/null +++ b/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java @@ -0,0 +1,110 @@ +package com.baeldung.spring43.scopeannotations; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.mock.web.MockHttpSession; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@ContextConfiguration(classes = ScopeAnnotationsConfiguration.class) +@WebAppConfiguration +public class ScopeAnnotationsTest extends AbstractJUnit4SpringContextTests { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @Test + public void whenDifferentRequests_thenDifferentInstancesOfRequestScopedBeans() throws Exception { + MockHttpSession session = new MockHttpSession(); + + String requestScopedServiceInstanceNumber1 = this.mockMvc.perform(get("/appointments/request") + .session(session) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + String requestScopedServiceInstanceNumber2 = this.mockMvc.perform(get("/appointments/request") + .session(session) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertNotEquals(requestScopedServiceInstanceNumber1, requestScopedServiceInstanceNumber2); + } + + @Test + public void whenDifferentSessions_thenDifferentInstancesOfSessionScopedBeans() throws Exception { + + MockHttpSession session1 = new MockHttpSession(); + MockHttpSession session2 = new MockHttpSession(); + + String sessionScopedServiceInstanceNumber1 = this.mockMvc.perform(get("/appointments/session") + .session(session1) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + String sessionScopedServiceInstanceNumber2 = this.mockMvc.perform(get("/appointments/session") + .session(session1) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + String sessionScopedServiceInstanceNumber3 = this.mockMvc.perform(get("/appointments/session") + .session(session2) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertEquals(sessionScopedServiceInstanceNumber1, sessionScopedServiceInstanceNumber2); + + assertNotEquals(sessionScopedServiceInstanceNumber1, sessionScopedServiceInstanceNumber3); + + } + + @Test + public void whenDifferentSessionsAndRequests_thenAlwaysSingleApplicationScopedBean() throws Exception { + + MockHttpSession session1 = new MockHttpSession(); + MockHttpSession session2 = new MockHttpSession(); + + String applicationScopedServiceInstanceNumber1 = this.mockMvc.perform(get("/appointments/application") + .session(session1) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + String applicationScopedServiceInstanceNumber2 = this.mockMvc.perform(get("/appointments/application") + .session(session2) + .accept(MediaType.ALL)).andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertEquals(applicationScopedServiceInstanceNumber1, applicationScopedServiceInstanceNumber2); + + } + +} diff --git a/spring-4.3/src/test/resources/defaultmethods-context.xml b/spring-4.3/src/test/resources/defaultmethods-context.xml new file mode 100644 index 0000000000..5725d0cabf --- /dev/null +++ b/spring-4.3/src/test/resources/defaultmethods-context.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/spring-4.3/src/test/resources/implicit-ctor-context.xml b/spring-4.3/src/test/resources/implicit-ctor-context.xml new file mode 100644 index 0000000000..3dc0058f94 --- /dev/null +++ b/spring-4.3/src/test/resources/implicit-ctor-context.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/spring-4.3/src/test/resources/logback.xml b/spring-4.3/src/test/resources/logback.xml new file mode 100644 index 0000000000..68ea00fb54 --- /dev/null +++ b/spring-4.3/src/test/resources/logback.xml @@ -0,0 +1,32 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%t] %-5p: %c - %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 77d37f2a88e529ad4ac9ccf003ade6436973a0b4 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 14 Jul 2016 10:00:07 +0300 Subject: [PATCH 09/32] Refactor Java8 examples --- .../collectors/Java8CollectorsTest.java | 71 +++++-------------- 1 file changed, 18 insertions(+), 53 deletions(-) diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java index 11699463d5..b0609c9889 100644 --- a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java +++ b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java @@ -25,7 +25,7 @@ import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.maxBy; +import static java.util.stream.Collectors.*; import static java.util.stream.Collectors.partitioningBy; import static java.util.stream.Collectors.summarizingDouble; import static java.util.stream.Collectors.summingDouble; @@ -38,10 +38,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; public class Java8CollectorsTest { + private final List givenList = Arrays.asList("a", "bb", "ccc", "dd"); + @Test public void whenCollectingToList_shouldCollectToList() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final List result = givenList.stream() .collect(toList()); @@ -51,8 +51,6 @@ public class Java8CollectorsTest { @Test public void whenCollectingToList_shouldCollectToSet() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Set result = givenList.stream() .collect(toSet()); @@ -62,8 +60,6 @@ public class Java8CollectorsTest { @Test public void whenCollectingToCollection_shouldCollectToCollection() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final List result = givenList.stream() .collect(toCollection(LinkedList::new)); @@ -74,8 +70,6 @@ public class Java8CollectorsTest { @Test public void whenCollectingToImmutableCollection_shouldThrowException() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - assertThatThrownBy(() -> { givenList.stream() .collect(toCollection(ImmutableList::of)); @@ -85,8 +79,6 @@ public class Java8CollectorsTest { @Test public void whenCollectingToMap_shouldCollectToMap() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Map result = givenList.stream() .collect(toMap(Function.identity(), String::length)); @@ -94,13 +86,11 @@ public class Java8CollectorsTest { .containsEntry("a", 1) .containsEntry("bb", 2) .containsEntry("ccc", 3) - .containsEntry("dddd", 4); + .containsEntry("dd", 2); } @Test public void whenCollectingToMap_shouldCollectToMapMerging() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Map result = givenList.stream() .collect(toMap(Function.identity(), String::length, (i1, i2) -> i1)); @@ -108,13 +98,11 @@ public class Java8CollectorsTest { .containsEntry("a", 1) .containsEntry("bb", 2) .containsEntry("ccc", 3) - .containsEntry("dddd", 4); + .containsEntry("dd", 2); } @Test public void whenCollectingAndThen_shouldCollect() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final List result = givenList.stream() .collect(collectingAndThen(toList(), ImmutableList::copyOf)); @@ -125,41 +113,33 @@ public class Java8CollectorsTest { @Test public void whenJoining_shouldJoin() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final String result = givenList.stream() .collect(joining()); assertThat(result) - .isEqualTo("abbcccdddd"); + .isEqualTo("abbcccdd"); } @Test public void whenJoiningWithSeparator_shouldJoinWithSeparator() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final String result = givenList.stream() .collect(joining(" ")); assertThat(result) - .isEqualTo("a bb ccc dddd"); + .isEqualTo("a bb ccc dd"); } @Test public void whenJoiningWithSeparatorAndPrefixAndPostfix_shouldJoinWithSeparatorPrePost() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final String result = givenList.stream() .collect(joining(" ", "PRE-", "-POST")); assertThat(result) - .isEqualTo("PRE-a bb ccc dddd-POST"); + .isEqualTo("PRE-a bb ccc dd-POST"); } @Test public void whenPartitioningBy_shouldPartition() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Map> result = givenList.stream() .collect(partitioningBy(s -> s.length() > 2)); @@ -167,17 +147,15 @@ public class Java8CollectorsTest { .containsKeys(true, false) .satisfies(booleanListMap -> { assertThat(booleanListMap.get(true)) - .contains("ccc", "dddd"); + .contains("ccc"); assertThat(booleanListMap.get(false)) - .contains("a", "bb"); + .contains("a", "bb", "dd"); }); } @Test public void whenCounting_shouldCount() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Long result = givenList.stream() .collect(counting()); @@ -187,10 +165,8 @@ public class Java8CollectorsTest { @Test public void whenSummarizing_shouldSummarize() throws Exception { - final List givenList = Arrays.asList(1d, 2d, 3d, 2d); - final DoubleSummaryStatistics result = givenList.stream() - .collect(summarizingDouble(d -> d)); + .collect(summarizingDouble(String::length)); assertThat(result.getAverage()) .isEqualTo(2); @@ -206,10 +182,8 @@ public class Java8CollectorsTest { @Test public void whenAveraging_shouldAverage() throws Exception { - final List givenList = Arrays.asList(1d, 2d, 3d, 2d); - final Double result = givenList.stream() - .collect(averagingDouble(d -> d)); + .collect(averagingDouble(String::length)); assertThat(result) .isEqualTo(2); @@ -217,10 +191,8 @@ public class Java8CollectorsTest { @Test public void whenSumming_shouldSum() throws Exception { - final List givenList = Arrays.asList(1d, 2d, 3d, 2d); - final Double result = givenList.stream() - .collect(summingDouble(d -> d)); + .collect(summingDouble(String::length)); assertThat(result) .isEqualTo(8); @@ -228,41 +200,34 @@ public class Java8CollectorsTest { @Test public void whenMaxingBy_shouldMaxBy() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final Optional result = givenList.stream() .collect(maxBy(Comparator.naturalOrder())); assertThat(result) .isPresent() - .hasValue("dddd"); + .hasValue("dd"); } @Test public void whenGroupingBy_shouldGroupBy() throws Exception { - final List givenList = Arrays.asList("a", "b", "bb", "ccc", "dddd"); - final Map> result = givenList.stream() .collect(groupingBy(String::length, toSet())); assertThat(result) - .containsEntry(1, newHashSet("a", "b")) - .containsEntry(2, newHashSet("bb")) - .containsEntry(3, newHashSet("ccc")) - .containsEntry(4, newHashSet("dddd")); + .containsEntry(1, newHashSet("a")) + .containsEntry(2, newHashSet("bb", "dd")) + .containsEntry(3, newHashSet("ccc")); } @Test public void whenCreatingCustomCollector_shouldCollect() throws Exception { - final List givenList = Arrays.asList("a", "bb", "ccc", "dddd"); - final ImmutableSet result = givenList.stream() .collect(toImmutableSet()); assertThat(result) .isInstanceOf(ImmutableSet.class) - .contains("a", "bb", "ccc", "dddd"); + .contains("a", "bb", "ccc", "dd"); } From af9296951559dfdc51d826cc0e026a23cb005b89 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 14 Jul 2016 10:20:47 +0300 Subject: [PATCH 10/32] Fix import --- .../test/java/com/baeldung/collectors/Java8CollectorsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java index b0609c9889..d94f72b685 100644 --- a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java +++ b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java @@ -25,7 +25,7 @@ import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.*; +import static java.util.stream.Collectors.maxBy; import static java.util.stream.Collectors.partitioningBy; import static java.util.stream.Collectors.summarizingDouble; import static java.util.stream.Collectors.summingDouble; From 7fcdee3918c3d0a6dbed42be9864bf3598d3d273 Mon Sep 17 00:00:00 2001 From: Slavisa Baeldung Date: Thu, 14 Jul 2016 14:52:28 +0200 Subject: [PATCH 11/32] BAEL-145 - fixing production URL --- mutation-testing/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mutation-testing/README.md b/mutation-testing/README.md index e1314d98da..5dd60620ba 100644 --- a/mutation-testing/README.md +++ b/mutation-testing/README.md @@ -3,4 +3,4 @@ ## Mutation Testing ### Relevant Articles: -- [Introduction to Mutation Testing Using the PITest Library](http://www.baeldung.com/introduction-to-mutation-testing-with-pitest) +- [Introduction to Mutation Testing Using the PITest Library](http://www.baeldung.com/java-mutation-testing-with-pitest) From ea9cb32d6cc4de7d4b516120d066428fa79268c7 Mon Sep 17 00:00:00 2001 From: Slavisa Baeldung Date: Thu, 14 Jul 2016 15:03:51 +0200 Subject: [PATCH 12/32] BAEL-28 - Updating article URLs --- core-java-8/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core-java-8/README.md b/core-java-8/README.md index b03d24c34e..e6bac2a4c9 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -3,9 +3,12 @@ ## Core Java 8 Cookbooks and Examples ### Relevant Articles: -// - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) +- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) - [Java – Directory Size](http://www.baeldung.com/java-folder-size) - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) +- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) +- [Java 8 New Features](http://www.baeldung.com/java-8-new-features) - [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) - [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) -- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) +- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams) +- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors) \ No newline at end of file From b5a3fabb7529d37416c20bd396c45b76f3efb5de Mon Sep 17 00:00:00 2001 From: Sergey Petunin Date: Thu, 14 Jul 2016 19:27:31 +0600 Subject: [PATCH 13/32] Moved spring-4.3 project into spring-all (#500) * Moved spring-4.3 project into spring-all * Removed spring-4.3 project --- spring-4.3/README.md | 9 -- spring-4.3/pom.xml | 122 ------------------ .../spring43/composedmapping/Appointment.java | 5 - .../baeldung/spring43/ctor/FooRepository.java | 5 - spring-4.3/src/test/resources/logback.xml | 32 ----- spring-all/README.md | 1 + spring-all/pom.xml | 34 ++++- .../AttributeAnnotationsTestController.java | 2 +- .../ParamInterceptor.java | 2 +- .../org}/baeldung/spring43/cache/Foo.java | 2 +- .../baeldung/spring43/cache/FooService.java | 2 +- .../spring43/composedmapping/Appointment.java | 5 + .../composedmapping/AppointmentService.java | 2 +- .../AppointmentsController.java | 2 +- .../baeldung/spring43/ctor/FooRepository.java | 5 + .../baeldung/spring43/ctor/FooService.java | 2 +- .../spring43/defaultmethods/DateHolder.java | 2 +- .../spring43/defaultmethods/IDateHolder.java | 2 +- .../spring43/depresolution/FooRepository.java | 2 +- .../spring43/depresolution/FooService.java | 2 +- .../scopeannotations/AppPreferences.java | 2 +- .../InstanceCountingService.java | 2 +- .../scopeannotations/LoginAction.java | 2 +- .../scopeannotations/ScopeTestController.java | 2 +- .../scopeannotations/UserPreferences.java | 2 +- .../resources/defaultmethods-context.xml | 2 +- .../main}/resources/implicit-ctor-context.xml | 4 +- .../src/main/resources/springAsync-config.xml | 2 +- .../AttributeAnnotationConfiguration.java | 2 +- .../AttributeAnnotationTest.java | 2 +- .../cache/CacheRefinementsConfiguration.java | 2 +- .../spring43/cache/CacheRefinementsTest.java | 2 +- .../ComposedMappingConfiguration.java | 7 +- .../composedmapping/ComposedMappingTest.java | 2 +- ...ConfigurationConstructorInjectionTest.java | 2 +- .../ctor/FooRepositoryConfiguration.java | 2 +- .../ctor/FooServiceConfiguration.java | 2 +- .../ctor/ImplicitConstructorTest.java | 2 +- .../DefaultMethodsInjectionTest.java | 2 +- .../defaultmethods/ITransactionalTest.java | 2 +- .../defaultmethods/TransactionalTest.java | 2 +- .../TransactionalTestConfiguration.java | 6 +- .../ObjectProviderConfiguration.java | 2 +- .../depresolution/ObjectProviderTest.java | 2 +- .../ScopeAnnotationsConfiguration.java | 2 +- .../ScopeAnnotationsTest.java | 2 +- 46 files changed, 86 insertions(+), 217 deletions(-) delete mode 100644 spring-4.3/README.md delete mode 100644 spring-4.3/pom.xml delete mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java delete mode 100644 spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java delete mode 100644 spring-4.3/src/test/resources/logback.xml rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java (86%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/attributeannotations/ParamInterceptor.java (91%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/cache/Foo.java (94%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/cache/FooService.java (87%) create mode 100644 spring-all/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/composedmapping/AppointmentService.java (72%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/composedmapping/AppointmentsController.java (93%) create mode 100644 spring-all/src/main/java/org/baeldung/spring43/ctor/FooRepository.java rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/ctor/FooService.java (87%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/defaultmethods/DateHolder.java (87%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/defaultmethods/IDateHolder.java (87%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/depresolution/FooRepository.java (68%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/depresolution/FooService.java (90%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/scopeannotations/AppPreferences.java (81%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/scopeannotations/InstanceCountingService.java (86%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/scopeannotations/LoginAction.java (80%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/scopeannotations/ScopeTestController.java (95%) rename {spring-4.3/src/main/java/com => spring-all/src/main/java/org}/baeldung/spring43/scopeannotations/UserPreferences.java (81%) rename {spring-4.3/src/test => spring-all/src/main}/resources/defaultmethods-context.xml (85%) rename {spring-4.3/src/test => spring-all/src/main}/resources/implicit-ctor-context.xml (71%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java (95%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java (96%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/cache/CacheRefinementsConfiguration.java (95%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/cache/CacheRefinementsTest.java (96%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java (79%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/composedmapping/ComposedMappingTest.java (96%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java (94%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/ctor/FooRepositoryConfiguration.java (88%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/ctor/FooServiceConfiguration.java (92%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/ctor/ImplicitConstructorTest.java (94%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java (93%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/defaultmethods/ITransactionalTest.java (91%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/defaultmethods/TransactionalTest.java (91%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java (81%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/depresolution/ObjectProviderConfiguration.java (81%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/depresolution/ObjectProviderTest.java (93%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java (93%) rename {spring-4.3/src/test/java/com => spring-all/src/test/java/org}/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java (98%) diff --git a/spring-4.3/README.md b/spring-4.3/README.md deleted file mode 100644 index df7a07959d..0000000000 --- a/spring-4.3/README.md +++ /dev/null @@ -1,9 +0,0 @@ -In this tutorial we cover few of the new features of Spring 4.3: - - - Implicit Constructor Injection - Improved Resolution of Dependency - Cache Abstraction Refinements - Composed @RequestMapping Variants - @RequestScope, @SessionScope, @ApplicationScope annotations - Libraries/Application Servers Versions Support \ No newline at end of file diff --git a/spring-4.3/pom.xml b/spring-4.3/pom.xml deleted file mode 100644 index 940bd92f68..0000000000 --- a/spring-4.3/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - 4.0.0 - - com.baeldung - spring-4.3 - 0.0.1-SNAPSHOT - - jar - - Spring 4.3 Demo - - - UTF-8 - 1.8 - - - - - - org.springframework - spring-core - - - - org.springframework - spring-context - - - - org.springframework - spring-webmvc - - - - org.springframework - spring-tx - - - - org.springframework - spring-jdbc - - - - javax.validation - validation-api - 1.1.0.Final - - - - ch.qos.logback - logback-classic - 1.1.3 - - - - javax.servlet - javax.servlet-api - 3.1.0 - - - - org.springframework - spring-test - test - - - - org.easymock - easymock - 3.4 - test - - - - junit - junit - 4.12 - test - - - - com.h2database - h2 - 1.4.190 - test - - - - - - - - - - org.springframework - spring-framework-bom - 4.3.1.RELEASE - pom - import - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - - diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java b/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java deleted file mode 100644 index 4d8ba86f4b..0000000000 --- a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.spring43.composedmapping; - -public class Appointment { - -} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java b/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java deleted file mode 100644 index f1d8425682..0000000000 --- a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.spring43.ctor; - -public class FooRepository { - -} diff --git a/spring-4.3/src/test/resources/logback.xml b/spring-4.3/src/test/resources/logback.xml deleted file mode 100644 index 68ea00fb54..0000000000 --- a/spring-4.3/src/test/resources/logback.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%t] %-5p: %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-all/README.md b/spring-all/README.md index 47c947a414..0bbb600860 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -11,3 +11,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Properties with Spring](http://www.baeldung.com/2012/02/06/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage - [Spring Profiles](http://www.baeldung.com/spring-profiles) - [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor) +- [What's New in Spring 4.3?](http://www.baeldung.com/whats-new-in-spring-4-3/) diff --git a/spring-all/pom.xml b/spring-all/pom.xml index 8ff09e5e17..5f14d32121 100644 --- a/spring-all/pom.xml +++ b/spring-all/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.2.6.RELEASE + 1.3.6.RELEASE @@ -147,8 +147,38 @@ mockito-core test + + + org.easymock + easymock + 3.4 + test + + + + + + + + org.springframework + spring-framework-bom + ${org.springframework.version} + pom + import + + + + org.springframework + spring-core + ${org.springframework.version} + + + + + + spring-all @@ -217,7 +247,7 @@ - 4.2.5.RELEASE + 4.3.1.RELEASE 4.0.4.RELEASE 3.20.0-GA 1.2 diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java b/spring-all/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java similarity index 86% rename from spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java rename to spring-all/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java index d11ca10873..df1d173bd2 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java +++ b/spring-all/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.attributeannotations; +package org.baeldung.spring43.attributeannotations; import org.springframework.web.bind.annotation.*; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java b/spring-all/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java similarity index 91% rename from spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java rename to spring-all/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java index 3d6e0ad8b9..9cf6020a93 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java +++ b/spring-all/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.attributeannotations; +package org.baeldung.spring43.attributeannotations; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java b/spring-all/src/main/java/org/baeldung/spring43/cache/Foo.java similarity index 94% rename from spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java rename to spring-all/src/main/java/org/baeldung/spring43/cache/Foo.java index 8a26d2164c..4abd3cc813 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/cache/Foo.java +++ b/spring-all/src/main/java/org/baeldung/spring43/cache/Foo.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.cache; +package org.baeldung.spring43.cache; import java.util.concurrent.atomic.AtomicInteger; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java b/spring-all/src/main/java/org/baeldung/spring43/cache/FooService.java similarity index 87% rename from spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java rename to spring-all/src/main/java/org/baeldung/spring43/cache/FooService.java index 9c0aa583c5..ad4c8b395f 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/cache/FooService.java +++ b/spring-all/src/main/java/org/baeldung/spring43/cache/FooService.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.cache; +package org.baeldung.spring43.cache; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; diff --git a/spring-all/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java new file mode 100644 index 0000000000..af06249768 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java @@ -0,0 +1,5 @@ +package org.baeldung.spring43.composedmapping; + +public class Appointment { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java similarity index 72% rename from spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java rename to spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java index 1ca389e16b..c4c5e82f65 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java +++ b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.composedmapping; +package org.baeldung.spring43.composedmapping; import java.util.Map; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java similarity index 93% rename from spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java rename to spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java index 756766e1a7..9f3c8729d8 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java +++ b/spring-all/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.composedmapping; +package org.baeldung.spring43.composedmapping; import java.util.Map; diff --git a/spring-all/src/main/java/org/baeldung/spring43/ctor/FooRepository.java b/spring-all/src/main/java/org/baeldung/spring43/ctor/FooRepository.java new file mode 100644 index 0000000000..96dbeb8642 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/spring43/ctor/FooRepository.java @@ -0,0 +1,5 @@ +package org.baeldung.spring43.ctor; + +public class FooRepository { + +} diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java b/spring-all/src/main/java/org/baeldung/spring43/ctor/FooService.java similarity index 87% rename from spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java rename to spring-all/src/main/java/org/baeldung/spring43/ctor/FooService.java index cb481f99b2..bf92d1bd32 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/ctor/FooService.java +++ b/spring-all/src/main/java/org/baeldung/spring43/ctor/FooService.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.ctor; +package org.baeldung.spring43.ctor; public class FooService { diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java b/spring-all/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java similarity index 87% rename from spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java rename to spring-all/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java index a5307ec37c..9ae62cf484 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java +++ b/spring-all/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import java.time.LocalDate; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java b/spring-all/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java similarity index 87% rename from spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java rename to spring-all/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java index 66eca031c0..e37d27f9fc 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java +++ b/spring-all/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import java.time.LocalDate; import java.time.format.DateTimeFormatter; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java b/spring-all/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java similarity index 68% rename from spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java rename to spring-all/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java index 281a4f29fd..313f6fc8c5 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java +++ b/spring-all/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.depresolution; +package org.baeldung.spring43.depresolution; import org.springframework.stereotype.Repository; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java b/spring-all/src/main/java/org/baeldung/spring43/depresolution/FooService.java similarity index 90% rename from spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java rename to spring-all/src/main/java/org/baeldung/spring43/depresolution/FooService.java index 1a6b13dc23..b76fa84749 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/depresolution/FooService.java +++ b/spring-all/src/main/java/org/baeldung/spring43/depresolution/FooService.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.depresolution; +package org.baeldung.spring43.depresolution; import org.springframework.beans.factory.ObjectProvider; import org.springframework.stereotype.Service; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java similarity index 81% rename from spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java rename to spring-all/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java index ede2849a51..45b90c4609 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java +++ b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.ApplicationScope; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java similarity index 86% rename from spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java rename to spring-all/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java index e6879e0544..4fb90566d8 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java +++ b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import java.util.concurrent.atomic.AtomicInteger; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java similarity index 80% rename from spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java rename to spring-all/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java index 132e701b5a..60017b4b94 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java +++ b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java similarity index 95% rename from spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java rename to spring-all/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java index bd3e3e9b92..8f4390dfc0 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java +++ b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; diff --git a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java similarity index 81% rename from spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java rename to spring-all/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java index 27f313b2cb..ce49c4b1fe 100644 --- a/spring-4.3/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java +++ b/spring-all/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.SessionScope; diff --git a/spring-4.3/src/test/resources/defaultmethods-context.xml b/spring-all/src/main/resources/defaultmethods-context.xml similarity index 85% rename from spring-4.3/src/test/resources/defaultmethods-context.xml rename to spring-all/src/main/resources/defaultmethods-context.xml index 5725d0cabf..2b55037405 100644 --- a/spring-4.3/src/test/resources/defaultmethods-context.xml +++ b/spring-all/src/main/resources/defaultmethods-context.xml @@ -3,7 +3,7 @@ xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-4.3/src/test/resources/implicit-ctor-context.xml b/spring-all/src/main/resources/implicit-ctor-context.xml similarity index 71% rename from spring-4.3/src/test/resources/implicit-ctor-context.xml rename to spring-all/src/main/resources/implicit-ctor-context.xml index 3dc0058f94..c978ca17bd 100644 --- a/spring-4.3/src/test/resources/implicit-ctor-context.xml +++ b/spring-all/src/main/resources/implicit-ctor-context.xml @@ -3,8 +3,8 @@ xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + diff --git a/spring-all/src/main/resources/springAsync-config.xml b/spring-all/src/main/resources/springAsync-config.xml index 8ed5f1319d..34e8b33f45 100644 --- a/spring-all/src/main/resources/springAsync-config.xml +++ b/spring-all/src/main/resources/springAsync-config.xml @@ -9,6 +9,6 @@ - + \ No newline at end of file diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java similarity index 95% rename from spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java index 97b92a943c..97ae651473 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.attributeannotations; +package org.baeldung.spring43.attributeannotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java b/spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java similarity index 96% rename from spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java rename to spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java index f368fd4818..aa3acb113f 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.attributeannotations; +package org.baeldung.spring43.attributeannotations; import org.junit.Assert; import org.junit.Before; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java similarity index 95% rename from spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java index 45acb11f72..e4610e5a83 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.cache; +package org.baeldung.spring43.cache; import java.util.Collections; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java b/spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsTest.java similarity index 96% rename from spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java rename to spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsTest.java index 3f06465c34..bfd6e5047c 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/cache/CacheRefinementsTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/cache/CacheRefinementsTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.cache; +package org.baeldung.spring43.cache; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java similarity index 79% rename from spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java index 7d92d4cecf..46bf3d8847 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java @@ -1,7 +1,8 @@ -package com.baeldung.spring43.composedmapping; +package org.baeldung.spring43.composedmapping; import java.util.Collections; +import org.easymock.EasyMock; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -26,8 +27,8 @@ public class ComposedMappingConfiguration { @Bean public AppointmentService appointmentBook() { - AppointmentService book = mock(AppointmentService.class); - expect(book.getAppointmentsForToday()).andReturn(Collections.emptyMap()); + AppointmentService book = EasyMock.mock(AppointmentService.class); + EasyMock.expect(book.getAppointmentsForToday()).andReturn(Collections.emptyMap()); replay(book); return book; } diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java b/spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingTest.java similarity index 96% rename from spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java rename to spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingTest.java index a3c4f818a5..04fabbc834 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.composedmapping; +package org.baeldung.spring43.composedmapping; import org.junit.Before; import org.junit.Test; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java b/spring-all/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java similarity index 94% rename from spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java rename to spring-all/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java index 3d001cdb78..82caae15fe 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.ctor; +package org.baeldung.spring43.ctor; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java similarity index 88% rename from spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java index fb33942844..a05a36529f 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.ctor; +package org.baeldung.spring43.ctor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java similarity index 92% rename from spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java index 5ab09e37ec..41f1719320 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.ctor; +package org.baeldung.spring43.ctor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java b/spring-all/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorTest.java similarity index 94% rename from spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java rename to spring-all/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorTest.java index 62c3eed091..be0cf77a62 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.ctor; +package org.baeldung.spring43.ctor; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java similarity index 93% rename from spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java rename to spring-all/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java index 8c4fa580d7..e29d89a679 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import java.time.LocalDate; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java similarity index 91% rename from spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java rename to spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java index b3cca5f21f..c7b95bced4 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTest.java similarity index 91% rename from spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java rename to spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTest.java index a7a693102c..89c96ba1d4 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import org.junit.Test; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java similarity index 81% rename from spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java index c5b5a6574f..946b19d00d 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.defaultmethods; +package org.baeldung.spring43.defaultmethods; import javax.sql.DataSource; @@ -15,8 +15,8 @@ public class TransactionalTestConfiguration { @Bean public DataSource getDataSource() { SimpleDriverDataSource simpleDriverDataSource = new SimpleDriverDataSource(); - simpleDriverDataSource.setDriverClass(org.h2.Driver.class); - simpleDriverDataSource.setUrl("jdbc:h2:mem:~test"); + simpleDriverDataSource.setDriverClass(org.hsqldb.jdbcDriver.class); + simpleDriverDataSource.setUrl("jdbc:hsqldb:mem:app-db"); simpleDriverDataSource.setUsername("sa"); simpleDriverDataSource.setPassword(""); return simpleDriverDataSource; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java similarity index 81% rename from spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java index 020b50ceb2..530c4d9f4a 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.depresolution; +package org.baeldung.spring43.depresolution; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java b/spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderTest.java similarity index 93% rename from spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java rename to spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderTest.java index 6ae6b1eda3..eeeb005f81 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.depresolution; +package org.baeldung.spring43.depresolution; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java b/spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java similarity index 93% rename from spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java rename to spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java index a7d9c16721..24c1ec2f34 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java +++ b/spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java b/spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java similarity index 98% rename from spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java rename to spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java index 5bd07437c1..b696760f68 100644 --- a/spring-4.3/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring43.scopeannotations; +package org.baeldung.spring43.scopeannotations; import org.junit.Before; import org.junit.Test; From 9f27df367f7c7f0bd56682eabce83fa0d6a121a1 Mon Sep 17 00:00:00 2001 From: Thai Nguyen Date: Thu, 14 Jul 2016 20:38:34 +0700 Subject: [PATCH 14/32] Apache CXF with Spring --- apache-cxf/cxf-spring/pom.xml | 117 ++++++++++++++++++ .../com/baeldung/cxf/spring/Baeldung.java | 9 ++ .../com/baeldung/cxf/spring/BaeldungImpl.java | 17 +++ .../java/com/baeldung/cxf/spring/Student.java | 20 +++ .../src/main/resources/client-beans.xml | 10 ++ .../src/main/webapp/WEB-INF/cxf-servlet.xml | 7 ++ .../src/main/webapp/WEB-INF/web.xml | 14 +++ .../com/baeldung/cxf/spring/StudentTest.java | 32 +++++ apache-cxf/pom.xml | 79 ++++++------ 9 files changed, 266 insertions(+), 39 deletions(-) create mode 100644 apache-cxf/cxf-spring/pom.xml create mode 100644 apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java create mode 100644 apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java create mode 100644 apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java create mode 100644 apache-cxf/cxf-spring/src/main/resources/client-beans.xml create mode 100644 apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml create mode 100644 apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml create mode 100644 apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentTest.java diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf/cxf-spring/pom.xml new file mode 100644 index 0000000000..02750dd790 --- /dev/null +++ b/apache-cxf/cxf-spring/pom.xml @@ -0,0 +1,117 @@ + + 4.0.0 + cxf-spring + war + + com.baeldung + apache-cxf + 0.0.1-SNAPSHOT + + + 3.1.6 + 4.3.1.RELEASE + 2.19.1 + + + + + maven-war-plugin + 2.6 + + src/main/webapp/WEB-INF/web.xml + + + + maven-surefire-plugin + ${surefire.version} + + + StudentTest.java + + + + + + + + integration + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.5.0 + + + jetty9x + embedded + + + + localhost + 8080 + + + + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + + + maven-surefire-plugin + ${surefire.version} + + + integration-test + + test + + + + none + + + + + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + + + org.apache.cxf + cxf-rt-transports-http-jetty + ${cxf.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java new file mode 100644 index 0000000000..4f880e6ada --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Baeldung.java @@ -0,0 +1,9 @@ +package com.baeldung.cxf.spring; + +import javax.jws.WebService; + +@WebService +public interface Baeldung { + String hello(String name); + String register(Student student); +} \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java new file mode 100644 index 0000000000..911ce7f876 --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/BaeldungImpl.java @@ -0,0 +1,17 @@ +package com.baeldung.cxf.spring; + +import javax.jws.WebService; + +@WebService(endpointInterface = "com.baeldung.cxf.spring.Baeldung") +public class BaeldungImpl implements Baeldung { + private int counter; + + public String hello(String name) { + return "Hello " + name + "!"; + } + + public String register(Student student) { + counter++; + return student.getName() + " is registered student number " + counter; + } +} \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java new file mode 100644 index 0000000000..eb58057eb6 --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/java/com/baeldung/cxf/spring/Student.java @@ -0,0 +1,20 @@ +package com.baeldung.cxf.spring; + +public class Student { + private String name; + + Student() { + } + + public Student(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/resources/client-beans.xml b/apache-cxf/cxf-spring/src/main/resources/client-beans.xml new file mode 100644 index 0000000000..3f30562193 --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/resources/client-beans.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml new file mode 100644 index 0000000000..7669d3f942 --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..0d7687771b --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,14 @@ + + + + cxf + org.apache.cxf.transport.servlet.CXFServlet + 1 + + + cxf + /services/* + + \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentTest.java b/apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentTest.java new file mode 100644 index 0000000000..44a9d11687 --- /dev/null +++ b/apache-cxf/cxf-spring/src/test/java/com/baeldung/cxf/spring/StudentTest.java @@ -0,0 +1,32 @@ +package com.baeldung.cxf.spring; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class StudentTest { + private ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "client-beans.xml" }); + private Baeldung baeldungProxy; + + { + baeldungProxy = (Baeldung) context.getBean("client"); + } + + @Test + public void whenUsingHelloMethod_thenCorrect() { + String response = baeldungProxy.hello("John Doe"); + assertEquals("Hello John Doe!", response); + } + + @Test + public void whenUsingRegisterMethod_thenCorrect() { + Student student1 = new Student("Adam"); + Student student2 = new Student("Eve"); + String student1Response = baeldungProxy.register(student1); + String student2Response = baeldungProxy.register(student2); + + assertEquals("Adam is registered student number 1", student1Response); + assertEquals("Eve is registered student number 2", student2Response); + } +} \ No newline at end of file diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index 41ae75a1de..e86e4be5cd 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,40 +1,41 @@ - 4.0.0 - com.baeldung - apache-cxf - 0.0.1-SNAPSHOT - pom - - cxf-introduction - - - - junit - junit - 4.12 - test - - - - install - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - org.codehaus.mojo - exec-maven-plugin - 1.5.0 - - - - - + 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 + apache-cxf + 0.0.1-SNAPSHOT + pom + + cxf-introduction + cxf-spring + + + + junit + junit + 4.12 + test + + + + install + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.codehaus.mojo + exec-maven-plugin + 1.5.0 + + + + + \ No newline at end of file From 506740b32802d763dad41aff0e12de4a2e590b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B8=CC=86=20=D0=9F=D0=B5?= =?UTF-8?q?=D1=82=D1=83=D0=BD=D0=B8=D0=BD?= Date: Thu, 14 Jul 2016 19:34:31 +0500 Subject: [PATCH 15/32] Removed spring-4.3 from the main module --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4808e614f6..5820989816 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,6 @@ spring-zuul jsf xml - spring-4.3 lombok redis From 1d896e5e967ac4842950f24027c06fc03e8e2d3c Mon Sep 17 00:00:00 2001 From: Slavisa Baeldung Date: Thu, 14 Jul 2016 16:45:24 +0200 Subject: [PATCH 16/32] NOJIRA - removing missing module form main pom.xml --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4808e614f6..5820989816 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,6 @@ spring-zuul jsf xml - spring-4.3 lombok redis From 0f6218ec918bbad1455ce62ce445a4204a8d99d7 Mon Sep 17 00:00:00 2001 From: prashant1067 Date: Fri, 15 Jul 2016 01:15:56 +0530 Subject: [PATCH 17/32] adding spring controller changes (#493) * adding spring controller changes * changing package name to baledung * removing test package * adding changes in pom for spring junit testing * adding test classes for controller * adding equals and hashcode for student for test cases * adding changes for running test cases --- spring_controller/pom.xml | 56 ++++++++++ .../controller/RestAnnotatedController.java | 21 ++++ .../baledung/controller/RestController.java | 30 +++++ .../baledung/controller/TestController.java | 26 +++++ .../java/com/baledung/student/Student.java | 40 +++++++ .../src/main/resources/test-mvc.xml | 24 ++++ .../src/main/webapp/WEB-INF/test-mvc.xml | 24 ++++ .../src/main/webapp/WEB-INF/web.xml | 32 ++++++ .../src/main/webapp/WEB-INF/welcome.jsp | 12 ++ .../com/baledung/test/ControllerTest.java | 105 ++++++++++++++++++ 10 files changed, 370 insertions(+) create mode 100644 spring_controller/pom.xml create mode 100644 spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java create mode 100644 spring_controller/src/main/java/com/baledung/controller/RestController.java create mode 100644 spring_controller/src/main/java/com/baledung/controller/TestController.java create mode 100644 spring_controller/src/main/java/com/baledung/student/Student.java create mode 100644 spring_controller/src/main/resources/test-mvc.xml create mode 100644 spring_controller/src/main/webapp/WEB-INF/test-mvc.xml create mode 100644 spring_controller/src/main/webapp/WEB-INF/web.xml create mode 100644 spring_controller/src/main/webapp/WEB-INF/welcome.jsp create mode 100644 spring_controller/src/test/java/com/baledung/test/ControllerTest.java diff --git a/spring_controller/pom.xml b/spring_controller/pom.xml new file mode 100644 index 0000000000..661c46a4b9 --- /dev/null +++ b/spring_controller/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + test + test-mvc + 0.0.1-SNAPSHOT + war + + + + org.springframework + spring-webmvc + 4.3.0.RELEASE + + + + javax.servlet + javax.servlet-api + 3.0.1 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + + + com.fasterxml.jackson.core + jackson-annotations + 2.6.3 + + + com.fasterxml.jackson.core + jackson-core + 2.6.3 + + + org.springframework + spring-web + 4.3.0.RELEASE + + + + junit + junit + 4.12 + test + + + org.springframework + spring-test + 4.1.7.RELEASE + + + + + \ No newline at end of file diff --git a/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java b/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java new file mode 100644 index 0000000000..c01d074b97 --- /dev/null +++ b/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java @@ -0,0 +1,21 @@ +package com.baledung.controller; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baledung.student.Student; + +@RestController +public class RestAnnotatedController +{ + @RequestMapping(value="/annotated/student/{studentId}") + public Student getData(@PathVariable Integer studentId) + { + Student student = new Student(); + student.setName("Peter"); + student.setId(studentId); + + return student; + } +} diff --git a/spring_controller/src/main/java/com/baledung/controller/RestController.java b/spring_controller/src/main/java/com/baledung/controller/RestController.java new file mode 100644 index 0000000000..226f66b5df --- /dev/null +++ b/spring_controller/src/main/java/com/baledung/controller/RestController.java @@ -0,0 +1,30 @@ +package com.baledung.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.baledung.student.Student; + +@Controller +public class RestController{ + + /** + * Get a student based on the id of the student + * specified in path variable {studentId} + * @param studentId + * @return + */ + @RequestMapping(value="/student/{studentId}",method=RequestMethod.GET) + public @ResponseBody Student getTestData(@PathVariable Integer studentId) + { + Student student = new Student(); + student.setName("Peter"); + student.setId(studentId); + + return student; + + } +} diff --git a/spring_controller/src/main/java/com/baledung/controller/TestController.java b/spring_controller/src/main/java/com/baledung/controller/TestController.java new file mode 100644 index 0000000000..5dafc14d84 --- /dev/null +++ b/spring_controller/src/main/java/com/baledung/controller/TestController.java @@ -0,0 +1,26 @@ + +/** + * @author Prashant Dutta + * + */ +package com.baledung.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping(value="/test") +public class TestController{ + + @RequestMapping(method=RequestMethod.GET) + public ModelAndView getTestData() + { + ModelAndView mv = new ModelAndView(); + mv.setViewName("welcome"); + mv.getModel().put("data", "Welcome home man"); + + return mv; + } +} \ No newline at end of file diff --git a/spring_controller/src/main/java/com/baledung/student/Student.java b/spring_controller/src/main/java/com/baledung/student/Student.java new file mode 100644 index 0000000000..8cf0b5e263 --- /dev/null +++ b/spring_controller/src/main/java/com/baledung/student/Student.java @@ -0,0 +1,40 @@ +/** + * + */ +package com.baledung.student; + +public class Student +{ + private String name; + + private int id; + +//----------------------------- getters and setters-------------------------------------------------------- + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public int hashCode(){ + return this.id; + } + + @Override + public boolean equals(Object obj){ + return this.name.equals(((Student)obj).getName()); + } + + +} \ No newline at end of file diff --git a/spring_controller/src/main/resources/test-mvc.xml b/spring_controller/src/main/resources/test-mvc.xml new file mode 100644 index 0000000000..c632a5e435 --- /dev/null +++ b/spring_controller/src/main/resources/test-mvc.xml @@ -0,0 +1,24 @@ + + + + + + + + /WEB-INF/ + + + .jsp + + + \ No newline at end of file diff --git a/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml b/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml new file mode 100644 index 0000000000..c48e4f94f6 --- /dev/null +++ b/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml @@ -0,0 +1,24 @@ + + + + + + + + /WEB-INF/ + + + .jsp + + + \ No newline at end of file diff --git a/spring_controller/src/main/webapp/WEB-INF/web.xml b/spring_controller/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..a1545a8d51 --- /dev/null +++ b/spring_controller/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + + + test-mvc + + org.springframework.web.servlet.DispatcherServlet + + 1 + + contextConfigLocation + /WEB-INF/test-mvc.xml + + + + + test-mvc + /test/* + + + + + + + /WEB-INF/index.jsp + + diff --git a/spring_controller/src/main/webapp/WEB-INF/welcome.jsp b/spring_controller/src/main/webapp/WEB-INF/welcome.jsp new file mode 100644 index 0000000000..17d5589e74 --- /dev/null +++ b/spring_controller/src/main/webapp/WEB-INF/welcome.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +Insert title here + + +Data returned is ${data} + + \ No newline at end of file diff --git a/spring_controller/src/test/java/com/baledung/test/ControllerTest.java b/spring_controller/src/test/java/com/baledung/test/ControllerTest.java new file mode 100644 index 0000000000..6a2567a29a --- /dev/null +++ b/spring_controller/src/test/java/com/baledung/test/ControllerTest.java @@ -0,0 +1,105 @@ +package com.baledung.test; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.ModelAndView; + +import com.baledung.student.Student; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + *

+ * Test class for spring controllers + *

+ * @author Prashant.Dutta + */ +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration({"classpath:test-mvc.xml"}) +public class ControllerTest +{ + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + private Student selectedStudent; + + @Before + public void setUp() + { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + + selectedStudent = new Student(); + selectedStudent.setId(1); + selectedStudent.setName("Peter"); + } + + /** + * Test basic test controller + * @throws Exception + */ + @Test + public void testTestController() throws Exception + { + + ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/test/")) + .andReturn() + .getModelAndView(); + + // validate modal data + Assert.assertSame(mv.getModelMap().get("data").toString(), "Welcome home man"); + + // validate view name + Assert.assertSame(mv.getViewName(), "welcome"); + } + + /** + * Test rest controller + * @throws Exception + */ + @Test + public void testRestController() throws Exception + { + + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/student/{studentId}",1)) + .andReturn().getResponse() + .getContentAsString(); + + ObjectMapper reader = new ObjectMapper(); + + Student studentDetails = reader.readValue(responseBody, Student.class); + + Assert.assertEquals(selectedStudent, studentDetails); + + } + + /** + * Test rest controller annotated with test + * @throws Exception + */ + @Test + public void testRestAnnotatedController() throws Exception + { + + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/annotated/student/{studentId}",1)) + .andReturn().getResponse() + .getContentAsString(); + + ObjectMapper reader = new ObjectMapper(); + + Student studentDetails = reader.readValue(responseBody, Student.class); + + Assert.assertEquals(selectedStudent, studentDetails); + } +} From 2113974e1c3761abf083a5c77225d41c4ff61920 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 14 Jul 2016 23:05:25 +0300 Subject: [PATCH 18/32] Refactor spring-controller --- pom.xml | 1 + spring-batch/.classpath | 31 ----- spring-batch/.project | 29 ----- .../pom.xml | 110 +++++++++--------- .../controller/RestAnnotatedController.java | 19 +++ .../baledung/controller/RestController.java | 51 ++++---- .../baledung/controller/TestController.java | 24 ++++ .../java/com/baledung/student/Student.java | 71 +++++------ .../src/main/resources/test-mvc.xml | 46 ++++---- .../src/main/webapp/WEB-INF/web.xml | 27 +++++ .../src/main/webapp/WEB-INF/welcome.jsp | 22 ++-- .../com/baledung/test/ControllerTest.java | 83 +++++++++++++ .../controller/RestAnnotatedController.java | 21 ---- .../baledung/controller/TestController.java | 26 ----- .../src/main/webapp/WEB-INF/test-mvc.xml | 24 ---- .../src/main/webapp/WEB-INF/web.xml | 32 ----- .../com/baledung/test/ControllerTest.java | 105 ----------------- 17 files changed, 296 insertions(+), 426 deletions(-) delete mode 100644 spring-batch/.classpath delete mode 100644 spring-batch/.project rename {spring_controller => spring-controller}/pom.xml (92%) create mode 100644 spring-controller/src/main/java/com/baledung/controller/RestAnnotatedController.java rename {spring_controller => spring-controller}/src/main/java/com/baledung/controller/RestController.java (54%) create mode 100644 spring-controller/src/main/java/com/baledung/controller/TestController.java rename {spring_controller => spring-controller}/src/main/java/com/baledung/student/Student.java (69%) rename {spring_controller => spring-controller}/src/main/resources/test-mvc.xml (97%) create mode 100644 spring-controller/src/main/webapp/WEB-INF/web.xml rename {spring_controller => spring-controller}/src/main/webapp/WEB-INF/welcome.jsp (97%) create mode 100644 spring-controller/src/test/java/com/baledung/test/ControllerTest.java delete mode 100644 spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java delete mode 100644 spring_controller/src/main/java/com/baledung/controller/TestController.java delete mode 100644 spring_controller/src/main/webapp/WEB-INF/test-mvc.xml delete mode 100644 spring_controller/src/main/webapp/WEB-INF/web.xml delete mode 100644 spring_controller/src/test/java/com/baledung/test/ControllerTest.java diff --git a/pom.xml b/pom.xml index 5820989816..1966d1485a 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ spring-apache-camel spring-batch spring-boot + spring-controller spring-data-cassandra spring-data-elasticsearch spring-data-mongodb diff --git a/spring-batch/.classpath b/spring-batch/.classpath deleted file mode 100644 index e7ac9faf11..0000000000 --- a/spring-batch/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-batch/.project b/spring-batch/.project deleted file mode 100644 index 0159a7237c..0000000000 --- a/spring-batch/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring-batch - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring_controller/pom.xml b/spring-controller/pom.xml similarity index 92% rename from spring_controller/pom.xml rename to spring-controller/pom.xml index 661c46a4b9..d9fd79c095 100644 --- a/spring_controller/pom.xml +++ b/spring-controller/pom.xml @@ -1,56 +1,56 @@ - - 4.0.0 - test - test-mvc - 0.0.1-SNAPSHOT - war - - - - org.springframework - spring-webmvc - 4.3.0.RELEASE - - - - javax.servlet - javax.servlet-api - 3.0.1 - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.6.3 - - - com.fasterxml.jackson.core - jackson-annotations - 2.6.3 - - - com.fasterxml.jackson.core - jackson-core - 2.6.3 - - - org.springframework - spring-web - 4.3.0.RELEASE - - - - junit - junit - 4.12 - test - - - org.springframework - spring-test - 4.1.7.RELEASE - - - - + + 4.0.0 + test + spring-controller + 0.0.1-SNAPSHOT + war + + + + org.springframework + spring-webmvc + 4.3.0.RELEASE + + + + javax.servlet + javax.servlet-api + 3.0.1 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + + + com.fasterxml.jackson.core + jackson-annotations + 2.6.3 + + + com.fasterxml.jackson.core + jackson-core + 2.6.3 + + + org.springframework + spring-web + 4.3.0.RELEASE + + + + junit + junit + 4.12 + test + + + org.springframework + spring-test + 4.2.6.RELEASE + + + + \ No newline at end of file diff --git a/spring-controller/src/main/java/com/baledung/controller/RestAnnotatedController.java b/spring-controller/src/main/java/com/baledung/controller/RestAnnotatedController.java new file mode 100644 index 0000000000..15f9ba14d4 --- /dev/null +++ b/spring-controller/src/main/java/com/baledung/controller/RestAnnotatedController.java @@ -0,0 +1,19 @@ +package com.baledung.controller; + +import com.baledung.student.Student; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RestAnnotatedController { + + @GetMapping(value = "/annotated/student/{studentId}") + public Student getData(@PathVariable Integer studentId) { + Student student = new Student(); + student.setName("Peter"); + student.setId(studentId); + + return student; + } +} diff --git a/spring_controller/src/main/java/com/baledung/controller/RestController.java b/spring-controller/src/main/java/com/baledung/controller/RestController.java similarity index 54% rename from spring_controller/src/main/java/com/baledung/controller/RestController.java rename to spring-controller/src/main/java/com/baledung/controller/RestController.java index 226f66b5df..e9afa88471 100644 --- a/spring_controller/src/main/java/com/baledung/controller/RestController.java +++ b/spring-controller/src/main/java/com/baledung/controller/RestController.java @@ -1,30 +1,21 @@ -package com.baledung.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.baledung.student.Student; - -@Controller -public class RestController{ - - /** - * Get a student based on the id of the student - * specified in path variable {studentId} - * @param studentId - * @return - */ - @RequestMapping(value="/student/{studentId}",method=RequestMethod.GET) - public @ResponseBody Student getTestData(@PathVariable Integer studentId) - { - Student student = new Student(); - student.setName("Peter"); - student.setId(studentId); - - return student; - - } -} +package com.baledung.controller; + +import com.baledung.student.Student; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class RestController{ + + @GetMapping(value="/student/{studentId}") + public @ResponseBody Student getTestData(@PathVariable Integer studentId) { + Student student = new Student(); + student.setName("Peter"); + student.setId(studentId); + + return student; + + } +} diff --git a/spring-controller/src/main/java/com/baledung/controller/TestController.java b/spring-controller/src/main/java/com/baledung/controller/TestController.java new file mode 100644 index 0000000000..8a9939b371 --- /dev/null +++ b/spring-controller/src/main/java/com/baledung/controller/TestController.java @@ -0,0 +1,24 @@ + +/** + * @author Prashant Dutta + */ +package com.baledung.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping(value = "/test") +public class TestController { + + @GetMapping + public ModelAndView getTestData() { + ModelAndView mv = new ModelAndView(); + mv.setViewName("welcome"); + mv.getModel().put("data", "Welcome home man"); + + return mv; + } +} \ No newline at end of file diff --git a/spring_controller/src/main/java/com/baledung/student/Student.java b/spring-controller/src/main/java/com/baledung/student/Student.java similarity index 69% rename from spring_controller/src/main/java/com/baledung/student/Student.java rename to spring-controller/src/main/java/com/baledung/student/Student.java index 8cf0b5e263..7a5606415f 100644 --- a/spring_controller/src/main/java/com/baledung/student/Student.java +++ b/spring-controller/src/main/java/com/baledung/student/Student.java @@ -1,40 +1,33 @@ -/** - * - */ -package com.baledung.student; - -public class Student -{ - private String name; - - private int id; - -//----------------------------- getters and setters-------------------------------------------------------- - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - @Override - public int hashCode(){ - return this.id; - } - - @Override - public boolean equals(Object obj){ - return this.name.equals(((Student)obj).getName()); - } - - +package com.baledung.student; + +public class Student { + private String name; + + private int id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public int hashCode(){ + return this.id; + } + + @Override + public boolean equals(Object obj){ + return this.name.equals(((Student)obj).getName()); + } } \ No newline at end of file diff --git a/spring_controller/src/main/resources/test-mvc.xml b/spring-controller/src/main/resources/test-mvc.xml similarity index 97% rename from spring_controller/src/main/resources/test-mvc.xml rename to spring-controller/src/main/resources/test-mvc.xml index c632a5e435..fec69e2dec 100644 --- a/spring_controller/src/main/resources/test-mvc.xml +++ b/spring-controller/src/main/resources/test-mvc.xml @@ -1,24 +1,24 @@ - - - - - - - - /WEB-INF/ - - - .jsp - - + + + + + + + + /WEB-INF/ + + + .jsp + + \ No newline at end of file diff --git a/spring-controller/src/main/webapp/WEB-INF/web.xml b/spring-controller/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..4e0e7a231c --- /dev/null +++ b/spring-controller/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + test-mvc + + org.springframework.web.servlet.DispatcherServlet + + 1 + + contextConfigLocation + /WEB-INF/test-mvc.xml + + + + + test-mvc + /test/* + + + + /WEB-INF/index.jsp + + diff --git a/spring_controller/src/main/webapp/WEB-INF/welcome.jsp b/spring-controller/src/main/webapp/WEB-INF/welcome.jsp similarity index 97% rename from spring_controller/src/main/webapp/WEB-INF/welcome.jsp rename to spring-controller/src/main/webapp/WEB-INF/welcome.jsp index 17d5589e74..61ee4bc7d6 100644 --- a/spring_controller/src/main/webapp/WEB-INF/welcome.jsp +++ b/spring-controller/src/main/webapp/WEB-INF/welcome.jsp @@ -1,12 +1,12 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - - - -Insert title here - - -Data returned is ${data} - +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +Insert title here + + +Data returned is ${data} + \ No newline at end of file diff --git a/spring-controller/src/test/java/com/baledung/test/ControllerTest.java b/spring-controller/src/test/java/com/baledung/test/ControllerTest.java new file mode 100644 index 0000000000..7f56d09112 --- /dev/null +++ b/spring-controller/src/test/java/com/baledung/test/ControllerTest.java @@ -0,0 +1,83 @@ +package com.baledung.test; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.ModelAndView; + +import com.baledung.student.Student; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration({"classpath:test-mvc.xml"}) +public class ControllerTest { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + private Student selectedStudent; + + @Before + public void setUp() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + + selectedStudent = new Student(); + selectedStudent.setId(1); + selectedStudent.setName("Peter"); + } + + @Test + public void testTestController() throws Exception { + + ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/test/")) + .andReturn() + .getModelAndView(); + + // validate modal data + Assert.assertSame(mv.getModelMap().get("data").toString(), "Welcome home man"); + + // validate view name + Assert.assertSame(mv.getViewName(), "welcome"); + } + + @Test + public void testRestController() throws Exception { + + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/student/{studentId}", 1)) + .andReturn().getResponse() + .getContentAsString(); + + ObjectMapper reader = new ObjectMapper(); + + Student studentDetails = reader.readValue(responseBody, Student.class); + + Assert.assertEquals(selectedStudent, studentDetails); + + } + + @Test + public void testRestAnnotatedController() throws Exception { + + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/annotated/student/{studentId}", 1)) + .andReturn().getResponse() + .getContentAsString(); + + ObjectMapper reader = new ObjectMapper(); + + Student studentDetails = reader.readValue(responseBody, Student.class); + + Assert.assertEquals(selectedStudent, studentDetails); + } +} diff --git a/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java b/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java deleted file mode 100644 index c01d074b97..0000000000 --- a/spring_controller/src/main/java/com/baledung/controller/RestAnnotatedController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baledung.controller; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baledung.student.Student; - -@RestController -public class RestAnnotatedController -{ - @RequestMapping(value="/annotated/student/{studentId}") - public Student getData(@PathVariable Integer studentId) - { - Student student = new Student(); - student.setName("Peter"); - student.setId(studentId); - - return student; - } -} diff --git a/spring_controller/src/main/java/com/baledung/controller/TestController.java b/spring_controller/src/main/java/com/baledung/controller/TestController.java deleted file mode 100644 index 5dafc14d84..0000000000 --- a/spring_controller/src/main/java/com/baledung/controller/TestController.java +++ /dev/null @@ -1,26 +0,0 @@ - -/** - * @author Prashant Dutta - * - */ -package com.baledung.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -@Controller -@RequestMapping(value="/test") -public class TestController{ - - @RequestMapping(method=RequestMethod.GET) - public ModelAndView getTestData() - { - ModelAndView mv = new ModelAndView(); - mv.setViewName("welcome"); - mv.getModel().put("data", "Welcome home man"); - - return mv; - } -} \ No newline at end of file diff --git a/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml b/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml deleted file mode 100644 index c48e4f94f6..0000000000 --- a/spring_controller/src/main/webapp/WEB-INF/test-mvc.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - /WEB-INF/ - - - .jsp - - - \ No newline at end of file diff --git a/spring_controller/src/main/webapp/WEB-INF/web.xml b/spring_controller/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a1545a8d51..0000000000 --- a/spring_controller/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - test-mvc - - org.springframework.web.servlet.DispatcherServlet - - 1 - - contextConfigLocation - /WEB-INF/test-mvc.xml - - - - - test-mvc - /test/* - - - - - - - /WEB-INF/index.jsp - - diff --git a/spring_controller/src/test/java/com/baledung/test/ControllerTest.java b/spring_controller/src/test/java/com/baledung/test/ControllerTest.java deleted file mode 100644 index 6a2567a29a..0000000000 --- a/spring_controller/src/test/java/com/baledung/test/ControllerTest.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.baledung.test; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.ModelAndView; - -import com.baledung.student.Student; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - *

- * Test class for spring controllers - *

- * @author Prashant.Dutta - */ -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration({"classpath:test-mvc.xml"}) -public class ControllerTest -{ - private MockMvc mockMvc; - - @Autowired - private WebApplicationContext wac; - - private Student selectedStudent; - - @Before - public void setUp() - { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); - - selectedStudent = new Student(); - selectedStudent.setId(1); - selectedStudent.setName("Peter"); - } - - /** - * Test basic test controller - * @throws Exception - */ - @Test - public void testTestController() throws Exception - { - - ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/test/")) - .andReturn() - .getModelAndView(); - - // validate modal data - Assert.assertSame(mv.getModelMap().get("data").toString(), "Welcome home man"); - - // validate view name - Assert.assertSame(mv.getViewName(), "welcome"); - } - - /** - * Test rest controller - * @throws Exception - */ - @Test - public void testRestController() throws Exception - { - - String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/student/{studentId}",1)) - .andReturn().getResponse() - .getContentAsString(); - - ObjectMapper reader = new ObjectMapper(); - - Student studentDetails = reader.readValue(responseBody, Student.class); - - Assert.assertEquals(selectedStudent, studentDetails); - - } - - /** - * Test rest controller annotated with test - * @throws Exception - */ - @Test - public void testRestAnnotatedController() throws Exception - { - - String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/annotated/student/{studentId}",1)) - .andReturn().getResponse() - .getContentAsString(); - - ObjectMapper reader = new ObjectMapper(); - - Student studentDetails = reader.readValue(responseBody, Student.class); - - Assert.assertEquals(selectedStudent, studentDetails); - } -} From 97ba59c59f3e6f75eb3d33733912cd07969713f3 Mon Sep 17 00:00:00 2001 From: Zeger Hendrikse Date: Fri, 15 Jul 2016 12:54:28 +0200 Subject: [PATCH 19/32] Replaced tabs by spaces --- apache-cxf/cxf-introduction/pom.xml | 88 +++++------ apache-cxf/cxf-spring/pom.xml | 232 ++++++++++++++-------------- apache-cxf/pom.xml | 80 +++++----- 3 files changed, 200 insertions(+), 200 deletions(-) diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf/cxf-introduction/pom.xml index 27a2978956..232a4f0089 100644 --- a/apache-cxf/cxf-introduction/pom.xml +++ b/apache-cxf/cxf-introduction/pom.xml @@ -1,47 +1,47 @@ - 4.0.0 - cxf-introduction - - com.baeldung - apache-cxf - 0.0.1-SNAPSHOT - - - 3.1.6 - - - - - org.codehaus.mojo - exec-maven-plugin - - com.baeldung.cxf.introduction.Server - - - - maven-surefire-plugin - 2.19.1 - - - **/StudentTest.java - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${cxf.version} - - - org.apache.cxf - cxf-rt-transports-http-jetty - ${cxf.version} - - - \ No newline at end of file + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + cxf-introduction + + com.baeldung + apache-cxf + 0.0.1-SNAPSHOT + + + 3.1.6 + + + + + org.codehaus.mojo + exec-maven-plugin + + com.baeldung.cxf.introduction.Server + + + + maven-surefire-plugin + 2.19.1 + + + **/StudentTest.java + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + + + org.apache.cxf + cxf-rt-transports-http-jetty + ${cxf.version} + + +
diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf/cxf-spring/pom.xml index 02750dd790..431c35c51d 100644 --- a/apache-cxf/cxf-spring/pom.xml +++ b/apache-cxf/cxf-spring/pom.xml @@ -1,117 +1,117 @@ - 4.0.0 - cxf-spring - war - - com.baeldung - apache-cxf - 0.0.1-SNAPSHOT - - - 3.1.6 - 4.3.1.RELEASE - 2.19.1 - - - - - maven-war-plugin - 2.6 - - src/main/webapp/WEB-INF/web.xml - - - - maven-surefire-plugin - ${surefire.version} - - - StudentTest.java - - - - - - - - integration - - - - org.codehaus.cargo - cargo-maven2-plugin - 1.5.0 - - - jetty9x - embedded - - - - localhost - 8080 - - - - - - start-server - pre-integration-test - - start - - - - stop-server - post-integration-test - - stop - - - - - - maven-surefire-plugin - ${surefire.version} - - - integration-test - - test - - - - none - - - - - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${cxf.version} - - - org.apache.cxf - cxf-rt-transports-http-jetty - ${cxf.version} - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-web - ${spring.version} - - - \ No newline at end of file + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + cxf-spring + war + + com.baeldung + apache-cxf + 0.0.1-SNAPSHOT + + + 3.1.6 + 4.3.1.RELEASE + 2.19.1 + + + + + maven-war-plugin + 2.6 + + src/main/webapp/WEB-INF/web.xml + + + + maven-surefire-plugin + ${surefire.version} + + + StudentTest.java + + + + + + + + integration + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.5.0 + + + jetty9x + embedded + + + + localhost + 8080 + + + + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + + + maven-surefire-plugin + ${surefire.version} + + + integration-test + + test + + + + none + + + + + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + + + org.apache.cxf + cxf-rt-transports-http-jetty + ${cxf.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index e86e4be5cd..022fc59f9b 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,41 +1,41 @@ - 4.0.0 - com.baeldung - apache-cxf - 0.0.1-SNAPSHOT - pom - - cxf-introduction - cxf-spring - - - - junit - junit - 4.12 - test - - - - install - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - org.codehaus.mojo - exec-maven-plugin - 1.5.0 - - - - - \ No newline at end of file + 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 + apache-cxf + 0.0.1-SNAPSHOT + pom + + cxf-introduction + cxf-spring + + + + junit + junit + 4.12 + test + + + + install + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.codehaus.mojo + exec-maven-plugin + 1.5.0 + + + + + From a7b1b46e6056533be800553ebe32242cb21d9cb3 Mon Sep 17 00:00:00 2001 From: Zeger Hendrikse Date: Fri, 15 Jul 2016 13:02:13 +0200 Subject: [PATCH 20/32] Replaced tabs by spaces --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 10 ++++---- .../src/main/webapp/WEB-INF/web.xml | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml index 7669d3f942..9fe87ba9ee 100644 --- a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -1,7 +1,7 @@ - - \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" + xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> + + diff --git a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml index 0d7687771b..43a03b1d8b 100644 --- a/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml +++ b/apache-cxf/cxf-spring/src/main/webapp/WEB-INF/web.xml @@ -1,14 +1,14 @@ - - cxf - org.apache.cxf.transport.servlet.CXFServlet - 1 - - - cxf - /services/* - - \ No newline at end of file + version="3.0" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> + + cxf + org.apache.cxf.transport.servlet.CXFServlet + 1 + + + cxf + /services/* + + From ca889aec4174105efbb160f12a760544691f726e Mon Sep 17 00:00:00 2001 From: Zeger Hendrikse Date: Fri, 15 Jul 2016 13:08:52 +0200 Subject: [PATCH 21/32] Replaced tabs by spaces --- .../src/main/resources/client-beans.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apache-cxf/cxf-spring/src/main/resources/client-beans.xml b/apache-cxf/cxf-spring/src/main/resources/client-beans.xml index 3f30562193..626252b565 100644 --- a/apache-cxf/cxf-spring/src/main/resources/client-beans.xml +++ b/apache-cxf/cxf-spring/src/main/resources/client-beans.xml @@ -1,10 +1,10 @@ - - - - - - \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" + xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd"> + + + + + + From 6fa4a43d39e8103bfaaa767322619c9e01267fe2 Mon Sep 17 00:00:00 2001 From: chernykhalexander Date: Sat, 16 Jul 2016 00:48:09 +0300 Subject: [PATCH 22/32] added spring boot starters module --- pom.xml | 1 + spring-boot-starters/.gitignore | 1 + spring-boot-starters/README.MD | 2 + spring-boot-starters/pom.xml | 91 +++++++++++++++++++ .../main/java/org/baeldung/Application.java | 16 ++++ .../controller/GenericEntityController.java | 38 ++++++++ .../org/baeldung/domain/GenericEntity.java | 42 +++++++++ .../repository/GenericEntityRepository.java | 7 ++ .../src/main/resources/application.properties | 2 + .../baeldung/SpringBootApplicationTest.java | 54 +++++++++++ .../java/org/baeldung/SpringBootJPATest.java | 27 ++++++ .../java/org/baeldung/SpringBootMailTest.java | 82 +++++++++++++++++ .../src/test/resources/application.properties | 3 + 13 files changed, 366 insertions(+) create mode 100644 spring-boot-starters/.gitignore create mode 100644 spring-boot-starters/README.MD create mode 100644 spring-boot-starters/pom.xml create mode 100644 spring-boot-starters/src/main/java/org/baeldung/Application.java create mode 100644 spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java create mode 100644 spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java create mode 100644 spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java create mode 100644 spring-boot-starters/src/main/resources/application.properties create mode 100644 spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java create mode 100644 spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java create mode 100644 spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java create mode 100644 spring-boot-starters/src/test/resources/application.properties diff --git a/pom.xml b/pom.xml index 1966d1485a..0bdba095c1 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ spring-apache-camel spring-batch spring-boot + spring-boot-starters spring-controller spring-data-cassandra spring-data-elasticsearch diff --git a/spring-boot-starters/.gitignore b/spring-boot-starters/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/spring-boot-starters/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/spring-boot-starters/README.MD b/spring-boot-starters/README.MD new file mode 100644 index 0000000000..2a87b46021 --- /dev/null +++ b/spring-boot-starters/README.MD @@ -0,0 +1,2 @@ +###The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml new file mode 100644 index 0000000000..87784e7690 --- /dev/null +++ b/spring-boot-starters/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + com.baeldung + spring-boot-starters + 0.0.1-SNAPSHOT + Spring Boot Starters + This is simple boot application for Spring boot starters + + + + org.springframework.boot + spring-boot-starter-parent + 1.3.3.RELEASE + + + + UTF-8 + 1.8 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + com.jayway.jsonpath + json-path + test + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-mail + + + org.subethamail + subethasmtp + 3.1.7 + test + + + + + spring-boot + + + src/main/resources + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-starters/src/main/java/org/baeldung/Application.java b/spring-boot-starters/src/main/java/org/baeldung/Application.java new file mode 100644 index 0000000000..453264820f --- /dev/null +++ b/spring-boot-starters/src/main/java/org/baeldung/Application.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; + +import java.util.Queue; + +@org.springframework.boot.autoconfigure.SpringBootApplication +public class Application { + private static ApplicationContext applicationContext; + + public static void main(String[] args) { + applicationContext = SpringApplication.run(Application.class, args); + } +} diff --git a/spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java b/spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java new file mode 100644 index 0000000000..b6f88e7cd5 --- /dev/null +++ b/spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java @@ -0,0 +1,38 @@ +package org.baeldung.controller; + +import org.baeldung.domain.GenericEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@RestController +public class GenericEntityController { + private List entityList = new ArrayList<>(); + + { + entityList.add(new GenericEntity(1l, "entity_1")); + entityList.add(new GenericEntity(2l, "entity_2")); + entityList.add(new GenericEntity(3l, "entity_3")); + entityList.add(new GenericEntity(4l, "entity_4")); + } + + @RequestMapping("/entity/all") + public List findAll() { + return entityList; + } + + @RequestMapping(value = "/entity", method = RequestMethod.POST) + public GenericEntity addEntity(GenericEntity entity) { + entityList.add(entity); + return entity; + } + + @RequestMapping("/entity/findby/{id}") + public GenericEntity findById(@PathVariable Long id) { + return entityList.stream().filter(entity -> entity.getId().equals(id)).findFirst().get(); + } +} diff --git a/spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java b/spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java new file mode 100644 index 0000000000..7b1d27cb66 --- /dev/null +++ b/spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java @@ -0,0 +1,42 @@ +package org.baeldung.domain; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class GenericEntity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String value; + + public GenericEntity() { + } + + public GenericEntity(String value) { + this.value = value; + } + + public GenericEntity(Long id, String value) { + this.id = id; + this.value = value; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java b/spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java new file mode 100644 index 0000000000..7bb1e6dcdc --- /dev/null +++ b/spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java @@ -0,0 +1,7 @@ +package org.baeldung.repository; + +import org.baeldung.domain.GenericEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface GenericEntityRepository extends JpaRepository { +} diff --git a/spring-boot-starters/src/main/resources/application.properties b/spring-boot-starters/src/main/resources/application.properties new file mode 100644 index 0000000000..6b0388e0c3 --- /dev/null +++ b/spring-boot-starters/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.port=8080 +server.contextPath=/springbootapp diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java b/spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java new file mode 100644 index 0000000000..fea5cbd057 --- /dev/null +++ b/spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java @@ -0,0 +1,54 @@ +package org.baeldung; + +import org.baeldung.domain.GenericEntity; +import org.baeldung.repository.GenericEntityRepository; +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.SpringApplicationConfiguration; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import java.nio.charset.Charset; + +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = Application.class) +@WebAppConfiguration +public class SpringBootApplicationTest { + @Autowired + private WebApplicationContext webApplicationContext; + private MockMvc mockMvc; + + + @Before + public void setupMockMvc() { + mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) + .build(); + } + + @Test + public void givenRequestHasBeenMade_whenMeetsAllOfGivenConditions_thenCorrect() throws Exception { + MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), + MediaType.APPLICATION_JSON.getSubtype(), + Charset.forName("utf8")); + + mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")). + andExpect(MockMvcResultMatchers.status().isOk()). + andExpect(MockMvcResultMatchers.content().contentType(contentType)). + andExpect(jsonPath("$", hasSize(4))); + } + + +} diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java b/spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java new file mode 100644 index 0000000000..8a6b5139fe --- /dev/null +++ b/spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java @@ -0,0 +1,27 @@ +package org.baeldung; + +import org.baeldung.domain.GenericEntity; +import org.baeldung.repository.GenericEntityRepository; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = Application.class) +public class SpringBootJPATest { + @Autowired + private GenericEntityRepository genericEntityRepository; + + @Test + public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() { + GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test")); + GenericEntity foundedEntity = genericEntityRepository.findOne(genericEntity.getId()); + assertNotNull(foundedEntity); + assertEquals(genericEntity.getValue(), foundedEntity.getValue()); + } +} diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java b/spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java new file mode 100644 index 0000000000..2e436ece2e --- /dev/null +++ b/spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java @@ -0,0 +1,82 @@ +package org.baeldung; + +import org.junit.After; +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.SpringApplicationConfiguration; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.context.WebApplicationContext; +import org.subethamail.wiser.Wiser; +import org.subethamail.wiser.WiserMessage; + +import javax.mail.MessagingException; +import java.io.IOException; +import java.util.List; + +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = Application.class) +public class SpringBootMailTest { + @Autowired + private JavaMailSender javaMailSender; + + private Wiser wiser; + + private String userTo = "user2@localhost"; + private String userFrom = "user1@localhost"; + private String subject = "Test subject"; + private String textMail = "Text subject mail"; + + @Before + public void setUp() throws Exception { + final int TEST_PORT = 25; + wiser = new Wiser(TEST_PORT); + wiser.start(); + } + + @After + public void tearDown() throws Exception { + wiser.stop(); + } + + @Test + public void givenMail_whenSendAndReceived_thenCorrect() throws Exception { + SimpleMailMessage message = composeEmailMessage(); + javaMailSender.send(message); + List messages = wiser.getMessages(); + + assertThat(messages, hasSize(1)); + WiserMessage wiserMessage = messages.get(0); + assertEquals(userFrom, wiserMessage.getEnvelopeSender()); + assertEquals(userTo, wiserMessage.getEnvelopeReceiver()); + assertEquals(subject, getSubject(wiserMessage)); + assertEquals(textMail, getMessage(wiserMessage)); + } + + private String getMessage(WiserMessage wiserMessage) throws MessagingException, IOException { + return wiserMessage.getMimeMessage().getContent().toString().trim(); + } + + private String getSubject(WiserMessage wiserMessage) throws MessagingException { + return wiserMessage.getMimeMessage().getSubject(); + } + + + private SimpleMailMessage composeEmailMessage() { + SimpleMailMessage mailMessage = new SimpleMailMessage(); + mailMessage.setTo(userTo); + mailMessage.setReplyTo(userFrom); + mailMessage.setFrom(userFrom); + mailMessage.setSubject(subject); + mailMessage.setText(textMail); + return mailMessage; + } +} diff --git a/spring-boot-starters/src/test/resources/application.properties b/spring-boot-starters/src/test/resources/application.properties new file mode 100644 index 0000000000..bcfcf4b2fb --- /dev/null +++ b/spring-boot-starters/src/test/resources/application.properties @@ -0,0 +1,3 @@ +spring.mail.host=localhost +spring.mail.port=25 +spring.mail.properties.mail.smtp.auth=false \ No newline at end of file From 0944745a02d3d6c597661787b5036dcd880064a9 Mon Sep 17 00:00:00 2001 From: chernykhalexander Date: Sat, 16 Jul 2016 00:51:09 +0300 Subject: [PATCH 23/32] comment out spring-boot-starters module in parent pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0bdba095c1..a8ff5602fc 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ spring-apache-camel spring-batch spring-boot - spring-boot-starters + spring-controller spring-data-cassandra spring-data-elasticsearch From 3b8ec66168e93407d54e33c799e5550d6f4b9e0e Mon Sep 17 00:00:00 2001 From: Chernykh Alexander Date: Sat, 16 Jul 2016 01:02:56 +0300 Subject: [PATCH 24/32] removed module from pom.xml --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index a8ff5602fc..1966d1485a 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,6 @@ spring-apache-camel spring-batch spring-boot - spring-controller spring-data-cassandra spring-data-elasticsearch From c960c2f2a87ca9ccc7d3db743f6aadea999d2f19 Mon Sep 17 00:00:00 2001 From: Chernykh Alexander Date: Sat, 16 Jul 2016 01:05:19 +0300 Subject: [PATCH 25/32] cleaned up whitespaces --- spring-boot-starters/pom.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index 87784e7690..ae5d9c6617 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -68,12 +68,10 @@
- org.springframework.boot spring-boot-maven-plugin - org.apache.maven.plugins maven-compiler-plugin @@ -82,10 +80,6 @@ 1.8 - - -
- - \ No newline at end of file + From e3c28f6dcda252a1dfd4e15cddd089c41b4cf83b Mon Sep 17 00:00:00 2001 From: chernykhalexander Date: Sat, 16 Jul 2016 01:38:48 +0300 Subject: [PATCH 26/32] merge into spring-boot module --- spring-boot-starters/.gitignore | 1 - spring-boot-starters/README.MD | 2 - spring-boot-starters/pom.xml | 85 ------------------- .../src/main/resources/application.properties | 2 - spring-boot/pom.xml | 20 +++++ .../main/java/org/baeldung/Application.java | 3 - .../controller/GenericEntityController.java | 0 .../org/baeldung/domain/GenericEntity.java | 0 .../repository/GenericEntityRepository.java | 0 .../src/main/resources/application.properties | 2 +- .../baeldung/SpringBootApplicationTest.java | 0 .../java/org/baeldung/SpringBootJPATest.java | 0 .../java/org/baeldung/SpringBootMailTest.java | 0 .../src/test/resources/application.properties | 0 14 files changed, 21 insertions(+), 94 deletions(-) delete mode 100644 spring-boot-starters/.gitignore delete mode 100644 spring-boot-starters/README.MD delete mode 100644 spring-boot-starters/pom.xml delete mode 100644 spring-boot-starters/src/main/resources/application.properties rename {spring-boot-starters => spring-boot}/src/main/java/org/baeldung/Application.java (84%) rename {spring-boot-starters => spring-boot}/src/main/java/org/baeldung/controller/GenericEntityController.java (100%) rename {spring-boot-starters => spring-boot}/src/main/java/org/baeldung/domain/GenericEntity.java (100%) rename {spring-boot-starters => spring-boot}/src/main/java/org/baeldung/repository/GenericEntityRepository.java (100%) rename {spring-boot-starters => spring-boot}/src/test/java/org/baeldung/SpringBootApplicationTest.java (100%) rename {spring-boot-starters => spring-boot}/src/test/java/org/baeldung/SpringBootJPATest.java (100%) rename {spring-boot-starters => spring-boot}/src/test/java/org/baeldung/SpringBootMailTest.java (100%) rename {spring-boot-starters => spring-boot}/src/test/resources/application.properties (100%) diff --git a/spring-boot-starters/.gitignore b/spring-boot-starters/.gitignore deleted file mode 100644 index b83d22266a..0000000000 --- a/spring-boot-starters/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/spring-boot-starters/README.MD b/spring-boot-starters/README.MD deleted file mode 100644 index 2a87b46021..0000000000 --- a/spring-boot-starters/README.MD +++ /dev/null @@ -1,2 +0,0 @@ -###The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml deleted file mode 100644 index ae5d9c6617..0000000000 --- a/spring-boot-starters/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - com.baeldung - spring-boot-starters - 0.0.1-SNAPSHOT - Spring Boot Starters - This is simple boot application for Spring boot starters - - - - org.springframework.boot - spring-boot-starter-parent - 1.3.3.RELEASE - - - - UTF-8 - 1.8 - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - com.jayway.jsonpath - json-path - test - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-mail - - - org.subethamail - subethasmtp - 3.1.7 - test - - - - - spring-boot - - - src/main/resources - true - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - diff --git a/spring-boot-starters/src/main/resources/application.properties b/spring-boot-starters/src/main/resources/application.properties deleted file mode 100644 index 6b0388e0c3..0000000000 --- a/spring-boot-starters/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.port=8080 -server.contextPath=/springbootapp diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 368dfa19c1..4ac008cfc8 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -60,6 +60,26 @@ spring-boot-starter-test test + + + org.springframework.boot + spring-boot-starter + + + com.jayway.jsonpath + json-path + test + + + org.springframework.boot + spring-boot-starter-mail + + + org.subethamail + subethasmtp + 3.1.7 + test + diff --git a/spring-boot-starters/src/main/java/org/baeldung/Application.java b/spring-boot/src/main/java/org/baeldung/Application.java similarity index 84% rename from spring-boot-starters/src/main/java/org/baeldung/Application.java rename to spring-boot/src/main/java/org/baeldung/Application.java index 453264820f..aae0c427a9 100644 --- a/spring-boot-starters/src/main/java/org/baeldung/Application.java +++ b/spring-boot/src/main/java/org/baeldung/Application.java @@ -2,9 +2,6 @@ package org.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; - -import java.util.Queue; @org.springframework.boot.autoconfigure.SpringBootApplication public class Application { diff --git a/spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java b/spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java similarity index 100% rename from spring-boot-starters/src/main/java/org/baeldung/controller/GenericEntityController.java rename to spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java diff --git a/spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java b/spring-boot/src/main/java/org/baeldung/domain/GenericEntity.java similarity index 100% rename from spring-boot-starters/src/main/java/org/baeldung/domain/GenericEntity.java rename to spring-boot/src/main/java/org/baeldung/domain/GenericEntity.java diff --git a/spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java b/spring-boot/src/main/java/org/baeldung/repository/GenericEntityRepository.java similarity index 100% rename from spring-boot-starters/src/main/java/org/baeldung/repository/GenericEntityRepository.java rename to spring-boot/src/main/java/org/baeldung/repository/GenericEntityRepository.java diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index 8ee0ed29bc..78bcf4cc05 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=8083 +server.port=8080 server.contextPath=/springbootapp management.port=8081 management.address=127.0.0.1 diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java similarity index 100% rename from spring-boot-starters/src/test/java/org/baeldung/SpringBootApplicationTest.java rename to spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java b/spring-boot/src/test/java/org/baeldung/SpringBootJPATest.java similarity index 100% rename from spring-boot-starters/src/test/java/org/baeldung/SpringBootJPATest.java rename to spring-boot/src/test/java/org/baeldung/SpringBootJPATest.java diff --git a/spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootMailTest.java similarity index 100% rename from spring-boot-starters/src/test/java/org/baeldung/SpringBootMailTest.java rename to spring-boot/src/test/java/org/baeldung/SpringBootMailTest.java diff --git a/spring-boot-starters/src/test/resources/application.properties b/spring-boot/src/test/resources/application.properties similarity index 100% rename from spring-boot-starters/src/test/resources/application.properties rename to spring-boot/src/test/resources/application.properties From 5b28a3c19a8c144ebee83e500c9a269997c73f27 Mon Sep 17 00:00:00 2001 From: Chernykh Alexander Date: Sat, 16 Jul 2016 01:47:48 +0300 Subject: [PATCH 27/32] fixed whitespaces --- .../src/test/java/org/baeldung/SpringBootApplicationTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java index fea5cbd057..ac7bcd62a9 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java +++ b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationTest.java @@ -49,6 +49,4 @@ public class SpringBootApplicationTest { andExpect(MockMvcResultMatchers.content().contentType(contentType)). andExpect(jsonPath("$", hasSize(4))); } - - } From 57ca43141506e384deffc5fdec8554660bde7a1b Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Sat, 16 Jul 2016 10:51:50 +0300 Subject: [PATCH 28/32] Add list assertions example --- core-java/.classpath | 36 ------- ...e.wst.jsdt.core.javascriptValidator.launch | 7 -- core-java/.project | 36 ------- core-java/.settings/.jsdtscope | 5 - .../.settings/org.eclipse.jdt.core.prefs | 100 ------------------ core-java/.settings/org.eclipse.jdt.ui.prefs | 55 ---------- .../.settings/org.eclipse.m2e.core.prefs | 4 - core-java/.settings/org.eclipse.m2e.wtp.prefs | 2 - .../org.eclipse.wst.common.component | 8 -- ....eclipse.wst.common.project.facet.core.xml | 4 - ...rg.eclipse.wst.jsdt.ui.superType.container | 1 - .../org.eclipse.wst.jsdt.ui.superType.name | 1 - .../org.eclipse.wst.validation.prefs | 14 --- .../org.eclipse.wst.ws.service.policy.prefs | 2 - core-java/.springBeans | 14 --- core-java/pom.xml | 18 ++++ .../baeldung/java/lists/ListAssertJTest.java | 25 +++++ .../baeldung/java/lists/ListJUnitTest.java | 21 ++++ .../baeldung/java/lists/ListTestNGTest.java | 21 ++++ 19 files changed, 85 insertions(+), 289 deletions(-) delete mode 100644 core-java/.classpath delete mode 100644 core-java/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch delete mode 100644 core-java/.project delete mode 100644 core-java/.settings/.jsdtscope delete mode 100644 core-java/.settings/org.eclipse.jdt.core.prefs delete mode 100644 core-java/.settings/org.eclipse.jdt.ui.prefs delete mode 100644 core-java/.settings/org.eclipse.m2e.core.prefs delete mode 100644 core-java/.settings/org.eclipse.m2e.wtp.prefs delete mode 100644 core-java/.settings/org.eclipse.wst.common.component delete mode 100644 core-java/.settings/org.eclipse.wst.common.project.facet.core.xml delete mode 100644 core-java/.settings/org.eclipse.wst.jsdt.ui.superType.container delete mode 100644 core-java/.settings/org.eclipse.wst.jsdt.ui.superType.name delete mode 100644 core-java/.settings/org.eclipse.wst.validation.prefs delete mode 100644 core-java/.settings/org.eclipse.wst.ws.service.policy.prefs delete mode 100644 core-java/.springBeans create mode 100644 core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/lists/ListJUnitTest.java create mode 100644 core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java diff --git a/core-java/.classpath b/core-java/.classpath deleted file mode 100644 index ca829f1262..0000000000 --- a/core-java/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core-java/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/core-java/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch deleted file mode 100644 index 627021fb96..0000000000 --- a/core-java/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/core-java/.project b/core-java/.project deleted file mode 100644 index 12bfa7d869..0000000000 --- a/core-java/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - core-java - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - - diff --git a/core-java/.settings/.jsdtscope b/core-java/.settings/.jsdtscope deleted file mode 100644 index 7b3f0c8b9f..0000000000 --- a/core-java/.settings/.jsdtscope +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/core-java/.settings/org.eclipse.jdt.core.prefs b/core-java/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1882edb712..0000000000 --- a/core-java/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,100 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=error -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/core-java/.settings/org.eclipse.jdt.ui.prefs b/core-java/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 471e9b0d81..0000000000 --- a/core-java/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,55 +0,0 @@ -#Sat Jan 21 23:04:06 EET 2012 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=true -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=true -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=false -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=false -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/core-java/.settings/org.eclipse.m2e.core.prefs b/core-java/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/core-java/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/core-java/.settings/org.eclipse.m2e.wtp.prefs b/core-java/.settings/org.eclipse.m2e.wtp.prefs deleted file mode 100644 index ef86089622..0000000000 --- a/core-java/.settings/org.eclipse.m2e.wtp.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false diff --git a/core-java/.settings/org.eclipse.wst.common.component b/core-java/.settings/org.eclipse.wst.common.component deleted file mode 100644 index e98377cb0f..0000000000 --- a/core-java/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/core-java/.settings/org.eclipse.wst.common.project.facet.core.xml b/core-java/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index f4ef8aa0a5..0000000000 --- a/core-java/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.container b/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a480..0000000000 --- a/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.name b/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b6ec..0000000000 --- a/core-java/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/core-java/.settings/org.eclipse.wst.validation.prefs b/core-java/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index cacf5451ae..0000000000 --- a/core-java/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,14 +0,0 @@ -DELEGATES_PREFERENCE=delegateValidatorList -USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator; -USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator; -USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.303.v201202090300 -eclipse.preferences.version=1 -override=true -suspend=false -vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01 -vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01 -vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01 -vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01 -vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01 -vals/org.eclipse.wst.jsdt.web.core.JsBatchValidator/global=TF02 -vf.version=3 diff --git a/core-java/.settings/org.eclipse.wst.ws.service.policy.prefs b/core-java/.settings/org.eclipse.wst.ws.service.policy.prefs deleted file mode 100644 index 9cfcabe16f..0000000000 --- a/core-java/.settings/org.eclipse.wst.ws.service.policy.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.wst.ws.service.policy.projectEnabled=false diff --git a/core-java/.springBeans b/core-java/.springBeans deleted file mode 100644 index a79097f40d..0000000000 --- a/core-java/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/api-servlet.xml - - - - diff --git a/core-java/pom.xml b/core-java/pom.xml index cb194a6d9f..bc533607e7 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -101,6 +101,22 @@ test + + org.assertj + assertj-core + ${assertj.version} + test + + + + org.testng + testng + ${testng.version} + test + + + + org.mockito mockito-core @@ -169,6 +185,8 @@ 1.3 4.12 1.10.19 + 6.8 + 3.5.1 4.4.1 4.5 diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java b/core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java new file mode 100644 index 0000000000..b8926946a9 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java @@ -0,0 +1,25 @@ +package org.baeldung.java.lists; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ListAssertJTest { + + private final List list1 = Arrays.asList("1", "2", "3", "4"); + private final List list2 = Arrays.asList("1", "2", "3", "4"); + private final List list3 = Arrays.asList("1", "2", "4", "3"); + + @Test + public void whenTestingForEquality_ShouldBeEqual() throws Exception { + assertThat(list1) + .isEqualTo(list2) + .isNotEqualTo(list3); + + assertThat(list1.equals(list2)).isTrue(); + assertThat(list1.equals(list3)).isFalse(); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListJUnitTest.java b/core-java/src/test/java/org/baeldung/java/lists/ListJUnitTest.java new file mode 100644 index 0000000000..7dddf6c2ce --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/lists/ListJUnitTest.java @@ -0,0 +1,21 @@ +package org.baeldung.java.lists; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +public class ListJUnitTest { + + private final List list1 = Arrays.asList("1", "2", "3", "4"); + private final List list2 = Arrays.asList("1", "2", "3", "4"); + private final List list3 = Arrays.asList("1", "2", "4", "3"); + + @Test + public void whenTestingForEquality_ShouldBeEqual() throws Exception { + Assert.assertEquals(list1, list2); + Assert.assertNotSame(list1, list2); + Assert.assertNotEquals(list1, list3); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java b/core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java new file mode 100644 index 0000000000..fa80d0e224 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java @@ -0,0 +1,21 @@ +package org.baeldung.java.lists; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.List; + +public class ListTestNGTest { + + private final List list1 = Arrays.asList("1", "2", "3", "4"); + private final List list2 = Arrays.asList("1", "2", "3", "4"); + private final List list3 = Arrays.asList("1", "2", "4", "3"); + + @Test + public void whenTestingForEquality_ShouldBeEqual() throws Exception { + Assert.assertEquals(list1, list2); + Assert.assertNotSame(list1, list2); + Assert.assertNotEquals(list1, list3); + } +} From 86a37c79c8fcbbf8878f8d5e3804e64d4945731d Mon Sep 17 00:00:00 2001 From: egimaben Date: Sun, 17 Jul 2016 13:15:36 +0300 Subject: [PATCH 29/32] added maven project for rest assured tutorial --- rest-assured-tutorial/.classpath | 36 +++++ ...e.wst.jsdt.core.javascriptValidator.launch | 7 + rest-assured-tutorial/.gitignore | 13 ++ rest-assured-tutorial/.project | 36 +++++ rest-assured-tutorial/README.md | 7 + rest-assured-tutorial/pom.xml | 86 ++++++++++ .../baeldung/restassured/RestAssuredTest.java | 151 ++++++++++++++++++ .../src/test/resources/.gitignore | 13 ++ .../src/test/resources/employees.xml | 22 +++ .../src/test/resources/event0.json | 37 +++++ .../src/test/resources/odds.json | 28 ++++ .../src/test/resources/teachers.xml | 10 ++ 12 files changed, 446 insertions(+) create mode 100644 rest-assured-tutorial/.classpath create mode 100644 rest-assured-tutorial/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch create mode 100644 rest-assured-tutorial/.gitignore create mode 100644 rest-assured-tutorial/.project create mode 100644 rest-assured-tutorial/README.md create mode 100644 rest-assured-tutorial/pom.xml create mode 100644 rest-assured-tutorial/src/test/java/com/baeldung/restassured/RestAssuredTest.java create mode 100644 rest-assured-tutorial/src/test/resources/.gitignore create mode 100644 rest-assured-tutorial/src/test/resources/employees.xml create mode 100644 rest-assured-tutorial/src/test/resources/event0.json create mode 100644 rest-assured-tutorial/src/test/resources/odds.json create mode 100644 rest-assured-tutorial/src/test/resources/teachers.xml diff --git a/rest-assured-tutorial/.classpath b/rest-assured-tutorial/.classpath new file mode 100644 index 0000000000..8ebf6d9c31 --- /dev/null +++ b/rest-assured-tutorial/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rest-assured-tutorial/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/rest-assured-tutorial/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch new file mode 100644 index 0000000000..627021fb96 --- /dev/null +++ b/rest-assured-tutorial/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch @@ -0,0 +1,7 @@ + + + + + + + diff --git a/rest-assured-tutorial/.gitignore b/rest-assured-tutorial/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/rest-assured-tutorial/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/rest-assured-tutorial/.project b/rest-assured-tutorial/.project new file mode 100644 index 0000000000..8333cfc36c --- /dev/null +++ b/rest-assured-tutorial/.project @@ -0,0 +1,36 @@ + + + rest-assured-tutorial + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/rest-assured-tutorial/README.md b/rest-assured-tutorial/README.md new file mode 100644 index 0000000000..8b81626967 --- /dev/null +++ b/rest-assured-tutorial/README.md @@ -0,0 +1,7 @@ +========= + +## A Guide To REST-Assured + + +### Relevant Articles: + diff --git a/rest-assured-tutorial/pom.xml b/rest-assured-tutorial/pom.xml new file mode 100644 index 0000000000..12c1fe25ca --- /dev/null +++ b/rest-assured-tutorial/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + com.baeldung + rest-assured + 0.1.0-SNAPSHOT + + rest-assured + + + + + + io.rest-assured + rest-assured + 3.0.0 + test + + + io.rest-assured + json-schema-validator + 3.0.0 + + + com.github.fge + json-schema-validator + 2.2.6 + + + com.github.fge + json-schema-core + 1.2.5 + + + + + + + + junit + junit + 4.3 + test + + + + org.hamcrest + hamcrest-all + 1.3 + + + + + + rest-assured + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + + + \ No newline at end of file diff --git a/rest-assured-tutorial/src/test/java/com/baeldung/restassured/RestAssuredTest.java b/rest-assured-tutorial/src/test/java/com/baeldung/restassured/RestAssuredTest.java new file mode 100644 index 0000000000..55c7a6f0d0 --- /dev/null +++ b/rest-assured-tutorial/src/test/java/com/baeldung/restassured/RestAssuredTest.java @@ -0,0 +1,151 @@ +package com.baeldung.restassured; + +import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.post; +import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath; +import static io.restassured.module.jsv.JsonSchemaValidatorSettings.settings; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.containsString; +import io.restassured.module.jsv.JsonSchemaValidator; +import static org.hamcrest.xml.HasXPath.hasXPath; + +import org.junit.Test; + +import com.github.fge.jsonschema.SchemaVersion; +import com.github.fge.jsonschema.cfg.ValidationConfiguration; +import com.github.fge.jsonschema.main.JsonSchemaFactory; + +public class RestAssuredTest { + + @Test + public void givenJsonResponse_whenKeyValuePairMatches_thenCorrect() { + JsonSchemaFactory factory = JsonSchemaFactory + .newBuilder() + .setValidationConfiguration( + ValidationConfiguration.newBuilder() + .setDefaultVersion(SchemaVersion.DRAFTV3) + .freeze()).freeze(); + JsonSchemaValidator.settings = settings().with() + .jsonSchemaFactory(factory).and().with() + .checkedValidation(false); + } + + @Test + public void givenJsonArrayOfSimilarObjects_whenHasGivenValuesForGivenKey_thenCorrect() { + + } + + @Test + public void givenUrl_whenSuccessOnGetsResponse_andJsonHasRequiredKV_thenCorrect() { + + get("/events?id=390").then().statusCode(200).assertThat() + .body("data.id", equalTo(390)); + + } + + @Test + public void givenUrl_whenJsonResponseHasArrayWithGivenValuesUnderKey_thenCorrect() { + + get("/events?id=390").then().assertThat() + .body("odds.price", hasItems("1.30", "5.25")); + + } + + @Test + public void givenUrl_whenJsonResponseConformsToSchema_thenCorrect() { + get("/events?id=390").then().assertThat() + .body(matchesJsonSchemaInClasspath("event_0.json")); + } + + @Test + public void givenUrl_whenValidatesResponseWithInstanceSettings_thenCorrect() { + JsonSchemaFactory jsonSchemaFactory = JsonSchemaFactory + .newBuilder() + .setValidationConfiguration( + ValidationConfiguration.newBuilder() + .setDefaultVersion(SchemaVersion.DRAFTV4) + .freeze()).freeze(); + + get("/events?id=390") + .then() + .assertThat() + .body(matchesJsonSchemaInClasspath("event_0.json").using( + jsonSchemaFactory)); + + } + + @Test + public void givenUrl_whenValidatesResponseWithStaticSettings_thenCorrect() { + + get("/events?id=390") + .then() + .assertThat() + .body(matchesJsonSchemaInClasspath("event_0.json").using( + settings().with().checkedValidation(false))); + + } + + @Test + public void givenUrl_whenCheckingFloatValuePasses_thenCorrect() { + get("/odd").then().assertThat().body("odd.ck", equalTo(12.2f)); + } + + @Test + public void givenUrl_whenXmlResponseValueTestsEqual_thenCorrect() { + post("/employees").then().assertThat() + .body("employees.employee.first-name", equalTo("Jane")); + } + + @Test + public void givenUrl_whenMultipleXmlValuesTestEqual_thenCorrect() { + post("/employees").then().assertThat() + .body("employees.employee.first-name", equalTo("Jane")) + .body("employees.employee.last-name", equalTo("Daisy")) + .body("employees.employee.sex", equalTo("f")); + } + + @Test + public void givenUrl_whenMultipleXmlValuesTestEqualInShortHand_thenCorrect() { + post("/employees") + .then() + .assertThat() + .body("employees.employee.first-name", equalTo("Jane"), + "employees.employee.last-name", equalTo("Daisy"), + "employees.employee.sex", equalTo("f")); + } + + @Test + public void givenUrl_whenValidatesXmlUsingXpath_thenCorrect() { + post("/employees") + .then() + .assertThat() + .body(hasXPath("/employees/employee/first-name", + containsString("Ja"))); + + } + + @Test + public void givenUrl_whenValidatesXmlUsingXpath2_thenCorrect() { + post("/employees") + .then() + .assertThat() + .body(hasXPath("/employees/employee/first-name[text()='Jane']")); + + } + + @Test + public void givenUrl_whenVerifiesScienceTeacherFromXml_thenCorrect() { + get("/teachers") + .then() + .body("teachers.teacher.find { it.@department == 'science' }.subject", + hasItems("math", "physics")); + } + + @Test + public void givenUrl_whenVerifiesOddPricesAccuratelyByStatus_thenCorrect() { + get("/odds").then().body("odds.findAll { it.status > 0 }.price", + hasItems(1.30f, 1.20f)); + } + +} diff --git a/rest-assured-tutorial/src/test/resources/.gitignore b/rest-assured-tutorial/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/rest-assured-tutorial/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/rest-assured-tutorial/src/test/resources/employees.xml b/rest-assured-tutorial/src/test/resources/employees.xml new file mode 100644 index 0000000000..64e382976d --- /dev/null +++ b/rest-assured-tutorial/src/test/resources/employees.xml @@ -0,0 +1,22 @@ + + + Jane + Daisy + f + + + John + Doe + m + + + Billy + Getty + m + + + Hill + Clinton + f + + \ No newline at end of file diff --git a/rest-assured-tutorial/src/test/resources/event0.json b/rest-assured-tutorial/src/test/resources/event0.json new file mode 100644 index 0000000000..77e26c347e --- /dev/null +++ b/rest-assured-tutorial/src/test/resources/event0.json @@ -0,0 +1,37 @@ +{ + "id": "390", + "data": { + "countryId": 35, + "countryName": "Norway", + "leagueName": "Norway 3", + "status": 0, + "sportName": "Soccer", + "time": "2016-06-12T12:00:00Z" + }, + "odds": [{ + "price": 1.30, + "status": 0, + "ck": 12.2, + "name": "1" + }, + { + "price": 5.25, + "status": 1, + "ck": 13.1, + "name": "X" + }, + { + "price": 2.70, + "status": 0, + "ck": 12.2, + "name": "0" + }, + { + "price": 1.20, + "status": 2, + "ck": 13.1, + "name": "2" + } + + ] +} \ No newline at end of file diff --git a/rest-assured-tutorial/src/test/resources/odds.json b/rest-assured-tutorial/src/test/resources/odds.json new file mode 100644 index 0000000000..8b3dc166c5 --- /dev/null +++ b/rest-assured-tutorial/src/test/resources/odds.json @@ -0,0 +1,28 @@ +{ + "odds": [{ + "price": 1.30, + "status": 0, + "ck": 12.2, + "name": "1" + }, + { + "price": 5.25, + "status": 1, + "ck": 13.1, + "name": "X" + }, + { + "price": 2.70, + "status": 0, + "ck": 12.2, + "name": "0" + }, + { + "price": 1.20, + "status": 2, + "ck": 13.1, + "name": "2" + } + + ] +} \ No newline at end of file diff --git a/rest-assured-tutorial/src/test/resources/teachers.xml b/rest-assured-tutorial/src/test/resources/teachers.xml new file mode 100644 index 0000000000..9c073d5a38 --- /dev/null +++ b/rest-assured-tutorial/src/test/resources/teachers.xml @@ -0,0 +1,10 @@ + + + math + physics + + + political education + english + + \ No newline at end of file From 1f5f1c6a48c142e753f23465fb7f276c86546526 Mon Sep 17 00:00:00 2001 From: Raquel Garrido Date: Sun, 17 Jul 2016 20:41:41 +0200 Subject: [PATCH 30/32] Test added for mvc - velocity (#510) * dom4j * added more parsers * StaxParser * Jaxb binding * Jaxb binding * Finish article * apply some changes * Organize imports * remove dependency * Tutorial spring-mvc with velocity templates * velocity with spring mvc * tests --- pom.xml | 1 + spring-mvc-velocity/pom.xml | 170 ++++++++++++++++++ .../velocity/controller/MainController.java | 36 ++++ .../mvc/velocity/domain/Tutorial.java | 54 ++++++ .../velocity/service/TutorialsService.java | 20 +++ .../main/webapp/WEB-INF/fragments/footer.vm | 4 + .../main/webapp/WEB-INF/fragments/header.vm | 5 + .../src/main/webapp/WEB-INF/layouts/layout.vm | 22 +++ .../src/main/webapp/WEB-INF/mvc-servlet.xml | 38 ++++ .../main/webapp/WEB-INF/spring-context.xml | 9 + .../src/main/webapp/WEB-INF/views/index.vm | 19 ++ .../src/main/webapp/WEB-INF/web.xml | 32 ++++ .../test/NavigationControllerTest.java | 53 ++++++ .../velocity/test/TutorialDataFactory.java | 44 +++++ xml/pom.xml | 6 - xml/src/test/resources/example_new.xml | 19 +- 16 files changed, 516 insertions(+), 16 deletions(-) create mode 100644 spring-mvc-velocity/pom.xml create mode 100644 spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java create mode 100644 spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java create mode 100644 spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm create mode 100644 spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml create mode 100644 spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java create mode 100644 spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java diff --git a/pom.xml b/pom.xml index 1966d1485a..26ceec36d3 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ redis mutation-testing + spring-mvc-velocity diff --git a/spring-mvc-velocity/pom.xml b/spring-mvc-velocity/pom.xml new file mode 100644 index 0000000000..c655745b05 --- /dev/null +++ b/spring-mvc-velocity/pom.xml @@ -0,0 +1,170 @@ + + 4.0.0 + com.baeldung + 0.1-SNAPSHOT + spring-mvc-velocity + + spring-mvc-velocity + war + + + + + + + org.springframework + spring-web + ${org.springframework.version} + + + org.springframework + spring-webmvc + ${org.springframework.version} + + + org.springframework + spring-core + ${org.springframework.version} + + + org.springframework + spring-context-support + ${org.springframework.version} + + + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + org.apache.velocity + velocity + 1.7 + + + + org.apache.velocity + velocity-tools + 2.0 + + + + + + junit + junit + ${junit.version} + test + + + + org.hamcrest + hamcrest-core + ${org.hamcrest.version} + test + + + org.hamcrest + hamcrest-library + ${org.hamcrest.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito + ${powermock.version} + test + + + + + + spring-mvc-velocity + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + + + + + + + + + + + + 4.1.4.RELEASE + + + + 1.3 + 4.12 + 1.10.19 + 1.6.4 + + 4.4.1 + 4.5 + + 2.4.1 + + + 3.5.1 + 2.6 + 2.19.1 + 2.7 + 1.4.18 + + + + \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java new file mode 100644 index 0000000000..ad634d7c1b --- /dev/null +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java @@ -0,0 +1,36 @@ +package com.baeldung.mvc.velocity.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.baeldung.mvc.velocity.domain.Tutorial; +import com.baeldung.mvc.velocity.service.TutorialsService; + +@Controller +public class MainController { + + @Autowired + private TutorialsService tutService; + + @RequestMapping(value = { "/" }, method = RequestMethod.GET) + public String listTutorialsPage(Model model) { + List list = tutService.listTutorials(); + model.addAttribute("tutorials", list); + return "index"; + } + +public TutorialsService getTutService() { + return tutService; +} + +public void setTutService(TutorialsService tutService) { + this.tutService = tutService; +} + + +} \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java new file mode 100644 index 0000000000..ced7482758 --- /dev/null +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java @@ -0,0 +1,54 @@ +package com.baeldung.mvc.velocity.domain; + +public class Tutorial { + + private Integer tutId; + private String title; + private String description; + private String author; + + public Tutorial() { + super(); + } + + public Tutorial(Integer tutId, String title, String description, String author) { + super(); + this.tutId = tutId; + this.title = title; + this.description = description; + this.author = author; + } + + public Integer getTutId() { + return tutId; + } + + public void setTutId(Integer tutId) { + this.tutId = tutId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + +} diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java new file mode 100644 index 0000000000..59c2f04b6c --- /dev/null +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java @@ -0,0 +1,20 @@ +package com.baeldung.mvc.velocity.service; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baeldung.mvc.velocity.domain.Tutorial; + +@Service +public class TutorialsService { + + public List listTutorials() { + List list = new ArrayList(); + + list.add(new Tutorial(1, "Guava", "Introduction to Guava","GuavaAuthor")); + list.add(new Tutorial(2, "Android", "Introduction to Android","AndroidAuthor")); + return list; + } +} diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm new file mode 100644 index 0000000000..41bb36ce5e --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm @@ -0,0 +1,4 @@ +
+ @Copyright baeldung.com +
\ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm new file mode 100644 index 0000000000..8fffa6cdab --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm @@ -0,0 +1,5 @@ +
+
+

Our tutorials

+
+
\ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm new file mode 100644 index 0000000000..203e675cfb --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm @@ -0,0 +1,22 @@ + + + Spring & Velocity + + +
+ #parse("/WEB-INF/fragments/header.vm") +
+ + +
+ + + $screen_content + +
+ +
+ #parse("/WEB-INF/fragments/footer.vm") +
+ + \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml new file mode 100644 index 0000000000..8b4fd570fe --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + / + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml new file mode 100644 index 0000000000..2f3b0f19bb --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm new file mode 100644 index 0000000000..d1ae0b02cb --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm @@ -0,0 +1,19 @@ +

Index

+ +

Tutorials list

+ + + + + + + +#foreach($tut in $tutorials) + + + + + + +#end +
Tutorial IdTutorial TitleTutorial DescriptionTutorial Author
$tut.tutId$tut.title$tut.description$tut.author
\ No newline at end of file diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..72050c0d37 --- /dev/null +++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + Spring MVC Velocity + + + mvc + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/mvc-servlet.xml + + 1 + + + + mvc + /* + + + + contextConfigLocation + /WEB-INF/spring-context.xml + + + + org.springframework.web.context.ContextLoaderListener + + \ No newline at end of file diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java new file mode 100644 index 0000000000..bcd42ae47d --- /dev/null +++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java @@ -0,0 +1,53 @@ +package com.baeldung.mvc.velocity.test; + + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.ui.ExtendedModelMap; +import org.springframework.ui.Model; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import com.baeldung.mvc.velocity.controller.MainController; +import com.baeldung.mvc.velocity.domain.Tutorial; +import com.baeldung.mvc.velocity.service.TutorialsService; + + +@RunWith(MockitoJUnitRunner.class) +public class NavigationControllerTest { + + private MainController mainController; + + private TutorialsService tutorialsService; + + + private Model model; + + @Before + public final void setUp() throws Exception { + model = new ExtendedModelMap(); + mainController = Mockito.spy(new MainController()); + tutorialsService = Mockito.mock(TutorialsService.class); + + mainController.setTutService(tutorialsService); + + } + + @Test + public final void shouldGoToTutorialListView() { + Mockito.when(tutorialsService.listTutorials()).thenReturn(TutorialDataFactory.createTutorialList()); + final String view = mainController.listTutorialsPage(model); + final List tutorialListAttribute = (List) model.asMap().get("tutorials"); + + assertEquals("index", view); + assertNotNull(tutorialListAttribute); + } + + + + +} diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java new file mode 100644 index 0000000000..4e76d0ea5b --- /dev/null +++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java @@ -0,0 +1,44 @@ +package com.baeldung.mvc.velocity.test; + +import java.util.ArrayList; +import java.util.List; + +import com.baeldung.mvc.velocity.domain.Tutorial; + +public final class TutorialDataFactory { + + public static final Integer TEST_TUTORIAL_ID = 1; + + public static final String TEST_TUTORIAL_AUTHOR = "TestAuthor"; + + public static final String TEST_TUTORIAL_TITLE = "Test Title"; + + public static final String TEST_TUTORIAL_DESCRIPTION = "Test Description"; + + + private TutorialDataFactory() { + } + + public static Tutorial createByDefault() { + final Tutorial tutorial = new Tutorial(); + tutorial.setTutId(TEST_TUTORIAL_ID); + tutorial.setAuthor(TEST_TUTORIAL_AUTHOR); + tutorial.setTitle(TEST_TUTORIAL_TITLE); + tutorial.setDescription(TEST_TUTORIAL_DESCRIPTION); + return tutorial; + } + + public static Tutorial create(final Integer id , final String title) { + final Tutorial tutorial = createByDefault(); + tutorial.setTutId(id); + tutorial.setTitle(title); + return tutorial; + } + + public static List createTutorialList() { + final List tutorialList = new ArrayList(); + tutorialList.add(createByDefault()); + return tutorialList; + } + +} diff --git a/xml/pom.xml b/xml/pom.xml index 9d88bd75eb..d204eea45f 100644 --- a/xml/pom.xml +++ b/xml/pom.xml @@ -27,12 +27,6 @@ 2.0.6
- - xerces - xercesImpl - 2.9.1 - - commons-io diff --git a/xml/src/test/resources/example_new.xml b/xml/src/test/resources/example_new.xml index 020760fdd3..646d938869 100644 --- a/xml/src/test/resources/example_new.xml +++ b/xml/src/test/resources/example_new.xml @@ -1,10 +1,9 @@ - - - - - XML with Dom4J - XML handling with Dom4J - 14/06/2016 - Dom4J tech writer - - + + + + Jaxb author + 04/02/2015 + XML Binding with Jaxb + XML with Jaxb + + From e883cf63a1555cba171bc42a97163c5f1139b189 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Sun, 17 Jul 2016 22:21:16 +0300 Subject: [PATCH 31/32] Refactor mvc-velocity examples --- .../velocity/controller/MainController.java | 41 ++++++------- .../mvc/velocity/domain/Tutorial.java | 58 ++++--------------- .../velocity/service/TutorialsService.java | 22 ++++--- .../test/NavigationControllerTest.java | 49 +++++++--------- .../velocity/test/TutorialDataFactory.java | 44 -------------- 5 files changed, 59 insertions(+), 155 deletions(-) delete mode 100644 spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java index ad634d7c1b..78a6e06e7a 100644 --- a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java @@ -1,36 +1,33 @@ package com.baeldung.mvc.velocity.controller; -import java.util.List; - +import com.baeldung.mvc.velocity.domain.Tutorial; +import com.baeldung.mvc.velocity.service.TutorialsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import com.baeldung.mvc.velocity.domain.Tutorial; -import com.baeldung.mvc.velocity.service.TutorialsService; +import java.util.List; @Controller public class MainController { - - @Autowired - private TutorialsService tutService; - - @RequestMapping(value = { "/" }, method = RequestMethod.GET) - public String listTutorialsPage(Model model) { - List list = tutService.listTutorials(); - model.addAttribute("tutorials", list); - return "index"; - } -public TutorialsService getTutService() { - return tutService; -} + private final TutorialsService tutService; -public void setTutService(TutorialsService tutService) { - this.tutService = tutService; -} - - + @Autowired + public MainController(TutorialsService tutService) { + this.tutService = tutService; + } + + @RequestMapping(method = RequestMethod.GET) + public String listTutorialsPage(Model model) { + List list = tutService.listTutorials(); + model.addAttribute("tutorials", list); + return "index"; + } + + public TutorialsService getTutService() { + return tutService; + } } \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java index ced7482758..bc0118790a 100644 --- a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java @@ -2,53 +2,15 @@ package com.baeldung.mvc.velocity.domain; public class Tutorial { - private Integer tutId; - private String title; - private String description; - private String author; - - public Tutorial() { - super(); - } - - public Tutorial(Integer tutId, String title, String description, String author) { - super(); - this.tutId = tutId; - this.title = title; - this.description = description; - this.author = author; - } - - public Integer getTutId() { - return tutId; - } - - public void setTutId(Integer tutId) { - this.tutId = tutId; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } + private final Integer tutId; + private final String title; + private final String description; + private final String author; + public Tutorial(Integer tutId, String title, String description, String author) { + this.tutId = tutId; + this.title = title; + this.description = description; + this.author = author; + } } diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java index 59c2f04b6c..4b6c5de427 100644 --- a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java +++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java @@ -1,20 +1,18 @@ package com.baeldung.mvc.velocity.service; -import java.util.ArrayList; -import java.util.List; - +import com.baeldung.mvc.velocity.domain.Tutorial; import org.springframework.stereotype.Service; -import com.baeldung.mvc.velocity.domain.Tutorial; +import java.util.Arrays; +import java.util.List; @Service public class TutorialsService { - - public List listTutorials() { - List list = new ArrayList(); - - list.add(new Tutorial(1, "Guava", "Introduction to Guava","GuavaAuthor")); - list.add(new Tutorial(2, "Android", "Introduction to Android","AndroidAuthor")); - return list; - } + + public List listTutorials() { + return Arrays.asList( + new Tutorial(1, "Guava", "Introduction to Guava", "GuavaAuthor"), + new Tutorial(2, "Android", "Introduction to Android", "AndroidAuthor") + ); + } } diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java index bcd42ae47d..332c4d4c33 100644 --- a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java +++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java @@ -1,45 +1,35 @@ package com.baeldung.mvc.velocity.test; -import static org.junit.Assert.*; - -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.ui.ExtendedModelMap; -import org.springframework.ui.Model; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; import com.baeldung.mvc.velocity.controller.MainController; import com.baeldung.mvc.velocity.domain.Tutorial; import com.baeldung.mvc.velocity.service.TutorialsService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.springframework.ui.ExtendedModelMap; +import org.springframework.ui.Model; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; @RunWith(MockitoJUnitRunner.class) public class NavigationControllerTest { - private MainController mainController; + private final MainController mainController = new MainController(Mockito.mock(TutorialsService.class)); - private TutorialsService tutorialsService; - - - private Model model; - - @Before - public final void setUp() throws Exception { - model = new ExtendedModelMap(); - mainController = Mockito.spy(new MainController()); - tutorialsService = Mockito.mock(TutorialsService.class); - - mainController.setTutService(tutorialsService); - - } + private final Model model = new ExtendedModelMap(); @Test public final void shouldGoToTutorialListView() { - Mockito.when(tutorialsService.listTutorials()).thenReturn(TutorialDataFactory.createTutorialList()); + Mockito.when(mainController.getTutService().listTutorials()) + .thenReturn(createTutorialList()); + final String view = mainController.listTutorialsPage(model); final List tutorialListAttribute = (List) model.asMap().get("tutorials"); @@ -48,6 +38,7 @@ public class NavigationControllerTest { } - - + private static List createTutorialList() { + return Arrays.asList(new Tutorial(1, "TestAuthor", "Test Title", "Test Description")); + } } diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java deleted file mode 100644 index 4e76d0ea5b..0000000000 --- a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/TutorialDataFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.mvc.velocity.test; - -import java.util.ArrayList; -import java.util.List; - -import com.baeldung.mvc.velocity.domain.Tutorial; - -public final class TutorialDataFactory { - - public static final Integer TEST_TUTORIAL_ID = 1; - - public static final String TEST_TUTORIAL_AUTHOR = "TestAuthor"; - - public static final String TEST_TUTORIAL_TITLE = "Test Title"; - - public static final String TEST_TUTORIAL_DESCRIPTION = "Test Description"; - - - private TutorialDataFactory() { - } - - public static Tutorial createByDefault() { - final Tutorial tutorial = new Tutorial(); - tutorial.setTutId(TEST_TUTORIAL_ID); - tutorial.setAuthor(TEST_TUTORIAL_AUTHOR); - tutorial.setTitle(TEST_TUTORIAL_TITLE); - tutorial.setDescription(TEST_TUTORIAL_DESCRIPTION); - return tutorial; - } - - public static Tutorial create(final Integer id , final String title) { - final Tutorial tutorial = createByDefault(); - tutorial.setTutId(id); - tutorial.setTitle(title); - return tutorial; - } - - public static List createTutorialList() { - final List tutorialList = new ArrayList(); - tutorialList.add(createByDefault()); - return tutorialList; - } - -} From c738c9ed779b8cc61b9721175b7b081cabdec911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Gonz=C3=A1lez?= Date: Mon, 18 Jul 2016 08:39:15 +0200 Subject: [PATCH 32/32] Code for deepening on expectations (#511) * Add new module for mocks comparison. * Add sources for testing. * Changes on testCase. * Enter some tests for mockito. * More tests for Mockito. * Even more tests. * Add the rest of the mocking libraries. * Javadoc on test. * Test bare bones for EasyMock. * Fist kind of test and setup. * Add tests using EasyMock with a change on LoginService. * Create LoginControllerTest.java * Test setup * [JMockit] No method called test. * [JMockit] Two methods called test. * [JMockit] One method called test. * [JMockit] Exception mock test * [JMockit] Mocked object to pass around test. * [JMockit] Custom matcher test. * [JMockit] Partial mocking test. * [JMockit] Fix with IDE. * Not stubs. Mocks. MOCKS!!! * Remove unnecesary import. * Use correct encoding. Was having problems with buildings. * Remove failing module. * Create new module mocks and move mock-comparisons there. * Add jmockit module. * Add model class. * Add collaborator class. * Add performer class. * Add performer test. * Fix * Add interface for tests. * Test for any. * Test for with. * Test for null. * Test for times. * Test for arg that. * Test for result and returns. * Test for delegate. --- .../jmockit/ExpectationsCollaborator.java | 16 ++ .../org/baeldung/mocks/jmockit/Model.java | 6 +- .../mocks/jmockit/ExpectationsTest.java | 157 ++++++++++++++++++ 3 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java create mode 100644 mocks/jmockit/src/test/java/org/baeldung/mocks/jmockit/ExpectationsTest.java diff --git a/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java b/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java new file mode 100644 index 0000000000..510ce222c0 --- /dev/null +++ b/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java @@ -0,0 +1,16 @@ +package org.baeldung.mocks.jmockit; + +import java.util.List; + +public interface ExpectationsCollaborator { + void methodForAny(String s, int i, Boolean b, List l); + void methodForWith(String s, int i, Boolean b, List l); + void methodForNulls(String s, List l, List m); + void methodForTimes1(); + void methodForTimes2(); + void methodForTimes3(); + void methodForArgThat(Object o); + String methodReturnsString(); + int methodReturnsInt(); + Object methodForDelegate(int i); +} diff --git a/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/Model.java b/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/Model.java index 54249dcd1d..c3b63d11b4 100644 --- a/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/Model.java +++ b/mocks/jmockit/src/main/java/org/baeldung/mocks/jmockit/Model.java @@ -1,7 +1,7 @@ package org.baeldung.mocks.jmockit; public class Model { - public String getInfo(){ - return "info"; - } + public String getInfo(){ + return "info"; + } } diff --git a/mocks/jmockit/src/test/java/org/baeldung/mocks/jmockit/ExpectationsTest.java b/mocks/jmockit/src/test/java/org/baeldung/mocks/jmockit/ExpectationsTest.java new file mode 100644 index 0000000000..5d0af157d1 --- /dev/null +++ b/mocks/jmockit/src/test/java/org/baeldung/mocks/jmockit/ExpectationsTest.java @@ -0,0 +1,157 @@ +package org.baeldung.mocks.jmockit; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.junit.Test; +import org.junit.runner.RunWith; + +import mockit.Delegate; +import mockit.Expectations; +import mockit.Mocked; +import mockit.StrictExpectations; +import mockit.integration.junit4.JMockit; + +@RunWith(JMockit.class) +@SuppressWarnings("unchecked") +public class ExpectationsTest { + + @Test + public void testForAny(@Mocked ExpectationsCollaborator mock) throws Exception { + new Expectations() { + { + mock.methodForAny(anyString, anyInt, anyBoolean, (List) any); + } + }; + mock.methodForAny("barfooxyz", 0, Boolean.FALSE, new ArrayList<>()); + } + + @Test + public void testForWith(@Mocked ExpectationsCollaborator mock) throws Exception { + new Expectations() { + { + mock.methodForWith(withSubstring("foo"), withNotEqual(1), withNotNull(), withInstanceOf(List.class)); + } + }; + mock.methodForWith("barfooxyz", 2, Boolean.TRUE, new ArrayList<>()); + } + + @Test + public void testWithNulls(@Mocked ExpectationsCollaborator mock) { + // more config + new Expectations() { + { + mock.methodForNulls(anyString, null, (List) withNull()); + } + }; + mock.methodForNulls("blablabla", new ArrayList(), null); + } + + @Test + public void testWithTimes(@Mocked ExpectationsCollaborator mock) { + // more config + new Expectations() { + { + // exactly 2 invocations to foo() are expected + mock.methodForTimes1(); + times = 2; + // we expect from 1 to 3 invocations to bar() + mock.methodForTimes2(); + minTimes = 1; + maxTimes = 3; + mock.methodForTimes3(); // "minTimes = 1" is implied + } + }; + mock.methodForTimes1(); + mock.methodForTimes1(); + mock.methodForTimes2(); + mock.methodForTimes2(); + mock.methodForTimes2(); + mock.methodForTimes3(); + } + + @Test + public void testCustomArgumentMatching(@Mocked ExpectationsCollaborator mock) { + new Expectations() { + { + mock.methodForArgThat(withArgThat(new BaseMatcher() { + @Override + public boolean matches(Object item) { + return item instanceof Model && "info".equals(((Model) item).getInfo()); + } + + @Override + public void describeTo(Description description) { + // NOOP + } + })); + } + }; + mock.methodForArgThat(new Model()); + } + + @Test + public void testResultAndReturns(@Mocked ExpectationsCollaborator mock) { + new StrictExpectations() { + { + // return "foo", an exception and lastly "bar" + mock.methodReturnsString(); + result = "foo"; + result = new Exception(); + result = "bar"; + // return 1, 2, 3 + mock.methodReturnsInt(); + result = new int[] { 1, 2, 3 }; + // return "foo" and "bar" + mock.methodReturnsString(); + returns("foo", "bar"); + // return only 1 + mock.methodReturnsInt(); + result = 1; + } + }; + assertEquals("Should return foo", "foo", mock.methodReturnsString()); + try { + mock.methodReturnsString(); + } catch (Exception e) { + // NOOP + } + assertEquals("Should return bar", "bar", mock.methodReturnsString()); + assertEquals("Should return 1", 1, mock.methodReturnsInt()); + assertEquals("Should return 2", 2, mock.methodReturnsInt()); + assertEquals("Should return 3", 3, mock.methodReturnsInt()); + assertEquals("Should return foo", "foo", mock.methodReturnsString()); + assertEquals("Should return bar", "bar", mock.methodReturnsString()); + assertEquals("Should return 1", 1, mock.methodReturnsInt()); + } + + @Test + public void testDelegate(@Mocked ExpectationsCollaborator mock) { + new StrictExpectations() { + { + // return "foo", an exception and lastly "bar" + mock.methodForDelegate(anyInt); + times = 2; + result = new Delegate() { + public int delegate(int i) throws Exception { + if (i < 3) { + return 5; + } else { + throw new Exception(); + } + } + }; + } + }; + assertEquals("Should return 5", 5, mock.methodForDelegate(1)); + try { + mock.methodForDelegate(3); + } catch (Exception e) { + // NOOP + } + } +}