#!/bin/sh

# This script runs the SAGA job test for the gridsam and javagat adaptors.
# The servers are listed below, and should be replaced by your own
# servers.

GRIDSAM_SERVER=https://titan.cs.vu.nl:18443/gridsam/services/gridsam
JAVAGAT_SERVER=any://fs0.das3.cs.vu.nl
PORT=12345

# start an ftp-server that has /tmp/saga-test-data as its root.
mkdir /tmp/saga-test-data
$HOME/OMIICLIENT/gridsam/bin/gridsam-ftp-server -d /tmp/saga-test-data -p $PORT > /dev/null 2>&1&
PID=$!

# remove /tmp/saga-test-data and kill ftp server on exit.
trap "kill -9 $PID > /dev/null 2>&1; rm -rf /tmp/saga-test-data" 0 1 2 3 15

HOST=`hostname -f`

export JAVA_SAGA_LOCATION=`cd .. && pwd`

$JAVA_SAGA_LOCATION/bin/run-saga-app -Xmx256M \
     test.job.JobAdaptorTest gridsam $GRIDSAM_SERVER ftp://$HOST:$PORT/

$JAVA_SAGA_LOCATION/bin/run-saga-app -Xmx256M \
     test.job.JobAdaptorTest javagat $JAVAGAT_SERVER file://$HOST/tmp/saga-test-data
