Index: .gitignore =================================================================== diff -u --- .gitignore (revision 0) +++ .gitignore (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,17 @@ +Thumbs.db +.DS_Store +.gradle +build/ + +### Intellij +.idea +*.iml +*.ipr +*.iws +out + +### Eclipse +.project +.settings +.classpath +bin Index: HELP.md =================================================================== diff -u --- HELP.md (revision 0) +++ HELP.md (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,14 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Gradle documentation](https://docs.gradle.org) +* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/3.3.2/gradle-plugin) +* [Create an OCI image](https://docs.spring.io/spring-boot/3.3.2/gradle-plugin/packaging-oci-image.html) + +### Additional Links +These additional references should also help you: + +* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) + Index: build.gradle =================================================================== diff -u --- build.gradle (revision 0) +++ build.gradle (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,108 @@ +buildscript { + repositories { + mavenLocal() + maven { url 'https://workhorse.lemanscorp.com/nexus/repository/public/' } + } + dependencies { + classpath 'com.lemans.boot.common:lemans-gradle:0.0.1k' + } +} + +plugins { + id 'org.springframework.boot' version '2.2.5.RELEASE' + id 'io.spring.dependency-management' version '1.0.9.RELEASE' + id 'war' + id 'groovy' + id 'codenarc' +} + +apply plugin: 'lemans-war' + +group = 'com.lemans' +sourceCompatibility = '1.8' + +defaultTasks 'clean', 'check' + +repositories { + mavenLocal() + maven { url 'https://workhorse.lemanscorp.com/nexus/repository/public/' } +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-jdbc' + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.codehaus.groovy:groovy' + runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc' + compileOnly 'org.springframework.boot:spring-boot-starter-tomcat' + testImplementation('org.springframework.boot:spring-boot-starter-test') { + exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' + } + + + implementation 'org.codehaus.groovy:groovy-all:3.0.0' + + implementation 'log4j:log4j:1.2.17' + implementation "org.slf4j:slf4j-api:1.7.25" + implementation "org.slf4j:jcl-over-slf4j:1.7.25" + implementation "org.slf4j:jul-to-slf4j:1.7.25" + implementation "org.slf4j:log4j-over-slf4j:1.7.25" + implementation "ch.qos.logback:logback-core" + implementation "ch.qos.logback:logback-classic" + + implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.2' + + implementation 'org.apache.httpcomponents:httpmime:4.5.5' + implementation 'org.apache.httpcomponents:httpclient:4.5.5' + implementation 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' + + implementation 'org.spockframework:spock-core:2.0-M2-groovy-2.5' + implementation 'org.spockframework:spock-spring:2.0-M2-groovy-2.5' + + + implementation 'com.lemans.boot.common:lemans-testing:0.0.2' + implementation 'com.lemans.boot.common:lemans-security:0.0.2' + implementation 'com.lemans.boot.common:lemans-rest:0.0.2' + implementation 'com.lemans.boot.common:lemans-core:0.0.2' + implementation 'com.lemans.boot.common:lemans-gradle:0.0.2' + + implementation group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4' + + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + compile group: 'com.opencsv', name: 'opencsv', version: '3.3' + compile group: 'org.json', name: 'json', version: '20090211' + compile group: 'javax.mail', name: 'mail', version: '1.4.1' + + compile 'dumbster:dumbster:1.6' + compile 'javax.mail:mail:1.4.5' + + compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '1.2.0.RELEASE' + implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.94' + + implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' + implementation 'org.springframework.security:spring-security-oauth2-client' + implementation 'org.springframework.security:spring-security-oauth2-jose' + implementation 'org.springframework.security:spring-security-oauth2-core' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + implementation 'org.springframework.boot:spring-boot-starter-webflux' + +} + +test { + useJUnitPlatform() +} + +tasks.withType(Test) { + testLogging { + showStandardStreams = true + } + systemProperties System.properties +} + +tasks.withType(JavaExec) { + systemProperties System.properties +} + +codenarc { + toolVersion = '1.0' + configFile = file("${project.projectDir}/codenarc/rules.groovy") +} Index: codenarc/rules.groovy =================================================================== diff -u --- codenarc/rules.groovy (revision 0) +++ codenarc/rules.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,81 @@ +ruleset { + ruleset('rulesets/basic.xml') + ruleset('rulesets/braces.xml') + ruleset('rulesets/concurrency.xml') + ruleset('rulesets/convention.xml') { + exclude 'NoDef' + exclude 'NoTabCharacter' + exclude 'TrailingComma' + exclude 'MethodReturnTypeRequired' + exclude 'CompileStatic' + } + ruleset('rulesets/design.xml') { + exclude 'AbstractClassWithoutAbstractMethod' + exclude 'EmptyMethodInAbstractClass' + exclude 'SimpleDateFormatMissingLocale' + } + ruleset('rulesets/dry.xml') { + exclude 'DuplicateListLiteral' + exclude 'DuplicateNumberLiteral' + exclude 'DuplicateMapLiteral' + exclude 'DuplicateStringLiteral' + } + ruleset('rulesets/enhanced.xml') + ruleset('rulesets/exceptions.xml') + ruleset('rulesets/formatting.xml') { + exclude 'ClassStartsWithBlankLine' + exclude 'ClassJavadoc' + exclude 'ConsecutiveBlankLines' + LineLength { + length = 200 + } + SpaceAroundMapEntryColon { + characterAfterColonRegex = /\s/ + } + exclude 'TrailingWhitespace' + } + ruleset('rulesets/generic.xml') + ruleset('rulesets/grails.xml') { + exclude 'GrailsDomainHasEquals' + exclude 'GrailsDomainHasToString' + } + ruleset('rulesets/groovyism.xml') + ruleset('rulesets/imports.xml') + ruleset('rulesets/jdbc.xml') + ruleset('rulesets/junit.xml') + ruleset('rulesets/logging.xml') + ruleset('rulesets/naming.xml') { + exclude 'FactoryMethodName' + MethodName { // helps Spock + regex = /[a-zA-Z#][_#.\w\s'"\(\)]*/ + } + PropertyName { + regex = /[a-z][_a-zA-Z0-9]*/ + } + } + ruleset('rulesets/security.xml') { + exclude 'JavaIoPackageAccess' + } + ruleset('rulesets/serialization.xml') + ruleset('rulesets/size.xml') { + CyclomaticComplexity { // Requires the GMetrics jar + maxMethodComplexity = 15 + } + MethodSize { + maxLines = 26 + doNotApplyToClassNames = '*Spec' + } + MethodSize { + maxLines = 41 + applyToClassNames = '*Spec' + } + } + ruleset('rulesets/unnecessary.xml') { + UnnecessaryBooleanExpression { + doNotApplyToClassNames = '*Spec*' + } + exclude 'UnnecessaryGString' + + } + ruleset('rulesets/unused.xml') +} \ No newline at end of file Index: gradle/wrapper/gradle-wrapper.jar =================================================================== diff -u Binary files differ Index: gradle/wrapper/gradle-wrapper.properties =================================================================== diff -u --- gradle/wrapper/gradle-wrapper.properties (revision 0) +++ gradle/wrapper/gradle-wrapper.properties (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,5 @@ +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME Index: gradlew =================================================================== diff -u --- gradlew (revision 0) +++ gradlew (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" Index: gradlew.bat =================================================================== diff -u --- gradlew.bat (revision 0) +++ gradlew.bat (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega Index: lib/groovy-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-ant-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-ant-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-astbuilder-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-astbuilder-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-cli-commons-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-cli-commons-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-cli-picocli-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-cli-picocli-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-console-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-console-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-contracts-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-contracts-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-datetime-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-datetime-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-dateutil-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-dateutil-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-docgenerator-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-docgenerator-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-ginq-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-ginq-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-groovydoc-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-groovydoc-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-groovysh-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-groovysh-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-jmx-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-jmx-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-json-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-json-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-jsr223-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-jsr223-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-macro-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-macro-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-macro-library-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-macro-library-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-nio-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-nio-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-servlet-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-servlet-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-sql-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-sql-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-swing-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-swing-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-templates-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-templates-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-test-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-test-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-test-junit5-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-test-junit5-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-testng-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-testng-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-toml-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-toml-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-typecheckers-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-typecheckers-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: lib/groovy-xml-5.0.0-alpha-1-sources.jar =================================================================== diff -u Binary files differ Index: lib/groovy-xml-5.0.0-alpha-1.jar =================================================================== diff -u Binary files differ Index: settings.gradle =================================================================== diff -u --- settings.gradle (revision 0) +++ settings.gradle (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1 @@ +rootProject.name = 'product-feed-service' Index: src/main/groovy/com/lemans/productfeed/ProductFeedApplication.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/ProductFeedApplication.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/ProductFeedApplication.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,12 @@ +package com.lemans.productfeed + +import org.springframework.boot.SpringApplication +import org.springframework.boot.autoconfigure.SpringBootApplication + +@SpringBootApplication +class ProductFeedApplication { + + static void main(String[] args) { + SpringApplication.run(ProductFeedApplication, args) + } +} Index: src/main/groovy/com/lemans/productfeed/ServletInitializer.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/ServletInitializer.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/ServletInitializer.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,13 @@ +package com.lemans.productfeed + +import org.springframework.boot.builder.SpringApplicationBuilder +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer + +class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + application.sources(ProductFeedApplication) + } + +} Index: src/main/groovy/com/lemans/productfeed/controllers/FitmentController.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/controllers/FitmentController.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/controllers/FitmentController.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,29 @@ +package com.lemans.productfeed.controllers + +import com.lemans.api.LeMansApiController +import org.json.JSONObject +import org.json.XML +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/dm/{dm}") +class FitmentController extends LeMansApiController { + + def fitmentService + + @GetMapping(value = "/getFitment") + def index() { + String results = fitmentService.findFitments([ + params.dm, + params.catalogInstanceId ?: null, + params.mk ?: null, + params.md ?: null, + params.yr ?: null, + params.vehicleTypeId ? params.list('vehicleTypeId').join(',') : null + ]) + JSONObject xmlJSONObj = XML.toJSONArray(results) + render text: xmlJSONObj, contentType: 'application/json' + } +} Index: src/main/groovy/com/lemans/productfeed/controllers/MasterFeedController.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/controllers/MasterFeedController.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/controllers/MasterFeedController.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,67 @@ +package com.lemans.productfeed.controllers + +import com.lemans.api.LeMansApiController +import org.json.JSONObject +import org.json.XML +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +import java.sql.SQLException + +@RestController +@RequestMapping("/dm/{dm}") +class MasterFeedController extends LeMansApiController { + + private static final int PRETTY_PRINT_INDENT_FACTOR = 4 + + def productFeedService + + @PostMapping(value = "/masterFeed") + def xml () { + List errors = [] + List criteria = criteria(errors) + if (errors) { + response.status = 412 + render toJson(errors) + } + else { + try { + JSONObject xmlJSONObj = XML.toJSONArray(productFeedService.masterFeedXml(criteria)) + if (!('true' == params.doNotRender)) { + String jsonPrettyPrintString = xmlJSONObj.toString(PRETTY_PRINT_INDENT_FACTOR) + render(contentType: 'application/json', text: jsonPrettyPrintString) + } + xmlJSONObj + } catch (SQLException x) { + response.status = 500 + render toJson(message: x.message) + } + } + } + + private List criteria(List errors) { + List criteria = [] + criteria << validateAsInteger('templateId', errors) + criteria << params.templateName ?: null + criteria << validateAsInteger('dm', errors) + criteria << validateAsInteger('catalogInstanceId', errors) + criteria << validateAsInteger('categoryId', errors) + criteria << validateAsInteger('productId', errors) + criteria << validateAsInteger('productGroupId', errors) + criteria << params.partNumber ?: null + criteria << params.locale ?: null + criteria << params.dealerCode ?: null + criteria << params.vehicleTypeId ? params.list('vehicleTypeId').join(',') : null + criteria + } + + private Integer validateAsInteger(String field, List errors) { + String data = params[field] ?: null + if (data && !data?.isInteger()) { + errors << [message: "Invalid data type for the field: $field"] + null + } + else { data?.toInteger() } + } +} Index: src/main/groovy/com/lemans/productfeed/controllers/PartProductGroupController.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/controllers/PartProductGroupController.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/controllers/PartProductGroupController.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,20 @@ +package com.lemans.productfeed.controllers + +import com.lemans.api.LeMansApiController +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/dm/{dm}") +class PartProductGroupController extends LeMansApiController { + + def partsService + + // FIXME: throws NPE on no partNumbers + @GetMapping(value = "/getParts") + def index() { + String[] partNumbers = request.JSON.partNumbers.split(',') + render toJson(partsService.findPartsWithProductGroup(partNumbers, params.dm)) + } +} Index: src/main/groovy/com/lemans/productfeed/services/FitmentService.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/services/FitmentService.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/services/FitmentService.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,22 @@ +package com.lemans.productfeed.services + +import com.lemans.services.LemansService +import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional + +@Service +@Transactional +class FitmentService extends LemansService { + + private static final CATALOG_FITMENT_SQL = + 'EXEC dbo.spDomainCatalogInstanceFitment @domainId = ?, @catalogInstanceId = ?, @makeId = ?, @modelId = ?, @year = ?, @vehicleTypeId = ?' + + /** + * Finds catalog fitment data. + * + * @param criteria containing domainId, catalogInstanceId, and optional makeId, modelId, year + * + * @return results as XML + */ + String findFitments(List criteria) { queryForXml(CATALOG_FITMENT_SQL, criteria) } +} Index: src/main/groovy/com/lemans/productfeed/services/PartsService.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/services/PartsService.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/services/PartsService.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,27 @@ +package com.lemans.productfeed.services + +import com.lemans.services.LemansService +import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional + +@Service +@Transactional +class PartsService extends LemansService { + + private static final String PRODUCTPART_BY_PARTNUMBER_SQL = 'EXEC dbo.spProductPartByPartNumber @domainId=?, @xml=?, @locale=?' + + /** + * Finds parts with product info including retail pricing by domain. + * + * @param partNumbers + * @param domain + * + * @return parts List with product info + */ + List findPartsWithProductGroup(String[] partNumbers, domain) { + String partNumberXml = xmlOnRoot { + partNumbers.each { part it } + } + sql().rows(PRODUCTPART_BY_PARTNUMBER_SQL, [domain, partNumberXml, 'en']) + } +} Index: src/main/groovy/com/lemans/productfeed/services/ProductFeedService.groovy =================================================================== diff -u --- src/main/groovy/com/lemans/productfeed/services/ProductFeedService.groovy (revision 0) +++ src/main/groovy/com/lemans/productfeed/services/ProductFeedService.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,36 @@ +package com.lemans.productfeed.services + +import com.lemans.services.LemansService +import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional + +@Service +@Transactional +class ProductFeedService extends LemansService { + + private static final String MASTER_FEED_SQL = + '''EXEC dbo.spFeedContent + @domainSiteTemplateId=?, + @siteTemplateName=?, + @selectedDomainId = ?, + @selectedCatalogInstanceId = ?, + @selectedCategoryId = ?, + @selectedProductId = ?, + @selectedProductGroupId = ?, + @selectedPartNumber = ?, + @locale = ?, + @dealerCode = ?, + @vehicleTypeId = ? +''' + + /** + * Finds master data feed. + * + * @param criteria + * + * @return XML + */ + String masterFeedXml(List criteria) { + queryForXml(MASTER_FEED_SQL, criteria) + } +} Index: src/main/resources/application.groovy =================================================================== diff -u --- src/main/resources/application.groovy (revision 0) +++ src/main/resources/application.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,9 @@ +import com.lemans.services.Env + +if (Env.getCurrent() == Env.PRODUCTION) { + spring.datasource.'jndi-name'='java:comp/env/jdbc/productfeedDataSource' +} else { + spring.datasource.url='jdbc:sqlserver://dev-dbprod02VM;databaseName=PartsSource' + spring.datasource.username='partssource_user' + spring.datasource.password='DevPassword1' +} \ No newline at end of file Index: src/main/resources/application.properties =================================================================== diff -u --- src/main/resources/application.properties (revision 0) +++ src/main/resources/application.properties (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,24 @@ +spring.application.name=product-feed-service +server.servlet.context-path=/product-feed-service + +spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver + +spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.SQLServer2008Dialect +spring.jpa.hibernate.ddl-auto = none + +#logging sql +logging.level.com.microsoft.sqlserver.jdbc=debug + +logging.level.org.hibernate.SQL=DEBUG +logging.level.org.hibernate.type=TRACE + +#logging.level.root=DEBUG + +spring.jpa.properties.hibernate.show_sql=true +spring.jpa.properties.hibernate.use_sql_comments=true +spring.jpa.properties.hibernate.format_sql=true + +spring.profiles.active=development + Index: src/main/resources/resources.groovy =================================================================== diff -u --- src/main/resources/resources.groovy (revision 0) +++ src/main/resources/resources.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,11 @@ +import com.lemans.services.Env +beans { + + if (Env.getCurrent() == Env.PRODUCTION) { + authServiceContext(org.springframework.jndi.JndiObjectFactoryBean) { + jndiName = 'java:comp/env/authServiceContext' + } + } else { + authServiceContext(String, 'http://services3.dev.lemanscorp.com/auth-service/verifyRequest') + } +} Index: src/test/groovy/com/lemans/productfeed/FitmentFuncSpec.groovy =================================================================== diff -u --- src/test/groovy/com/lemans/productfeed/FitmentFuncSpec.groovy (revision 0) +++ src/test/groovy/com/lemans/productfeed/FitmentFuncSpec.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,97 @@ +package com.lemans.productfeed + +import com.lemans.productfeed.testing.ProductFeedServiceApiFuncSpec + +class FitmentFuncSpec extends ProductFeedServiceApiFuncSpec { + + @Override + String resourceName() { 'getFitment' } + + int catalogInstanceId = 257 + + def setup() { + queryParams.catalogInstanceId = catalogInstanceId + } + + def 'can find fitment details for a year'() { + given: + queryParams.yr = '2005' + path() + ok() + + when: + get() + + then: + with(payload.root[0]) { + years.size() == 1 + makes.size() >= 3 + } + } + + def 'can find fitment details for a catalogInstanceId'() { + given: + path() + ok() + + when: + get() + + then: + with(payload.root[0]) { + makes.size() >= 3 + years.size() >= 35 + } + } + + def 'can find fitment details for a catalogInstanceId and make'() { + given: + queryParams.mk = '31' + path() + ok() + + when: + get() + + then: + with(payload.root[0]) { + makes.size() == 1 + years.size() >= 25 + } + } + + def 'can find fitment details for a catalogInstanceId make and model'() { + given: + queryParams.mk = '31' + queryParams.md = '14627' + path() + ok() + + when: + get() + + then: + with(payload.root[0]) { + makes.size() == 1 + years.size() == 13 + } + } + + def 'can find fitment details for a catalogInstanceId make model and year'() { + given: + queryParams.mk = '31' + queryParams.md = '14627' + queryParams.yr = '2010' + path() + ok() + + when: + get() + + then: + with(payload.root[0]) { + makes.size() == 1 + years.size() == 1 + } + } +} Index: src/test/groovy/com/lemans/productfeed/MasterFeedFuncSpec.groovy =================================================================== diff -u --- src/test/groovy/com/lemans/productfeed/MasterFeedFuncSpec.groovy (revision 0) +++ src/test/groovy/com/lemans/productfeed/MasterFeedFuncSpec.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,136 @@ +package com.lemans.productfeed + +import com.lemans.productfeed.testing.ProductFeedServiceApiFuncSpec + +class MasterFeedFuncSpec extends ProductFeedServiceApiFuncSpec { + + @Override + String resourceName() { 'masterFeed' } + + def 'can get a PART master feed for a PNW dealer with embedded html'() { + given: + queryParams.templateName = 'Part' + queryParams.partNumber = '0010401' + queryParams.dealerCode = 'DUT007' + queryParams.locale = 'en' + path() + ok() + + when: + post() + + then: + with(payload) { + root.size() == 1 + with(root[0]) { + domain.size() == 1 + with(domain[0]) { + selected.size() == 1 + selected[0].partNumber == '0010401' + domainId == 4 + } + } + } + } + + def 'can get a PART master feed for a PNW dealer'() { + given: + queryParams.templateName = 'Part' + queryParams.partNumber = 'B8ES' + queryParams.dealerCode = 'DUT007' + queryParams.locale = 'en' + path() + ok() + + when: + post() + + then: + with(payload) { + root.size() == 1 + with(root[0]) { + domain.size() == 1 + with(domain[0]) { + selected.size() == 1 + selected[0].partNumber == 'B8ES' + domainId == 4 + } + } + } + } + + def 'can get a CATEGORIES master feed'() { + given: + queryParams.templateName = 'Categories' + domain = 8 + queryParams.catalogInstanceId = '135' + queryParams.categoryId = '2225' + queryParams.locale = 'en' + path() + ok() + + when: + post() + + then: + with(payload) { + root.size() == 1 + with(root[0]) { + domain.size() == 1 + with(domain[0]) { + selected.size() == 1 + selected[0].catalogInstanceId == 135 + selected[0].categoryId == 2225 + domainId == 8 + } + } + } + } + + def 'can NOT get a master feed without a templateName'() { + given: + queryParams.templateName = null + queryParams.partNumber = 'B8ES' + queryParams.dealerCode = 'DUT007' + path() + error() + + when: + post() + + then: + payload.message == 'The executeQuery method must return a result set.' + } + + def 'can NOT get a master feed with a bad domain'() { + given: + queryParams.templateName = 'part' + queryParams.partNumber = 'B8ES' + queryParams.dealerCode = 'DUT007' + domain = null + path(dm: 'xyz') + expectedStatusCode = 412 + + when: + post() + + then: + payload.find { it.message == 'Invalid data type for the field: dm' } + } + + def 'can NOT get a master feed with an unsupported domain'() { + given: + queryParams.templateName = 'part' + domain = -1 + queryParams.partNumber = 'B8ES' + queryParams.dealerCode = 'DUT007' + path() + error() + + when: + post() + + then: + payload.message == 'The executeQuery method must return a result set.' + } +} Index: src/test/groovy/com/lemans/productfeed/PartProductGroupFuncSpec.groovy =================================================================== diff -u --- src/test/groovy/com/lemans/productfeed/PartProductGroupFuncSpec.groovy (revision 0) +++ src/test/groovy/com/lemans/productfeed/PartProductGroupFuncSpec.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,35 @@ +package com.lemans.productfeed + +import com.lemans.productfeed.testing.ProductFeedServiceApiFuncSpec + +class PartProductGroupFuncSpec extends ProductFeedServiceApiFuncSpec { + + @Override + String resourceName() { 'getParts' } + + def 'can find parts with product group'() { + given: + String json = '{ "partNumbers": "b8es,0010503" }' + path() + ok() + + when: + post(json) + + then: + with(payload) { + size() == 2 + assetPath.every { it == '/media/edge' } + productGroupId.every { it } + productGroupName.every { it != null } + productId.every { it } + productName.every { it } + retailPrice.every { + BigDecimal price = it + price + } + } + payload.find { it.partNumber == '0010503' } + payload.find { it.partNumber.toLowerCase() == 'b8es' } + } +} Index: src/test/groovy/com/lemans/productfeed/security/TokenVerificationFuncSpec.groovy =================================================================== diff -u --- src/test/groovy/com/lemans/productfeed/security/TokenVerificationFuncSpec.groovy (revision 0) +++ src/test/groovy/com/lemans/productfeed/security/TokenVerificationFuncSpec.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,34 @@ +package com.lemans.productfeed.security + +import com.lemans.productfeed.testing.ProductFeedServiceApiFuncSpec + +class TokenVerificationFuncSpec extends ProductFeedServiceApiFuncSpec { + + def 'can act with a valid security token'() { + given: + System.setProperty('ignoreToken', 'true') + domain = null + path() + expectedStatusCode = 200 + + when: + get() + + then: + payload.results == 'product-feed-service' + } + + def 'can NOT act without a valid security token'() { + given: + System.setProperty('ignoreToken', '') + domain = null + path() + expectedStatusCode = 401 + + when: + get() + + then: + payload.messages[0].text == 'no credentials' + } +} Index: src/test/groovy/com/lemans/productfeed/testing/ProductFeedServiceApiFuncSpec.groovy =================================================================== diff -u --- src/test/groovy/com/lemans/productfeed/testing/ProductFeedServiceApiFuncSpec.groovy (revision 0) +++ src/test/groovy/com/lemans/productfeed/testing/ProductFeedServiceApiFuncSpec.groovy (revision be4f46239a7258e822029151273ffeb0796cd7f2) @@ -0,0 +1,23 @@ +package com.lemans.productfeed.testing + +import com.lemans.productfeed.ProductFeedApplication +import com.lemans.productfeed.services.ProductFeedService +import com.lemans.testing.LemansApiFunctionalSpec +import groovyx.net.http.HTTPBuilder +import org.springframework.beans.factory.annotation.Value +import org.springframework.boot.test.context.SpringBootTest + +@SpringBootTest(classes = ProductFeedApplication, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +class ProductFeedServiceApiFuncSpec extends LemansApiFunctionalSpec { + + @Override + final String serviceName() { 'product-feed-service' } + + @Value('${local.server.port}') + Integer serverPort + + def setup() { + port = serverPort + http = new HTTPBuilder(url()) + } +}