diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/.gitignore b/jdk_8_maven/cs/rest/original/notebook-manager/.gitignore
new file mode 100644
index 000000000..b56f1dd0d
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/.gitignore
@@ -0,0 +1,33 @@
+README.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/Dockerfile b/jdk_8_maven/cs/rest/original/notebook-manager/Dockerfile
new file mode 100644
index 000000000..23784948c
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/Dockerfile
@@ -0,0 +1,22 @@
+FROM openjdk:8-jdk
+EXPOSE 8090
+WORKDIR /app
+
+# Copy maven executable to the image
+COPY mvnw .
+COPY .mvn .mvn
+
+# Copy the pom.xml file
+COPY pom.xml .
+
+# Copy the project source
+COPY ./src ./src
+COPY ./pom.xml ./pom.xml
+
+RUN chmod 755 /app/mvnw
+
+RUN ./mvnw dependency:go-offline -B -Dmaven.artifact.threads=35
+
+RUN ./mvnw package #-DskipTests
+#RUN ls -al
+ENTRYPOINT ["java","-jar","target/NoteBookManagerRest-0.0.1-SNAPSHOT.jar"]
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/docker-compose.yml b/jdk_8_maven/cs/rest/original/notebook-manager/docker-compose.yml
new file mode 100644
index 000000000..a7f95f9f1
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/docker-compose.yml
@@ -0,0 +1,36 @@
+version: '2.1'
+
+services:
+ #service 1: mysql database image creation
+ db:
+ image: mysql:5.6.17
+ container_name: mysql-db
+ environment:
+ - MYSQL_ROOT_PASSWORD=spring
+ ports:
+ - "3306:3306"
+ restart: always
+ healthcheck:
+ test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
+ timeout: 20s
+ retries: 10
+
+
+ # service 2: notebook Manager app image creation
+ notebookservice:
+ image: notebook-service
+ container_name: notebook-service-app # name of container created from image
+ build:
+ context: . # path to docker file
+ dockerfile: Dockerfile # docker file name
+ ports:
+ - "8090:8080" # notebook service port
+ restart: always
+
+ depends_on: #define dependencies of this app
+ db : #dependency name (which is defined with this name 'db' in this file earlier)
+ condition: service_healthy
+ environment:
+ SPRING_DATASOURCE_URL: jdbc:mysql://mysql-db:3306/notebook_manager?createDatabaseIfNotExist=true&useSSL=false
+ SPRING_DATASOURCE_USERNAME: root
+ SPRING_DATASOURCE_PASSWORD: spring
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/mvnw b/jdk_8_maven/cs/rest/original/notebook-manager/mvnw
new file mode 100644
index 000000000..8a8fb2282
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/mvnw
@@ -0,0 +1,316 @@
+#!/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
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven 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 /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ 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
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ 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 Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+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="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# 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 \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/mvnw.cmd b/jdk_8_maven/cs/rest/original/notebook-manager/mvnw.cmd
new file mode 100644
index 000000000..1d8ab018e
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven 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 keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by 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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\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%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/pom.xml b/jdk_8_maven/cs/rest/original/notebook-manager/pom.xml
new file mode 100644
index 000000000..ae42ab9ee
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/pom.xml
@@ -0,0 +1,86 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.6.3
+
+
+ bdp.sample
+ NoteBookManagerRest
+ 0.0.1-SNAPSHOT
+ NoteBookManagerRest
+ NoteBookManagerRest
+
+ 8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-hateoas
+
+
+ org.springframework.boot
+ spring-boot-starter-jersey
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ com.h2database
+ h2
+ ${h2.version}
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springdoc
+ springdoc-openapi-ui
+ 1.6.4
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/NoteBookApplication.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/NoteBookApplication.java
new file mode 100644
index 000000000..b1e5dd7e4
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/NoteBookApplication.java
@@ -0,0 +1,21 @@
+package bdp.sample.notebookmanager;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.hateoas.config.EnableHypermediaSupport;
+
+
+@SpringBootApplication
+@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
+public class NoteBookApplication {
+
+
+ public static void main(String[] args) {
+
+ SpringApplication.run(NoteBookApplication.class, args);
+
+
+ }
+
+
+
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/configs/InitiateDatabaseRecords.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/configs/InitiateDatabaseRecords.java
new file mode 100644
index 000000000..594194cf9
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/configs/InitiateDatabaseRecords.java
@@ -0,0 +1,48 @@
+package bdp.sample.notebookmanager.configs;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import bdp.sample.notebookmanager.entities.NoteBook;
+import bdp.sample.notebookmanager.repositories.NoteBookRepository;
+import org.springframework.context.annotation.Profile;
+
+
+@Configuration
+@Profile("!test")
+class InitiateDatabaseRecords {
+
+ private static final Logger log = LoggerFactory.getLogger(InitiateDatabaseRecords.class);
+
+
+ @Bean
+ CommandLineRunner initDatabase(NoteBookRepository repository) {
+ if(repository.findAll().size()<1) {
+ return args -> {
+ try {
+ // insert initial records into DB
+ repository.save(new NoteBook("Asus Vivo Book S", 211.9));
+ repository.save(new NoteBook("HP Inspiron", 299.9));
+ repository.save(new NoteBook("Dell Magic", 300));
+ repository.save(new NoteBook("Apple MacBook", 709.9));
+ repository.save(new NoteBook("LG D230", 299.9));
+ repository.save(new NoteBook("Acer P700", 199.9));
+
+ log.info("Initial records inserted into database." );
+ } catch (Exception e) {
+ log.info("Error in initiating records into database." );
+ }
+ };
+ }
+ else
+ return args -> {
+ log.info("Records already initiated ");
+ };
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/controller/NoteBookController.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/controller/NoteBookController.java
new file mode 100644
index 000000000..a7c150f4a
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/controller/NoteBookController.java
@@ -0,0 +1,217 @@
+package bdp.sample.notebookmanager.controller;
+
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.hateoas.*;
+import org.springframework.hateoas.server.EntityLinks;
+import org.springframework.hateoas.server.ExposesResourceFor;
+import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
+import bdp.sample.notebookmanager.entities.NoteBook;
+import bdp.sample.notebookmanager.services.NoteBookService;
+
+import java.security.InvalidParameterException;
+import java.util.List;
+
+@RestController
+@ExposesResourceFor(NoteBook.class)
+@RequestMapping("/api/notebooks")
+public class NoteBookController {
+
+ @Autowired
+ private EntityLinks entityLinks;
+
+ @Autowired
+ private NoteBookService noteBookService;
+
+
+ // GET /api/notebooks (get a list of notebooks)
+ @Operation(summary = "Get list of notebooks (Ordered by Id in ascending order), you must specify page number and page size")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "Successful Operation",
+ content = { @Content(mediaType = "application/json") }),
+ @ApiResponse(responseCode = "400", description = "Invalid parameters supplied",
+ content = @Content),
+ @ApiResponse(responseCode = "500", description = "Internal Error",
+ content = @Content)})
+ @GetMapping(produces = { "application/json" })
+ public ResponseEntity> getnotebooks(@Parameter(description = "Page index (start from 0)") @RequestParam(value = "page") Integer page, @Parameter(description = "Number of records per page") @RequestParam(value = "pageSize") Integer pageSize) {
+
+ // Retrieve requested portion of notebooks from database
+ List notebookList = noteBookService.listnotebooks(page,pageSize);
+
+ // Add self Link to each record as url for retrieving the record
+ for (NoteBook notebook : notebookList) {
+ Link recordSelfLink = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(NoteBookController.class)
+ .getnotebookById(notebook.getID())).withSelfRel();
+ notebook.add(recordSelfLink);
+ }
+ CollectionModel resources = CollectionModel.of(notebookList);
+ // selfLink to api according to HATEOS
+ Link selfLink = entityLinks.linkToCollectionResource(NoteBook.class);
+ resources.add(selfLink);
+
+ // Send data to client as a response
+ return new ResponseEntity(EntityModel.of(resources),HttpStatus.OK);
+ }
+
+
+ //GET /api/notebooks/1 (get one notebook from the list)
+ @Operation(summary = "Get a notebook by its id")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "Found the notebook",
+ content = { @Content(mediaType = "application/json",
+ schema = @Schema(implementation = NoteBook.class)) }),
+ @ApiResponse(responseCode = "400", description = "Invalid id supplied",
+ content = @Content),
+ @ApiResponse(responseCode = "404", description = "notebook not found",
+ content = @Content),
+ @ApiResponse(responseCode = "500", description = "Internal Error",
+ content = @Content) })
+ @GetMapping(value = "/{notebookId}", produces = { "application/json" })
+ public ResponseEntity> getnotebookById(@Parameter(description = "id of notebook to be retrieved") @PathVariable int notebookId){
+
+ // selfLink to api according to HATEOS
+ Link selfLink = entityLinks.linkToItemResource(NoteBook.class, notebookId);
+ // Retrieve requested notebook from database
+ NoteBook notebook = noteBookService.getnotebookById(notebookId);
+ //Check whether the notebook exist or not
+ if(notebook!=null) {
+ EntityModel resource = EntityModel.of(notebook);
+ resource.add(selfLink);
+ // Send data to client as a response
+ return new ResponseEntity(EntityModel.of(resource),HttpStatus.OK);
+ }
+
+ // If no notebook is found send 404 status code as response
+ return new ResponseEntity(null, HttpStatus.NOT_FOUND);
+ }
+
+
+ // POST /api/notebooks (create a notebook)
+ @Operation(summary = "Create a new notebook")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "201", description = "notebook created",
+ content = { @Content(mediaType = "application/json",
+ schema = @Schema(implementation = NoteBook.class)) }),
+ @ApiResponse(responseCode = "400", description = "Invalid id supplied",
+ content = @Content),
+ @ApiResponse(responseCode = "404", description = "notebook not found",
+ content = @Content),
+ @ApiResponse(responseCode = "500", description = "Internal Error",
+ content = @Content),
+ @ApiResponse(responseCode = "409", description = "Duplicate notebook name",
+ content = @Content) })
+ @PostMapping
+ public ResponseEntity> createnotebook(@RequestBody NoteBook notebook){
+
+ // Create and Save notebook in database
+ NoteBook storednotebook = noteBookService.createnotebook(notebook);
+
+ // Check whether the notebook is saved or not
+ if(notebook!=null) {
+ // selfLink to api that retrieves the notebook according to HATEOS
+ Link recordSelfLink = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(NoteBookController.class)
+ .getnotebookById(notebook.getID())).withSelfRel();
+ notebook.add(recordSelfLink);
+ // Send created notebook with 201 status code to client
+ return new ResponseEntity(EntityModel.of(storednotebook), HttpStatus.CREATED);
+ }
+ // If no notebook is saved send 304 status code
+ return new ResponseEntity(null, HttpStatus.NOT_MODIFIED);
+ }
+
+
+ //PATCH /api/notebooks/1 (update the price of a single notebook)
+ @Operation(summary = "Update a notebook by its id")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "202", description = "notebook updated",
+ content = { @Content(mediaType = "application/json",
+ schema = @Schema(implementation = NoteBook.class)) }),
+ @ApiResponse(responseCode = "400", description = "Invalid id supplied",
+ content = @Content),
+ @ApiResponse(responseCode = "404", description = "notebook not found",
+ content = @Content),
+ @ApiResponse(responseCode = "500", description = "Internal Error",
+ content = @Content),
+ @ApiResponse(responseCode = "409", description = "Duplicate notebook name",
+ content = @Content) })
+ @PatchMapping(value = "/{notebookId}", produces = { "application/json" })
+ public ResponseEntity> updatenotebook(@Parameter(description = "id of notebook to be updated") @PathVariable int notebookId, @Parameter(description = "notebook updated information") @RequestBody NoteBook notebook){
+
+ // Update notebook in the database
+ NoteBook storednotebook = noteBookService.updatenotebook(notebookId,notebook);
+
+ // Check whether the notebook exist and is updated or not
+ if(storednotebook!=null) {
+ // selfLink to api that retrieves the notebook according to HATEOS
+ Link recordSelfLink = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(NoteBookController.class)
+ .getnotebookById(notebook.getID())).withSelfRel();
+ notebook.add(recordSelfLink);
+ // Send updated notebook with 202 status code to client
+ return new ResponseEntity(EntityModel.of(storednotebook), HttpStatus.ACCEPTED);
+ }
+
+ // If no notebook is found send 404 status code as response
+ return new ResponseEntity(null, HttpStatus.NOT_FOUND);
+ }
+
+ // DELETE/api/notebooks/1 (delete a single notebook)
+ @Operation(summary = "Delete a notebook by its id")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "202", description = "notebook deleted",
+ content = @Content),
+ @ApiResponse(responseCode = "400", description = "Invalid id supplied",
+ content = @Content),
+ @ApiResponse(responseCode = "404", description = "notebook not found",
+ content = @Content),
+ @ApiResponse(responseCode = "500", description = "Internal Error",
+ content = @Content) })
+ @DeleteMapping(value = "/{notebookId}")
+ public ResponseEntity> deletenotebook(@Parameter(description = "id of notebook to be deleted") @PathVariable int notebookId){
+
+ // Delete the notebook by its Id and check for the result
+ if(noteBookService.deletenotebook(notebookId))
+ // Sent empty response with 202 status code
+ return new ResponseEntity(null, HttpStatus.ACCEPTED);
+ else
+ // If no notebook is found send 404 status code as response
+ return new ResponseEntity(null, HttpStatus.NOT_FOUND);
+ }
+
+
+
+
+ // Handling exceptions related to user input
+ @ExceptionHandler({ MissingServletRequestParameterException.class, InvalidParameterException.class, MethodArgumentTypeMismatchException.class })
+ public ResponseEntity handleUserInputException() {
+
+ return new ResponseEntity("Bad Request", HttpStatus.BAD_REQUEST);
+ }
+
+ // Handling runtime exception
+ @ExceptionHandler({ RuntimeException.class })
+ public ResponseEntity handleRuntimeException() {
+
+ return new ResponseEntity(null, HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+
+
+ @ExceptionHandler({ DataIntegrityViolationException.class })
+ public ResponseEntity handleDuplicateException() {
+
+ return new ResponseEntity(null, HttpStatus.CONFLICT);
+ }
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/entities/NoteBook.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/entities/NoteBook.java
new file mode 100644
index 000000000..04095bbaf
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/entities/NoteBook.java
@@ -0,0 +1,86 @@
+package bdp.sample.notebookmanager.entities;
+
+import org.hibernate.annotations.UpdateTimestamp;
+import org.springframework.hateoas.RepresentationModel;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+import java.util.Objects;
+
+@Entity
+public class NoteBook extends RepresentationModel {
+ private Integer ID;
+ private String name;
+ private double currentPrice;
+ private Timestamp lastUpdate;
+
+ public NoteBook(){
+
+ }
+
+ public NoteBook(Integer ID, String name, double currentPrice){
+ this.ID = ID;
+ this.name = name;
+ this.currentPrice = currentPrice;
+ }
+ public NoteBook(String name, double currentPrice){
+ this.name = name;
+ this.currentPrice = currentPrice;
+ }
+
+ @Id
+ @Column(name = "id")
+ @GeneratedValue(strategy = GenerationType.IDENTITY) // id generate by the database native approach
+ public Integer getID() {
+ return ID;
+ }
+
+ public void setID(Integer ID) {
+ this.ID = ID;
+ }
+
+ @Basic
+ @Column(name = "name", unique = true)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Basic
+ @Column(name = "currentPrice")
+ public double getCurrentPrice() {
+ return currentPrice;
+ }
+
+ public void setCurrentPrice(double currentPrice) {
+ this.currentPrice = currentPrice;
+ }
+
+ @Basic
+ @Column(name = "lastUpdate")
+ @UpdateTimestamp
+
+ public Timestamp getLastUpdate() {
+ return lastUpdate;
+ }
+
+ public void setLastUpdate(Timestamp lastUpdate) {
+ this.lastUpdate = lastUpdate;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ NoteBook notebook = (NoteBook) o;
+ return ID == notebook.ID && currentPrice == notebook.currentPrice && Objects.equals(name, notebook.name) && Objects.equals(lastUpdate, notebook.lastUpdate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ID, name, currentPrice, lastUpdate);
+ }
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/repositories/NoteBookRepository.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/repositories/NoteBookRepository.java
new file mode 100644
index 000000000..49ad6defb
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/repositories/NoteBookRepository.java
@@ -0,0 +1,13 @@
+package bdp.sample.notebookmanager.repositories;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import bdp.sample.notebookmanager.entities.NoteBook;
+
+@Repository
+public interface NoteBookRepository extends JpaRepository {
+
+ public Page findAll(Pageable page);
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/services/NoteBookService.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/services/NoteBookService.java
new file mode 100644
index 000000000..53caf3d04
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/java/bdp/sample/notebookmanager/services/NoteBookService.java
@@ -0,0 +1,73 @@
+package bdp.sample.notebookmanager.services;
+
+
+import bdp.sample.notebookmanager.repositories.NoteBookRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+import bdp.sample.notebookmanager.entities.NoteBook;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class NoteBookService {
+
+ @Autowired
+ private NoteBookRepository noteBookRepository;
+
+ //This method gets page index and page size and returns records from database accordingly
+ public List listnotebooks(int page, int size){
+ return noteBookRepository.findAll(PageRequest.of(page, size, Sort.by("ID").ascending())).toList();
+ }
+
+ // This method gets an Id and returns corresponding notebook if it exists, otherwise it returns null
+ public NoteBook getnotebookById(int notebookId){
+ Optional notebook = noteBookRepository.findById(notebookId);
+ if (notebook.isPresent())
+ return notebook.get();
+ // returns null if the given Id doesn't exist
+ return null;
+ }
+
+ // This method creates given notebook object in the database and returns it with its Id
+ public NoteBook createnotebook(NoteBook notebook){
+
+ return noteBookRepository.save(notebook);
+ }
+
+ //This method gets a notebook object along with its Id, updates the name and currentPrice and returns it back
+ //if the notebook Id doesn't exist, it returns null
+ public NoteBook updatenotebook(int notebookId, NoteBook changednotebook){
+ Optional notebook = noteBookRepository.findById(notebookId);
+ //Check if the notebook exists
+ if (notebook.isPresent()) {
+ NoteBook tempnotebook= notebook.get();
+ tempnotebook.setName(changednotebook.getName());
+ tempnotebook.setCurrentPrice(changednotebook.getCurrentPrice());
+ // Save and return updated notebook object
+ return noteBookRepository.save(tempnotebook);
+ }
+
+ // returns null if the given Id doesn't exist
+ return null;
+ }
+
+ //This method gets a notebook Id and delete the corresponding notebook record in databse
+ //if the notebook Id doesn't exist, it returns null
+ public boolean deletenotebook(int notebookId){
+ Optional notebook = noteBookRepository.findById(notebookId);
+ //Check if the notebook exists
+ if (notebook.isPresent()) {
+ noteBookRepository.delete(notebook.get());
+ return true;
+ }
+
+ // returns null if the given Id doesn't exist
+ return false;
+ }
+
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/main/resources/application.properties b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/resources/application.properties
new file mode 100644
index 000000000..ded3db142
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/main/resources/application.properties
@@ -0,0 +1,10 @@
+spring.jpa.hibernate.ddl-auto=update
+jdbc.driverClassName=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://localhost:3306/notebook_manager?useSSL=false&createDatabaseIfNotExist=true
+spring.jpa.database-platform = org.hibernate.dialect.MySQL5InnoDBDialect
+#hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
+spring.datasource.username=root
+spring.datasource.password=
+
+#logging.level.root=debug
+
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/NoteBookApplicationTests.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/NoteBookApplicationTests.java
new file mode 100644
index 000000000..7f5514537
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/NoteBookApplicationTests.java
@@ -0,0 +1,13 @@
+package bdp.sample.notebookmanager;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest()
+public class NoteBookApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/controller/NoteBookControllerTest.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/controller/NoteBookControllerTest.java
new file mode 100644
index 000000000..afd83df37
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/controller/NoteBookControllerTest.java
@@ -0,0 +1,165 @@
+package bdp.sample.notebookmanager.controller;
+
+import bdp.sample.notebookmanager.entities.NoteBook;
+import bdp.sample.notebookmanager.repositories.NoteBookRepository;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.client.AutoConfigureWebClient;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.web.servlet.MockMvc;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+
+import java.sql.SQLException;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/*
+//@WebAppConfiguration() //"file:src/test/resources"
+@ContextConfiguration( classes = { JpaConfig.class }) // loader = AnnotationConfigWebContextLoader.class,
+
+*/
+
+@SpringBootTest
+@ActiveProfiles("test")
+@AutoConfigureMockMvc
+@AutoConfigureWebClient
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:beforeTestRun.sql")
+@Sql(executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, scripts = "classpath:afterTestRun.sql")
+//@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
+class NoteBookControllerTest {
+
+
+ @Autowired
+ MockMvc mockMvc;
+
+ @Autowired
+ DataSource dataSource;
+
+
+
+
+
+ @Test
+ void getListOfnotebooksWithConfigurablePageSize() throws Exception {
+ // First page with page size of 2
+ mockMvc.perform(get("/api/notebooks?page=0&pageSize=2")).andExpect(status().isOk())
+ .andExpect(content().contentType("application/json")).andExpect(jsonPath("$._embedded.noteBookList[0].id").value("1"))
+ .andExpect(jsonPath("$._embedded.noteBookList[1].id").value("2"));
+
+ // Second page with page size of 3
+ mockMvc.perform(get("/api/notebooks?page=1&pageSize=3")).andExpect(status().isOk())
+ .andExpect(content().contentType("application/json"))
+ .andExpect(jsonPath("$._embedded.noteBookList[0].id").value("4"))
+ .andExpect(jsonPath("$._embedded.noteBookList[1].id").value("5"));
+
+ }
+
+ @Test
+ void getSingleExistingnotebookById() throws Exception {
+
+ // Get notebook with id=2
+ mockMvc.perform(get("/api/notebooks/2")).andExpect(status().isOk())
+ .andExpect(content().contentType("application/json"))
+ .andExpect(jsonPath("$.id").value("2"))
+ .andExpect(jsonPath("$.name").value("HP Inspiron"));
+
+ }
+
+
+ @Test
+ void getSingleNotExistingnotebookById() throws Exception {
+
+ // Get notebook with id=22
+ mockMvc.perform(get("/api/notebooks/22"))
+ .andExpect(status().isNotFound());
+
+ }
+
+ @Test
+ void getSinglenotebookByInvalidnotebookId() throws Exception {
+
+ // Get notebook with id=i
+ mockMvc.perform(get("/api/notebooks/i"))
+ .andExpect(status().isBadRequest());
+
+ // Get notebook with id=*
+ mockMvc.perform(get("/api/notebooks/*"))
+ .andExpect(status().isBadRequest());
+
+ }
+
+ @Test
+ void updatenotebookWithExistingnotebookId() throws Exception{
+
+ NoteBook notebook = new NoteBook(2,"HP FitBook",305.99);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(notebook);
+ // Update notebook with id = 2
+ mockMvc.perform(patch("/api/notebooks/2").content(json).characterEncoding("utf-8")
+ .contentType("application/json"))
+ .andExpect(status().isAccepted())
+ .andExpect(jsonPath("$.name").value("HP FitBook"))
+ .andExpect(jsonPath("$.currentPrice").value(305.99));
+ }
+
+
+ @Test
+ void updatenotebookWithNotExistingnotebookId() throws Exception{
+
+ NoteBook notebook = new NoteBook(77,"HP FitBook",305.99);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(notebook);
+ // Update notebook with id = 77 which is not existed
+ mockMvc.perform(patch("/api/notebooks/77").content(json).characterEncoding("utf-8")
+ .contentType("application/json"))
+ .andExpect(status().isNotFound());
+
+ }
+
+
+ @Test
+ void createnotebook() throws Exception{
+
+ NoteBook notebook = new NoteBook("HP FitBook",305.99);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(notebook);
+
+ // Create new notebook
+ mockMvc.perform(post("/api/notebooks").content(json).characterEncoding("utf-8")
+ .contentType("application/json"))
+ .andExpect(status().isCreated());
+
+ }
+
+ @Test
+ void createNoteBookWithDuplicateName() throws Exception{
+
+ NoteBook notebook = new NoteBook("Dell B3",305.99);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(notebook);
+
+ // Create new notebook with duplicate name
+ mockMvc.perform(post("/api/notebooks").content(json).characterEncoding("utf-8")
+ .contentType("application/json"))
+ .andExpect(status().isConflict());
+
+ }
+
+ @Test
+ void deleteNoteBookWithExistingNoteBookId() throws Exception{
+
+ // Delete notebook with id = 2
+ mockMvc.perform(delete("/api/notebooks/2"))
+ .andExpect(status().isAccepted());
+ }
+
+
+}
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/repositories/NoteBookRepositoryTest.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/repositories/NoteBookRepositoryTest.java
new file mode 100644
index 000000000..d9275b658
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/repositories/NoteBookRepositoryTest.java
@@ -0,0 +1,92 @@
+package bdp.sample.notebookmanager.repositories;
+
+import bdp.sample.notebookmanager.entities.NoteBook;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.orm.jpa.JpaObjectRetrievalFailureException;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+import java.util.List;
+import java.util.Optional;
+
+import static org.junit.jupiter.api.Assertions.*;
+//@SpringBootTest
+/*
+@ContextConfiguration(
+ classes = { JpaConfig.class },
+ loader = AnnotationConfigContextLoader.class)
+*/
+/*classes = { JpaConfig.class },*/
+//@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class)
+@DataJpaTest
+@Transactional
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:beforeTestRun.sql")
+@Sql(executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, scripts = "classpath:afterTestRun.sql")
+//@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
+class NoteBookRepositoryTest {
+ @Resource
+ private NoteBookRepository noteBookRepository;
+
+
+
+
+ @Test
+ void findAllWithSpecifPageNumberAndPageSize() {
+ List listnotebooks = noteBookRepository.findAll(PageRequest.of(0, 2, Sort.by("ID").ascending())).toList();
+ assertEquals(listnotebooks.size(), 2,"FindAll didn't retrieved correct number of records");
+ assertEquals(listnotebooks.get(0).getID(), 1,"FindAll didn't retrieved correct records");
+ assertEquals(listnotebooks.get(1).getID(), 2,"FindAll didn't retrieved correct records");
+
+ }
+
+ @Test
+ public void findOnenotebookById() {
+
+
+ Optional notebook = noteBookRepository.findById(3);
+ assertEquals(true, notebook.isPresent(),"FindOne notebook didn't work");
+ assertEquals("Dell Magic", notebook.get().getName(),"FindOne notebook didn't work");
+ }
+
+ @Test
+ public void saveNewnotebook() {
+ NoteBook notebook = new NoteBook(6,"LG Noteook",299.9);
+ noteBookRepository.save(notebook);
+
+ Optional notebook2 = noteBookRepository.findById(6);
+ assertEquals(true, notebook2.isPresent(),"Save new notebook didn't work");
+ assertEquals("LG Noteook", notebook2.get().getName(),"Save new notebook didn't work");
+ }
+
+ @Test
+ public void updatenotebook() {
+
+ NoteBook notebook = new NoteBook(2,"LG Noteook",399.9);
+ NoteBook notebook2 = noteBookRepository.save(notebook);
+
+ assertNotEquals(null, notebook2,"updatenotebook notebook didn't work");
+ assertEquals("LG Noteook", notebook2.getName(),"updatenotebook didn't work (Name is not set)");
+ assertEquals(399.9, notebook2.getCurrentPrice(),"updatenotebook didn't work (CurrentPrice is not set)");
+
+ }
+
+ @Test
+ public void deletenotebook() {
+
+ noteBookRepository.deleteById(4);
+
+ assertFalse(noteBookRepository.existsById(4),"Delete record didn't work");
+
+
+ }
+}
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/service/NoteBookServiceTest.java b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/service/NoteBookServiceTest.java
new file mode 100644
index 000000000..b159c26bd
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/java/bdp/sample/notebookmanager/service/NoteBookServiceTest.java
@@ -0,0 +1,101 @@
+package bdp.sample.notebookmanager.service;
+
+import bdp.sample.notebookmanager.repositories.NoteBookRepository;
+import bdp.sample.notebookmanager.services.NoteBookService;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.orm.jpa.JpaObjectRetrievalFailureException;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
+import org.springframework.transaction.annotation.Transactional;
+import bdp.sample.notebookmanager.entities.NoteBook;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.ArgumentMatchers.any;
+
+@SpringBootTest
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class)/*classes = { JpaConfig.class },*/
+@Transactional
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:beforeTestRun.sql")
+@Sql(executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, scripts = "classpath:afterTestRun.sql")
+//@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
+public class NoteBookServiceTest {
+
+ @Resource
+ private NoteBookRepository noteBookRepository;
+
+ @Resource
+ private NoteBookService noteBookService;
+
+
+
+
+
+ @Test
+ public void createnotebook() {
+ NoteBook notebook = new NoteBook(6,"LG Noteook",299.9);
+ NoteBook notebook2 = noteBookService.createnotebook(notebook);
+
+ assertNotEquals(null, notebook,"Create new notebook didn't work");
+ assertEquals("LG Noteook", notebook2.getName(),"createnotebook didn't work (Name is not set)");
+ assertEquals(299.9, notebook2.getCurrentPrice(),"createnotebook didn't work (CurrentPrice is not set)");
+ }
+
+
+ @Test
+ public void getExistingnotebookById() {
+
+ NoteBook notebook = noteBookService.getnotebookById(2);
+ assertNotEquals(null, notebook,"getnotebookById didn't work correctly when notebook exists");
+ assertEquals("HP Inspiron", notebook.getName(),"getnotebookById didn't work correctly when notebook exists (Name is not set)");
+ }
+
+ @Test
+ public void getNotExistingnotebookById() {
+
+ NoteBook notebook = noteBookService.getnotebookById(9);
+ assertEquals(null, notebook,"getnotebookById didn't work correctly when notebook doesn't exist");
+ }
+
+ @Test
+ public void listnotebooks()
+ {
+
+ List notebookList = noteBookService.listnotebooks(0,3);
+ assertEquals(3, notebookList.size(), "listnotebooks didn't retrieved correct number of records");
+ assertEquals(1, notebookList.get(0).getID(), "listnotebooks didn't retrieved correct records");
+ assertEquals(3, notebookList.get(2).getID(), "listnotebooks didn't retrieved correct records");
+
+ }
+
+ @Test
+ public void updateNoteBook() {
+ NoteBook notebook = new NoteBook(2,"LG NoteBook",399.9);
+ NoteBook notebook2 = noteBookService.updatenotebook(2,notebook);
+
+ assertNotEquals(null, notebook2,"updateNoteBook notebook didn't work");
+ assertEquals("LG NoteBook", notebook2.getName(),"updateNoteBook didn't work (Name is not set)");
+ assertEquals(399.9, notebook2.getCurrentPrice(),"updateNoteBook didn't work (CurrentPrice is not set)");
+ }
+
+ @Test
+ public void deleteNoteBook() {
+
+ Boolean notebookDeleted = noteBookService.deletenotebook(4);
+
+ assertEquals(true, notebookDeleted,"deletenotebook didn't work ");
+
+ assertThrows(JpaObjectRetrievalFailureException.class, () -> {
+ noteBookRepository.getById(4);},"deleteNoteBook didn't work");
+ }
+
+
+}
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/afterTestRun.sql b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/afterTestRun.sql
new file mode 100644
index 000000000..f95fa1d54
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/afterTestRun.sql
@@ -0,0 +1 @@
+DROP TABLE note_book;
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/application.properties b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/application.properties
new file mode 100644
index 000000000..ea2cb3ff4
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/application.properties
@@ -0,0 +1,5 @@
+jdbc.driverClassName=org.h2.Driver
+spring.datasource.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1
+spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+spring.jpa.hibernate.ddl-auto=create
+##server.port=9999
\ No newline at end of file
diff --git a/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/beforeTestRun.sql b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/beforeTestRun.sql
new file mode 100644
index 000000000..d57c7b8bd
--- /dev/null
+++ b/jdk_8_maven/cs/rest/original/notebook-manager/src/test/resources/beforeTestRun.sql
@@ -0,0 +1,17 @@
+CREATE TABLE IF NOT EXISTS `note_book` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `current_price` double DEFAULT NULL,
+ `last_update` datetime DEFAULT NULL,
+ `name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `UK_name` (`name`)
+);
+
+INSERT INTO `note_book` (`id`, `current_price`, `last_update`, `name`) VALUES
+(1, 211.9, '2022-02-19 14:33:09', 'Asus Vivo Book S'),
+(2, 299.9, '2022-02-19 14:33:11', 'HP Inspiron'),
+(3, 300, '2022-02-19 14:33:11', 'Dell Magic'),
+(4, 709.9, '2022-02-19 14:33:12', 'Apple MacBook'),
+(5, 299.9, '2022-02-19 14:33:12', 'LG D230'),
+(6, 199.9, '2022-02-19 14:33:12', 'Acer P700'),
+(7, 199.9, '2022-02-19 14:33:12', 'Dell B3');
\ No newline at end of file