Browse Source

test invoker

kylegu 4 years ago
commit
e89db17293

+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.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/

+ 117 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,117 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    private static final String WRAPPER_VERSION = "0.5.6";
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+        + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if(mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if(mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if(!outputFile.getParentFile().exists()) {
+            if(!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+            String username = System.getenv("MVNW_USERNAME");
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+            Authenticator.setDefault(new Authenticator() {
+                @Override
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(username, password);
+                }
+            });
+        }
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

BIN
.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

+ 310 - 0
mvnw

@@ -0,0 +1,310 @@
+#!/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 /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="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.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"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$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 \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182 - 0
mvnw.cmd

@@ -0,0 +1,182 @@
+@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 "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.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 "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

+ 92 - 0
pom.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.4.0</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>com.xingyue</groupId>
+	<artifactId>atbird.cs</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>atbird.cs</name>
+	<description>ATBird_CS</description>
+
+	<properties>
+		<java.version>1.8</java.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-actuator</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-data-jdbc</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-jdbc</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-quartz</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-devtools</artifactId>
+			<scope>runtime</scope>
+			<optional>true</optional>
+		</dependency>
+		<dependency>
+			<groupId>com.oracle.database.jdbc</groupId>
+			<artifactId>ojdbc8</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.postgresql</groupId>
+			<artifactId>postgresql</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<optional>true</optional>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-exec -->
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-exec</artifactId>
+			<version>1.3</version>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

+ 14 - 0
src/main/java/com/xingyue/atbird/cs/Application.java

@@ -0,0 +1,14 @@
+package com.xingyue.atbird.cs;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
+public class Application {
+
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class, args);
+	}
+
+}

+ 65 - 0
src/main/java/com/xingyue/atbird/cs/dto/BaseResponseDTO.java

