Simplify startup with one parameter less
[aquarium] / scripts / test.sh
1 #!/usr/bin/env bash
2 #
3 # Test an Aquarium installation by issuing messages to various exchanges 
4 #  
5 # WARNING: DO NOT RUN ON PRODUCTION SYSTEMS. THIS WILL AFFECT DATABASE 
6 # CONSISTENCY
7
8 # Copyright 2012 GRNET S.A. All rights reserved.
9 #
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
12 # are met:
13 #
14 #   1. Redistributions of source code must retain the above copyright
15 #      notice, this list of conditions and the following disclaimer.
16 #
17 #  2. Redistributions in binary form must reproduce the above copyright
18 #     notice, this list of conditions and the following disclaimer in the
19 #     documentation and/or other materials provided with the distribution.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
32 #
33 # The views and conclusions contained in the software and documentation are
34 # those of the authors and should not be interpreted as representing official
35 # policies, either expressed or implied, of GRNET S.A.
36
37 # resolve links - $0 may be a softlink
38 PRG="$0"
39
40 while [ -h "$PRG" ]; do
41     ls=`ls -ld "$PRG"`
42     link=`expr "$ls" : '.*-> \(.*\)$'`
43     if expr "$link" : '/.*' > /dev/null; then
44         PRG="$link"
45     else
46         PRG=`dirname "$PRG"`/"$link"
47     fi
48 done
49
50 # Get standard environment variables
51 PRGDIR=`dirname "$PRG"`
52
53 # Only set supported environment variables if not already set
54 [ -z "$AQUARIUM_HOME" ] && AQUARIUM_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
55
56 CONF=$AQUARIUM_HOME/conf
57 CLASSPATH=$CONF:`find $LIB -type f|grep jar$|tr '\n' ':'|sed -e 's/\:$//'`
58
59 TESTMAIN=gr.grnet.aquarium.util.RandomEventGen
60 echo CLASSPATH=$CLASSPATH
61
62 java -cp $CONF:$CLASSPATH $TESTMAIN "$@"
63