What | nameofinstance.xml |
---|---|
Description | Workflow test runs can be configured to automate tests |
schema location | http://fews.wldelft.nl/schemas/version1.0/workflowTestRun.xsd |
Table of Contents |
---|
Warning |
---|
This component is only intended for test purposes, not for production use. |
...
Workflow test runs can be started in JUnit tests in order to build (nightly) regression tests. To do so, initialize the test environment and create a datastore to pass to the workflow constructor. Next code snipped demonstrates the use of WorkflowTestRun in JUnit:
No Format |
---|
....
// init test application
App.init(WorkflowTestRunTest.class);
FewsInstance.init(TestSupport.getInputFile());
TestSupport.setUp();
configDir = TestSupport.getInputFile("config");
relativeViewPeriod = new RelativePeriod(-100 * TimeUnit.DAY_MILLIS, TimeUnit.DAY_MILLIS);
connection = TestSupport.createTestDatabase("test");
// create datastore
dataStore = new TestDataStore(connection, configDir, coldStatesDir, cacheDir, time0);
// select the workflowtest configuration file
File configFile = TestSupport.getInputFile("testfiles/WFT_Test1.xml");
SystemActivityDescriptor descriptor = dataStore.getRuns().getSystemActivityDescriptors().add(SystemActivityType.OC);
// the WorkflowTestRun is created here
WorkflowTestRun testRun = new WorkflowTestRun(dataStore, descriptor);
// run it
testRun.run(configFile);
....
|
...
Workflow test runs can be started from the command line. To do so one must configure a Region as they would for a Stand Alone system. In .
Before 2014.02, configure in the bin directory configure the 'Region.exe' and 'Region.jpif' files. For the JPIF file some adaptation must be made. Here is an example:
No Format |
---|
..\jre
-mx256m
-cp
$JARS_PATH$
nl.wldelft.fews.system.workflowtestrun.WorkflowTestRun
Region_Name
..\path_to_your_config_test_file.xml
|
Since 2014.02 this is done via an ini file:
Code Block |
---|
#Delft-FEWS ini file
main.class=nl.wldelft.fews.system.workflowtestrun.WorkflowTestRun
classpath.1=*.jar
#Java Runtime jvm.dll location
vm.location=../jre/bin/client/jvm.dll
vmarg.1=-Xms512m
vmarg.2=-Xmx1024m
#location of the bin dir
working.directory=.
#region_home directory - <region_home> to be replaced with actual region home directory
arg.1=../<region_home>
arg.2=..\path_to_your_config_test_file.xml |
The procedure above works (in case of a 1.5 jre) only when double clicking on the exe or when executing it from the windows scheduler. It does not running when calling the exe from a batch file or when calling it directly from the command line. If you need this use a 1.6 jre version and create a batch file similar to the example below:
No Format |
---|
..\jre\bin\java.exe -mx512m -cp "*" nl.wldelft.fews.system.workflowtestrun.WorkflowTestRun MYREGION ..\path_to_test_file.xml
|
...
The normal startup script in linux systems is shown below:
No Format |
---|
#!/bin/sh
#
# Script to start Delft-FEWS
#
# One argument required: the name of the region directory
#
export JAVA_HOME=$(pwd)/jre/bin
if [ "$1" = "" ]; then
echo "Usage: $0 <region name>"
exit
fi
if [ ! -d "bin" -o ! -d "$1" ]; then
echo "Start the script in the directory holding the region directory"
exit
fi
#
# Assemble the list of jar files in the bin directory
#
cd bin
base=`pwd`
# Assemble the classes
#
classes=""
for f in $base/*.jar ;do
if [ "$classes" = "" ]; then
classes="$f"
else
classes="${classes}:$f"
fi
done
echo "Java runtime: ${JAVA_HOME:-/opt/java/bin}/java - should at least be 1.5"
echo "Starting application ..."
${JAVA_HOME:-/opt/java/bin}/java -Xmx256M -Djava.library.path=$base \
-classpath "$classes" \
nl.wldelft.fews.gui.explorer.Application $1
#
# Remote debugging: add the following lines to the above:
# -Xdebug \
# -Xrunjdwp:transport=dt_socket,address=8000,suspend=y,server=y \
exit
|