@@ -0,0 +1,65 @@
+package com.xingyue.atbird.cs.dto;
+
+public class BaseResponseDTO {
+    private Integer code;
+    private String message;
+    private Object data;
+    public static final BaseResponseDTO OK;
+
+    public static BaseResponseDTO OK(Object data) {
+        return new BaseResponseDTO(HttpStatus.OK, data);
+    }
+
+    public BaseResponseDTO() {
+    }
+
+    public BaseResponseDTO(HttpStatus status, Object object) {
+        this.code = status.getCode();
+        this.message = status.getMessage();
+        this.data = object;
+    }
+
+    public BaseResponseDTO(HttpStatus status) {
+        this.code = status.getCode();
+        this.message = status.getMessage();
+    }
+
+    public Integer getCode() {
+        return this.code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public Object getData() {
+        return this.data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    public void setBaseResponseDTO(HttpStatus status, Object object) {
+        this.code = status.getCode();
+        this.message = status.getMessage();
+        this.data = object;
+    }
+
+    public void setBaseResponseDTO(HttpStatus status) {
+        this.code = status.getCode();
+        this.message = status.getMessage();
+    }
+
+    static {
+        OK = new BaseResponseDTO(HttpStatus.OK);
+    }
+}

+ 177 - 0
src/main/java/com/xingyue/atbird/cs/dto/HttpStatus.java

@@ -0,0 +1,177 @@
+package com.xingyue.atbird.cs.dto;
+
+public enum HttpStatus {
+    OK(2000, "Success"),
+    REDIRECTION(3000, "Redirection"),
+    CLIENT_ERROR(4000, "Client Error"),
+    UNAUTHORIZED(4001, "unauthorized"),
+    USER_NOT_EXIST(4002, "user not exist"),
+    USER_EMAIL_NOT_EXIST(4088, "The Email does not exist. Please try again."),
+    USER_EMAIL_NOT_ENABLED(4089, "Sorry, this email can not change password here, please check with your account manager."),
+    USER_DISABLED(4090, "This user is disabled now."),
+    USER_NOT_ACTIVATED(4091, "This user account hasn't been activated."),
+    INCORRECT_PASSWORD(4003, "incorrect password"),
+    USER_ALREADY_EXIST(4004, "user already exit"),
+    TIME_OUT(4005, "time out"),
+    USER_STATUS_UNAVAILABLE(4006, "user is not allowed to login"),
+    PARAM_INCORRECT(4007, "param is incorrect"),
+    INVALID_SERVICE_TYPE(4008, "invalid service type"),
+    NETWORK_ANOMALY(4009, "network anomaly"),
+    NOT_INCLUDED(4010, "not included"),
+    DATE_FORMAT_ERROR(4011, "date format error"),
+    MAIL_ANNEX_ERROR(4012, "annex filename and data not matche"),
+    FAILED_SEND_MAIL(4013, "failed to send mail"),
+    CONNECTION_FAILED(4014, "failed to connected sftp server"),
+    BIDDING_CONFIG_HEADER_NOT_EXIST(4015, "bidding config header not exist"),
+    BASE64_DECODE_DATA_TO_FILE_ERROR(4016, "base64 decode data to file error"),
+    BIDDING_CONFIG_NOT_EXIST(4017, "can not find this bidding config"),
+    FILE_EXIST_ERROR(4018, "file already exist."),
+    HOTEL_IS_EMPTY(4019, "hotel must can't be empty"),
+    UID_NOT_FIND(4020, "can not find uid"),
+    MAPPING_ALREADY_EXIST(4021, "mapping alread exist in this field"),
+    NOT_ALLOWED_DELETE(4022, "this field been used"),
+    UPLOAD_FAILED(4023, "Failed"),
+    UPLOAD_WARNING(4024, "Partial Successful"),
+    FEED_NAME_ALREADY_EXIST(4025, "feed name already exist"),
+    EXIST_FEED_NOT_COMPLETE(4026, "exist a feed not complete"),
+    FEED_NOT_ALLOW_CHANGE_STATUS(4027, "feed not allow change status"),
+    FEED_NOT_GENERATE(4028, "feed not gerenate"),
+    IP_OUT_OF_LIMIT(4029, "this ip visit time out of limit"),
+    FEED_NOT_ALLOW_DELETE_STATUS(4030, "feed not allow to be deleted"),
+    FEED_NOT_ALLOW_TO_VISIT(4031, "feed not allow to visit"),
+    BIDDING_CONFIG_NOT_ENABLED(4032, " status not open yet"),
+    FEED_NOT_ALLOW_TO_EDIT(4033, "feed not allow to edit"),
+    FEED_XML_SETTING_ALREADY_EXIST(4034, "feed xml setting node already exist"),
+    FEED_XML_SETTING_NOT_EXIST(4035, "feed xml setting node is not exist"),
+    EMPTY_OR_ILLEGAL_NAME(4036, "empty or illegal name"),
+    FEED_NOT_CONTAIN_TAX_RATE(4037, "The \"Tax Inclusive Rate\" or \"Tax Exclusive Rate\" field must be selected"),
+    FEED_NOTE_ALLOW_TO_ACCESS(4038, "feed not allowed to access this feed"),
+    BIDDING_CONFIG_NOT_CORRECT(4039, " bidding config not correct"),
+    GOOGLE_ACCOUNT_NOT_EXIST(4040, "can not find this google account"),
+    CAMPAIGN_NOT_EXIST(4041, "can not find this campaign"),
+    CAMPAIGN_NOT_CORRECT(4042, "campaign not correct"),
+    CHANNEL_CAMPAIGN_ID_NOT_EXIST(4043, "channel campaign id not exist"),
+    GROUP_NOT_EXIST(4044, "can not find this group"),
+    CAMPAIGN_NAME_REPEAT(4045, "campaign name repeat"),
+    GROUP_NAME_REPEAT(4046, "group name repeat"),
+    GROUP_NOT_EXIST_IN_CAMPAIGN(4047, "can not find this group in current campaign"),
+    GOOGLE_CAMPAIGN_ACCOUNT_MAPPING_NOT_FOUND(4048, "No account association relationships are found. Please try agian later or contact your account manager."),
+    GROUP_NOT_CORRECT(4049, "group not correct"),
+    CAMPAIGN_NUMBER_OVER_LIMIT(4050, "number of campaign exceeds the upper limit"),
+    GROUP_NUMBER_OVER_LIMIT(4051, "number of group exceeds the upper limit"),
+    GOOGLE_ACCOUNT_NOT_FOUND(4052, "no google account found for current user"),
+    PARAM_INCORRECT_LIST(4053, "param list is incorrect"),
+    GOOGLE_CAMPAIGN_FORBIDDEN(4054, "access forbidden"),
+    GOOGLE_CAMPAIGN_AUDIT_FAILED(4055, "audit failed"),
+    GOOGLE_CAMPAIGN_ACCOUNT_MAPPING_INCORRECT(4056, "Account association relationships are incorrect. Please try agian later or contact your account manager."),
+    GOOGLE_CAMPAIGN_NOT_SUPPORT_MULTIPLIER(4057, "This strategy not support multiplier"),
+    CLICK_ARI_INVALID_FILE_FORMAT(4060, "please upload the correct xls file or xlsx file"),
+    CLICK_ARI_INVALID_XLS_HEADER(4061, "The name or order of header is incorrect, please try again."),
+    CLICK_ARI_XLS_FILE_VALIDATION_ERROR(4062, "validation errors happen in the uploaded file"),
+    CLICK_ARI_CHANNEL_TBL_NOT_EXISTS(4063, "channel table not exists, try to upload the file first"),
+    BING_ACCOUNT_NOT_FOUND(4071, "We cannot detect a Bing account. Sync program may need more time. Please try again later or check with your account manager."),
+    BING_ACCOUNT_NOT_AVAILABLE(4072, "Oops! It seems you don't have available account to create a new campaign. Please add more account and try again. (* Kindly note one account can only create 1 campaign based on channel limitation.)"),
+    BING_CAMPAIGN_NAME_REPEAT(4073, "This Campaign Name already exists. Please give each Campaign a unique name."),
+    BING_DAILY_BUDGET_LT_LIMIT(4074, "daily budget must greater than 0.05"),
+    BING_CAMPAIGN_NOT_FOUND(4075, "no campaign found"),
+    BING_CAMPAIGN_SIZE_OVER_LIMIT(4076, "number of campaigns exceeds the upper limit"),
+    BING_GROUP_NOT_FOUND(4077, "no group found"),
+    BING_HOTEL_NOT_FOUND(4078, "We cannot detect any hotels at this moment. Please try again later or check with your account manager."),
+    BING_UNGROUP_NOT_FOUND(4079, "no ungroup found"),
+    BING_HOTEL_INVALID(4080, "hotel invalid"),
+    BING_ACCOUNT_BEEN_UPDATE(4081, "The channel account you selected has been updated, please reselect it."),
+    BING_CAMPAIGN_FORBIDDEN(4082, "access forbidden"),
+    BING_HOTEL_PARTIAL_FAILURE(4085, "Partially failure when bulk assign/push hotels to bing."),
+    BING_HOTEL_TOTAL_FAILURE(4086, "Totally failure when bulk assign/push hotels to bing."),
+    BING_UNGROUP_FOUND_WHEN_OPERATE_HOTEL(4087, "Ungrouped found when operate hotels."),
+    NOT_ALLOWD_TO_UPDATE(4048, "not allowed to edit"),
+    EMPTY_RELATIONSHIP(4049, "empty relationship"),
+    ACCOUNT_HOTEL_NOT_EXIST(4050, " can't not found account_hotel list"),
+    ACCOUNT_CHANNEL_NOT_EXIST(4051, " can't not found account_channel list"),
+    ACCOUNT_CHANNEL_HOTEL_NOT_EXIST(4052, " can't not found account_channel_hotel list"),
+    SUPPLIER_CODE_ALREADY_EXIST(4053, "supplier code already exist"),
+    EMPTY_FILE(4054, "File is empty"),
+    PNB_FILE_HEADER_NOT_MATCH(4055, "Upload failed. Header changed, please revise the value and upload again. "),
+    UNAUTHORIZED_IP(4100, "this ip is not allowed to visit resource"),
+    TRANSACTION_TIMEOUT(4084, "transaction timeout"),
+    SERVER_ERROR(5000, "Server Error"),
+    ERROR_IN_DATABASE(5001, "a problem has occurred in database"),
+    ERROR_IN_CACHE(5002, "a problem has occurred in cache"),
+    INTERNAL_SERVER_ERROR(5003, "Service unavailable"),
+    ANALYZE_FAILED(5004, "can not analyze such ip"),
+    BIDDING_EXECUTION_ERROR(5005, "Error in bidding execution"),
+    NOT_GET_REDIS_POOL(5006, "can not get redis connection from pool"),
+    USER_SUPPLIER_IS_EMPTY(6001, "current user don't binding any suppliers"),
+    NOT_ANY_FEED_GENERATE(6002, "there is not any feed to gengerate");
+
+    private final int code;
+    private final String message;
+
+    private HttpStatus(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+    public String toString() {
+        return "HttpStatus{code=" + this.code + ", message='" + this.message + '\'' + '}';
+    }
+
+    public HttpStatus.Series series() {
+        return HttpStatus.Series.valueOf(this);
+    }
+
+    public static HttpStatus valueOf(int statusCode) {
+        HttpStatus[] var1 = values();
+        int var2 = var1.length;
+
+        for(int var3 = 0; var3 < var2; ++var3) {
+            HttpStatus status = var1[var3];
+            if (status.code == statusCode) {
+                return status;
+            }
+        }
+
+        throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
+    }
+
+    public static enum Series {
+        INFORMATIONAL(1),
+        SUCCESSFUL(2),
+        REDIRECTION(3),
+        CLIENT_ERROR(4),
+        SERVER_ERROR(5);
+
+        private final int value;
+
+        private Series(int value) {
+            this.value = value;
+        }
+
+        public int value() {
+            return this.value;
+        }
+
+        private static HttpStatus.Series valueOf(HttpStatus status) {
+            int seriesCode = status.getCode() / 1000;
+            HttpStatus.Series[] var2 = values();
+            int var3 = var2.length;
+
+            for(int var4 = 0; var4 < var3; ++var4) {
+                HttpStatus.Series series = var2[var4];
+                if (series.value == seriesCode) {
+                    return series;
+                }
+            }
+
+            throw new IllegalArgumentException("No matching constant for [" + status + "]");
+        }
+    }
+}

+ 32 - 0
src/main/java/com/xingyue/atbird/cs/invoker/TestInvoker.java

@@ -0,0 +1,32 @@
+package com.xingyue.atbird.cs.invoker;
+
+import com.xingyue.atbird.cs.dto.BaseResponseDTO;
+import com.xingyue.atbird.cs.util.ExecUtils;
+import com.xingyue.atbird.cs.util.ResultUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.UUID;
+
+@Slf4j
+@RestController
+@RequestMapping("/invoker")
+public class TestInvoker {
+
+    private final static String CALLBACK = "http://localhost:8080/listener/callback.do";
+
+    @RequestMapping(value = "/test.do")
+    public BaseResponseDTO test(String exepath) throws InterruptedException {
+        String uuid = UUID.randomUUID().toString();
+        System.out.println(uuid);
+        String cmd = "cmd /c " + exepath + " " + uuid + " " + CALLBACK;
+        String result = ExecUtils.exec(cmd);
+        System.out.println(result);
+        while (!ResultUtils.RESULT_MAP.containsKey(uuid)){
+            Thread.sleep(500);
+        }
+        result = ResultUtils.RESULT_MAP.get(uuid);
+        return BaseResponseDTO.OK(result);
+    }
+}

+ 18 - 0
src/main/java/com/xingyue/atbird/cs/listener/CallBackListener.java

@@ -0,0 +1,18 @@
+package com.xingyue.atbird.cs.listener;
+
+import com.xingyue.atbird.cs.dto.BaseResponseDTO;
+import com.xingyue.atbird.cs.util.ResultUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@RequestMapping("/listener")
+public class CallBackListener {
+    @RequestMapping(value = "/callback.do")
+    public BaseResponseDTO callback(String uuid, String result) {
+        ResultUtils.RESULT_MAP.put(uuid, result);
+        return BaseResponseDTO.OK("callback ok: " + uuid);
+    }
+}

+ 25 - 0
src/main/java/com/xingyue/atbird/cs/util/ExecUtils.java

@@ -0,0 +1,25 @@
+package com.xingyue.atbird.cs.util;
+
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.PumpStreamHandler;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public class ExecUtils {
+
+    public static String exec(String cmd){
+        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
+        PumpStreamHandler psh = new PumpStreamHandler(stdout);
+        CommandLine cl = CommandLine.parse(cmd);
+        DefaultExecutor exec = new DefaultExecutor();
+        exec.setStreamHandler(psh);
+        try {
+            exec.execute(cl);
+        } catch (IOException e) {
+            return e.getMessage();
+        }
+        return stdout.toString();
+    }
+}

+ 8 - 0
src/main/java/com/xingyue/atbird/cs/util/ResultUtils.java

@@ -0,0 +1,8 @@
+package com.xingyue.atbird.cs.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ResultUtils {
+    public static Map<String, String> RESULT_MAP = new HashMap<>();
+}

+ 3 - 0
src/main/resources/application.properties

@@ -0,0 +1,3 @@
+spring.datasource.url=jdbc:mysql://127.0.0.1:3307/atv21?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
+spring.datasource.username=root
+spring.datasource.password=123456

+ 13 - 0
src/test/java/com/xingyue/atbird/cs/ApplicationTests.java

@@ -0,0 +1,13 @@
+package com.xingyue.atbird.cs;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ApplicationTests {
+
+	@Test
+	void contextLoads() {
+	}
+
+}