Skip to content

Commit

Permalink
Added testbed module
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Jul 19, 2015
1 parent 99df867 commit b5177f6
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 1 deletion.
116 changes: 116 additions & 0 deletions jpos-app.gradle
Original file line number Diff line number Diff line change
@@ -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())
}

8 changes: 8 additions & 0 deletions modules/testbed/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description = 'jPOS-EE :: Testbed'

dependencies {
compile project(':modules:core')
}

apply from: '../../jpos-app.gradle'

5 changes: 5 additions & 0 deletions modules/testbed/src/dist/bin/bsh
Original file line number Diff line number Diff line change
@@ -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 $*
19 changes: 19 additions & 0 deletions modules/testbed/src/dist/bin/q2
Original file line number Diff line number Diff line change
@@ -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@ "$@"

90 changes: 90 additions & 0 deletions modules/testbed/src/dist/bin/q2.bat
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions modules/testbed/src/dist/bin/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

cd `dirname $0`
echo Starting Q2
nohup ./q2 > /dev/null 2>&1 &
4 changes: 4 additions & 0 deletions modules/testbed/src/dist/bin/stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

echo Stopping Q2
echo '<shutdown/>' > `dirname $0`/../deploy/shutdown.xml
Empty file.
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ include ':modules:core',\
':modules:client-simulator',\
':modules:quartz', \
':modules:visitor', \
':modules:rspace'
':modules:rspace', \
':modules:testbed'

rootProject.name = 'jposee'

0 comments on commit b5177f6

Please # to comment.