#!/bin/sh
#
# $Id: runtest,v 1.1 2005/07/21 04:15:46 ovidiu Exp $
#
# Script that runs a single unit test case and allows to easily attach a debugger to it.
#
# Usage: runtest [-debug]
#



TARGET_CLASS=org.jboss.cache.transaction.IsolationLevelReadCommittedTest

cygwin=false;
case "`uname`" in
    CYGWIN*)
        cygwin=true
        ;;
esac

if [ $cygwin = true ]; then
    SEP=";"
else
    SEP=":"
fi

while [ "$1" != "" ]; do
    if [ "$1" = "-debug" ]; then
        if [ $cygwin = false ]; then
            JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=12348"
        else
            JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=unittest"
        fi
    fi
    shift
done

reldir=`dirname $0`
java $JAVA_OPTS -cp \
$reldir${SEP}\
$reldir/../output/test-classes${SEP}\
$reldir/../output/classes${SEP}\
$reldir/../lib/junit.jar${SEP}\
$reldir/../lib/jboss-j2ee.jar${SEP}\
$reldir/../lib/jboss-common.jar${SEP}\
$reldir/../lib/jboss-system.jar${SEP}\
$reldir/../lib/jboss-jmx.jar${SEP}\
$reldir/../lib/jgroups.jar${SEP}\
$reldir/../lib/log4j.jar${SEP}\
$reldir/../lib/commons-logging.jar${SEP}\
$reldir/../lib/concurrent.jar${SEP}\
 junit.textui.TestRunner $TARGET_CLASS

