diff --git a/jpos-app.gradle b/jpos-app.gradle new file mode 100644 index 0000000000..a322a02476 --- /dev/null +++ b/jpos-app.gradle @@ -0,0 +1,116 @@ +def archiveJarName="${project.name}-${project.version}.jar" +def archiveWarName="${project.name}-${project.version}.war" +project.ext { + targetConfiguration = new Properties() + def target = project.hasProperty('target') ? target : 'devel' + targetConfiguration.put('jarname', archiveJarName.toString()) + targetConfiguration.put('warname', archiveWarName.toString()) + targetConfiguration.put('target', target.toString()) + targetConfiguration.put("buildTimestamp", new Date().format("yyyy-MM-dd HH:mm:ss z")); + File cfgFile = file("../../${target}.properties") + if (cfgFile.exists()) { + cfgFile.withInputStream{ + targetConfiguration.load(it); + } + } +} + +// We build a CopySpec for consistency +def jposCopySpec = copySpec { + from(file("src/dist")) { + exclude 'cfg/*.jks' + exclude '**/*.jpg' + exclude '**/*.gif' + exclude '**/*.png' + exclude '**/*.pdf' + filter( + org.apache.tools.ant.filters.ReplaceTokens, + tokens: targetConfiguration + ) + } + from(file("src/dist")) { + include 'cfg/*.jks' + include '**/*.jpg' + include '**/*.gif' + include '**/*.png' + include '**/*.pdf' + } + from(jar) { + rename archiveJarName, "${targetConfiguration.jarname}" + } + into("lib") { + from(configurations.runtime) { + exclude "vaadin*.jar" // vaadin compiler + exclude "servlet-api*.jar" // dependency hack + } + } + into("webapps") { + from(file("build/libs")) { + include '*.war' + } + } +} + +// Create the jar's manifest +jar.manifest { + attributes \ + 'Implementation-Title': project.name, + 'Implementation-Version': project.version, + 'Main-Class': 'org.jpos.q2.Q2', + 'Class-Path': configurations.runtime.collect { "lib/" + it.getName() }.join(' ') +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + include '**/*.properties' + include '**/*.xml' + include '**/*.cfg' + include '**/*.asc' + filter( + org.apache.tools.ant.filters.ReplaceTokens, + tokens: targetConfiguration + ) + } +} + +//-------------------------------------------------- +// TASKS +//-------------------------------------------------- + +task version (type: JavaExec, dependsOn: classes) { + description = "Shows jPOS Version" + main = 'org.jpos.q2.Q2' + args = ['--version'] + classpath configurations.runtime +} + +task dist(type: Tar) { + description 'Creates tar distribution' + into "$project.name-$version" + with jposCopySpec + compression = Compression.GZIP + extension "tar.gz" +} + +task installApp(type: Sync) { + description 'Installs jPOS based application' + into { file("${project.buildDir}/install/${project.name}") } + with jposCopySpec +} + +task wrapper( type: Wrapper ) { + description = "Generate gradlew[.bat]" + gradleVersion = '1.5' +} + +task installResources(dependsOn: 'classes', type: JavaExec) { + classpath = sourceSets.main.runtimeClasspath + main = 'org.jpos.q2.install.Install' + args = ["--outputDir=src/dist"] +} + +task viewTests (description: 'Open Test Reports') << { + Class.forName("java.awt.Desktop").newInstance().browse( + new File("${buildDir}/reports/tests", 'index.html').toURI()) +} + diff --git a/modules/testbed/build.gradle b/modules/testbed/build.gradle new file mode 100644 index 0000000000..a5df606382 --- /dev/null +++ b/modules/testbed/build.gradle @@ -0,0 +1,8 @@ +description = 'jPOS-EE :: Testbed' + +dependencies { + compile project(':modules:core') +} + +apply from: '../../jpos-app.gradle' + diff --git a/modules/testbed/src/dist/bin/bsh b/modules/testbed/src/dist/bin/bsh new file mode 100755 index 0000000000..c74e991f10 --- /dev/null +++ b/modules/testbed/src/dist/bin/bsh @@ -0,0 +1,5 @@ +#!/bin/sh +cd `dirname $0`/.. || exit 1 +CLASSPATH=classes:$CLASSPATH +CLASSPATH=`echo @jarname@ lib/*.jar | tr ' ' ':'`:$CLASSPATH +exec java -cp $CLASSPATH bsh.Interpreter $* diff --git a/modules/testbed/src/dist/bin/q2 b/modules/testbed/src/dist/bin/q2 new file mode 100755 index 0000000000..978107018d --- /dev/null +++ b/modules/testbed/src/dist/bin/q2 @@ -0,0 +1,19 @@ +#!/bin/sh + +cd `dirname $0`/.. || exit 1 +rm -f deploy/shutdown.xml +java -server \ + -Dappname=jCard \ + -Duser.name=admin \ + -Dcom.sun.management.jmxremote \ + -Duser.name=admin \ + -Xloggc:log/gc.log \ + -Dorg.mortbay.xml.XmlParser.NotValidating=true \ + -Xmx1G -Xms1G \ + -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses \ + -XX:+UseConcMarkSweepGC \ + -XX:+AggressiveOpts \ + -XX:+ParallelRefProcEnabled \ + -XX:+TieredCompilation \ + -jar jposee-@jarname@ "$@" + diff --git a/modules/testbed/src/dist/bin/q2.bat b/modules/testbed/src/dist/bin/q2.bat new file mode 100755 index 0000000000..65d5085ec4 --- /dev/null +++ b/modules/testbed/src/dist/bin/q2.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem run startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and RUN_OPTS to pass JVM options to this script. +@rem +set DEFAULT_JVM_OPTS=-server -Dappname=jCard -Duser.name=admin %DEFAULT_JVM_OPTS% + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME%.. + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +@rem Execute run +CD "%APP_HOME%" +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %RUN_OPTS% -jar jposee-@jarname@ %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable RUN_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%RUN_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/testbed/src/dist/bin/start b/modules/testbed/src/dist/bin/start new file mode 100755 index 0000000000..d5b08b2566 --- /dev/null +++ b/modules/testbed/src/dist/bin/start @@ -0,0 +1,5 @@ +#!/bin/sh + +cd `dirname $0` +echo Starting Q2 +nohup ./q2 > /dev/null 2>&1 & diff --git a/modules/testbed/src/dist/bin/stop b/modules/testbed/src/dist/bin/stop new file mode 100755 index 0000000000..6bb2b10151 --- /dev/null +++ b/modules/testbed/src/dist/bin/stop @@ -0,0 +1,4 @@ +#!/bin/sh + +echo Stopping Q2 +echo '' > `dirname $0`/../deploy/shutdown.xml diff --git a/modules/testbed/src/dist/log/q2.log b/modules/testbed/src/dist/log/q2.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/settings.gradle b/settings.gradle index fa26eb04e2..2272f73608 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,7 +21,8 @@ include ':modules:core',\ ':modules:client-simulator',\ ':modules:quartz', \ ':modules:visitor', \ - ':modules:rspace' + ':modules:rspace', \ + ':modules:testbed' rootProject.name = 'jposee'