summaryrefslogtreecommitdiffstats
path: root/systemtest/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'systemtest/scripts')
-rw-r--r--systemtest/scripts/rasql_1.pngbin0 -> 17042 bytes
-rw-r--r--systemtest/scripts/test_error-par.old2
-rw-r--r--systemtest/scripts/test_error-par.sh130
-rw-r--r--systemtest/scripts/test_error-par/Makefile77
-rw-r--r--systemtest/scripts/test_error-par/test_error-par.cc467
-rw-r--r--systemtest/scripts/test_error-seq.old13
-rw-r--r--systemtest/scripts/test_error-seq.sh99
-rw-r--r--systemtest/scripts/test_error-seq/Makefile70
-rw-r--r--systemtest/scripts/test_error-seq/test_error-seq.cc515
-rw-r--r--systemtest/scripts/test_ql-extend.sh131
-rw-r--r--systemtest/scripts/test_ql-png-options.sh251
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-color-trns_1.pngbin0 -> 169 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-color-trns_10.pngbin0 -> 169 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_1.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_2.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_3.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_4.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_5.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_6.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_7.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_8.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-gray-trns_9.pngbin0 -> 161 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-mono-trns_1.pngbin0 -> 149 bytes
-rw-r--r--systemtest/scripts/test_ql-png-options.test/png-mono-trns_2.pngbin0 -> 149 bytes
-rw-r--r--systemtest/scripts/test_user.sh157
-rw-r--r--systemtest/scripts/testoid.sh114
26 files changed, 2026 insertions, 0 deletions
diff --git a/systemtest/scripts/rasql_1.png b/systemtest/scripts/rasql_1.png
new file mode 100644
index 0000000..125be48
--- /dev/null
+++ b/systemtest/scripts/rasql_1.png
Binary files differ
diff --git a/systemtest/scripts/test_error-par.old b/systemtest/scripts/test_error-par.old
new file mode 100644
index 0000000..55c5ece
--- /dev/null
+++ b/systemtest/scripts/test_error-par.old
@@ -0,0 +1,2 @@
+test_error-par.sh: testing client/server communication for open/close db/ta, protocol is RNP
+test_error-par.sh: 10 probed, 2 reached, 8 failed.
diff --git a/systemtest/scripts/test_error-par.sh b/systemtest/scripts/test_error-par.sh
new file mode 100644
index 0000000..748d285
--- /dev/null
+++ b/systemtest/scripts/test_error-par.sh
@@ -0,0 +1,130 @@
+#!/bin/bash
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+# test_errors-par.sh - test multi-server availability
+#
+# SYNOPSIS:
+# test_errors-par.sh
+#
+# DESCRIPTION
+# Performs test queries to check that multiple servers are really available.
+# To this end, several "ping" programs are spawned each keeping a server busy.
+# If a pinger fails then there is no (more) server available.
+# This way, the script determines the number of servers available.
+#
+# RESPONDING TO INCIDENT
+# none
+#
+# PROCEDURE
+# see above.
+#
+# PRECONDITIONS
+# - rasdaman up and running, with database having user/password as defined below
+#
+# RETURN CODES
+ RC_OK=0 # everything went fine
+ RC_ERROR=1 # something went wrong
+#
+
+
+RCTEXT_OK="OK"
+RCTEXT_ERROR="NOT_OK"
+
+# --- CONSTANTS -----------------------------------------------------
+
+# number of servers to be probed
+NO_OF_SERVERS=10
+
+# name of script
+PROG=`basename $0`
+
+# name of test program
+TESTPROG=`basename $0 .sh`
+
+# log output
+LOGFILE=/tmp/`basename $PROG .sh`.log
+
+# old log file for regression comparison:
+OLDFILE=`basename $PROG .sh`.old
+
+# how to react on error
+function raiseError() { echo "$PROG: fatal error, aborting."; exit $RC_ERROR; }
+#function raiseError() { echo "$PROG: error in test; resuming."; RC=$RC_ERROR; }
+
+# string to determine that a server connection suceeded; see test prog src!
+SUCCESS_INDICATOR=SUCCESS
+
+# --- ACTION --------------------------------------------------------
+
+echo $PROG: testing client/server communication for open/close db/ta, protocol is $RMANPROTOCOL
+echo $PROG: testing client/server communication for open/close db/ta, protocol is $RMANPROTOCOL >$LOGFILE
+
+# initialize overall return code
+RC=$RC_OK
+
+# --- make test progs
+( cd $TESTPROG; make )
+
+# --- check no of available servers
+for (( i=$NO_OF_SERVERS; $i > 0; i=`expr $i - 1` ))
+do
+ # each tester runs infinitely, thereby definitely blocking its server
+ $TESTPROG/$TESTPROG --wait 100 --requests 1000000 --id $i 2>&1 >${LOGFILE}_$i &
+ # collect process ids so that wen can kill them again lateron
+ PIDS="$PIDS $!"
+done
+
+echo -n "$PROG: waiting for test progs to settle down"
+for i in 1 2 3 4 5
+do
+ sleep 1
+ echo -n "."
+done
+echo
+
+# cleanup processes; we're not interested whether they really are alive still
+kill -TERM $PIDS 2>/dev/null
+
+# evaluate log file
+SUCCEEDS=`grep $SUCCESS_INDICATOR ${LOGFILE}*| wc -l`
+echo $PROG: $NO_OF_SERVERS probed, $SUCCEEDS reached, `expr $NO_OF_SERVERS - $SUCCEEDS` failed.
+echo $PROG: $NO_OF_SERVERS probed, $SUCCEEDS reached, `expr $NO_OF_SERVERS - $SUCCEEDS` failed. >>$LOGFILE
+
+# --- compare files against old ones
+if [ `diff $OLDFILE $LOGFILE | wc -l` -ne 0 ]
+then
+ echo "$PROG: Error: regression discrepancy between files $OLDFILE $LOGFILE -- $RCTEXT_ERROR"
+ RC=$RC_ERROR
+fi
+
+# --- cleanup and summarise
+if [ $RC -eq $RC_OK ]
+then
+ rm -f ${LOGFILE}*
+ RCTEXT=$RCTEXT_OK
+else
+ RCTEXT=$RCTEXT_ERROR
+fi
+
+echo $PROG: done, result is $RCTEXT.
+exit $RC
+
diff --git a/systemtest/scripts/test_error-par/Makefile b/systemtest/scripts/test_error-par/Makefile
new file mode 100644
index 0000000..84e596e
--- /dev/null
+++ b/systemtest/scripts/test_error-par/Makefile
@@ -0,0 +1,77 @@
+# -*-Makefile-*-
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>. # Top Level makefile. This points to the various modules that have to be build
+# and/or deployed
+#
+# MAKEFILE FOR:
+# test_error-par
+#
+# COMMENTS:
+#
+##################################################################
+
+######################### Definitions ############################
+
+# use client specific flags
+CXXFLAGS := $(CLIENTCXXFLAGS)
+LDFLAGS := $(CLIENTLDFLAGS)
+
+# add communication flags
+CXXFLAGS += $(COMMCXXFLAGS)
+LDFLAGS += $(COMMLDFLAGS)
+
+LIBS = $(RASODMG) $(CLIENTCOMM) $(RASLIB) \
+ $(CONVERSION) $(LIBAKINSIDE) $(LIBAKNET)
+
+IMGLIBS = $(l_SYM)tiff $(l_SYM)jpeg $(l_SYM)png $(l_SYM)crypto $(l_SYM)z \
+ $(l_SYM)mfhdf $(l_SYM)df $(l_SYM)ppm $(l_SYM)pgm $(l_SYM)pbm
+
+LDFLAGS += $(L_SYM)$(SUPPORT_BASE)/lib
+
+SRCCXX= test_error-par.cc
+OBJS = ${SRCCXX:%.cc=%.o}
+
+ifeq ($(OSTYPE),$(OSTYPE_SOLARIS))
+ LDFLAGS+= -lsocket
+endif
+
+MISCCLEAN = test_error-par
+
+########################### Targets ##############################
+# main target
+.PHONY: all
+all: test_error-par
+
+test_error-par: test_error-par.o $(LIBS)
+ $(PURIFY) $(CXX) $(LDFLAGS) -o test_error-par $^ $(LIBS) $(IMGLIBS) -lm
+
+.PHONY: depend
+depend:
+ -rm Makefile.dep
+ $(MAKEDEPEND) -m -f- -- $(CXXFLAGS) -- $(SRCCXX) $(SRCCC) > Makefile.dep
+
+.PHONY: clean
+clean:
+ -rm $(OBJS) $(MISCCLEAN)
+
+######################## Dependencies ############################
+
diff --git a/systemtest/scripts/test_error-par/test_error-par.cc b/systemtest/scripts/test_error-par/test_error-par.cc
new file mode 100644
index 0000000..05eb7f0
--- /dev/null
+++ b/systemtest/scripts/test_error-par/test_error-par.cc
@@ -0,0 +1,467 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+
+/*************************************************************
+ *
+ *
+ * PURPOSE:
+ * Open a db connection to block a server. To additionally keep
+ * it busy, a request is sent periodically with a configurable
+ * wait time inbetween.
+ * Upon a SIGTERM signal, the program gracefully exits, closing
+ * transaction and database.
+ * Request is a dummy get type request, it doesn't matter what
+ * the response is.
+ * This program is used to test behavior on erroneous API calls
+ * on multiple servers (ie, parallel behavior - sequential behavior
+ * is tested in the twin program test_rasgeo-seq.cc).
+ *
+ * PARAMETERS:
+ * -w n wait n millisecs until next request
+ * -i n identifier for logging
+ * -r n run n requests, then terminate
+ * ...plus server, port, db, user, passwd
+ *
+ *
+ * PRECONDITIONS:
+ * - have a rasdaman server running
+ * - have at least one 1 rasserver up
+ *
+ * COMMENTS:
+ * - server type controlled via RMANPROTOCOL
+ *
+ * BUGS:
+ *
+ ************************************************************/
+
+using namespace std;
+
+static const char test_error_par_rcsid[] = "@(#)test_test_error-par,test_error-par.cc: $Id: test_error-par.cc,v 1.2 2005/09/11 08:42:33 rasdev Exp $";
+
+// error indicator - should eventually go into a central systemtest include
+static const char MSG_OK[] = "ok";
+static const char MSG_FAILED[] = "error";
+
+/*
+COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
+and -DCOMPDATE="\"$(COMPDATE)\"" when compiling
+*/
+#ifndef RMANVERSION
+#error "Please specify RMANVERSION variable!"
+#endif
+
+#ifndef COMPDATE
+#error "Please specify the COMPDATE variable!"
+#endif
+
+
+#ifdef EARLY_TEMPLATE
+#define __EXECUTABLE__
+#include "raslib/template_inst.hh"
+#endif
+
+#ifdef __VISUALC__
+#include <strstrea.h>
+#else
+#include <strstream>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sstream>
+#include <fstream>
+
+#include <signal.h> // for signal()
+
+#ifdef __VISUALC__
+ #define __EXECUTABLE__
+#endif
+
+#include "rasodmg/transaction.hh"
+#include "rasodmg/database.hh"
+
+#include "rasodmg/ref.hh"
+#include "raslib/marraytype.hh"
+#include "rasodmg/set.hh"
+#include "rasodmg/marray.hh"
+#include "rasodmg/iterator.hh"
+#include "rasodmg/oqlquery.hh"
+
+#include "raslib/type.hh"
+
+#include "raslib/minterval.hh"
+
+#include "raslib/primitive.hh"
+#include "raslib/complex.hh"
+#include "raslib/structure.hh"
+
+#include "raslib/structuretype.hh"
+#include "raslib/primitivetype.hh"
+
+#include "cmlparser.hh"
+
+#ifdef __VISUALC__
+ #undef __EXECUTABLE__
+#endif
+
+// debug facility; relies on -DDEBUG at compile time
+// tell debug that here is the place for the variables (to be done in the main() src file)
+#define DEBUG_MAIN
+#include "debug-clt.hh"
+
+const int MAX_STR_LEN = 255;
+const int MAX_QUERY_LEN = 10240;
+
+/// log strings (keep consistent with shell script!)
+/// - log string indicating that the server cannot be reached
+const char *ERROR_INDICATOR = "ERROR";
+/// - log string indicating that the server cannot be reached
+const char *TOUCH_SUCCESS = "SUCCESS";
+
+/// program exit codes
+#define EXIT_SUCCESS 0
+#define EXIT_USAGE 2
+#define EXIT_FAILURE -1
+
+// parameter names, defaults, and help texts
+
+#define PARAM_HELP_FLAG 'h'
+#define PARAM_HELP "help"
+#define HELP_HELP "show command line switches"
+
+#define PARAM_WAIT_FLAG 'w'
+#define PARAM_WAIT "wait"
+#define HELP_WAIT "<n> wait time between requests [msecs]"
+#define DEFAULT_WAIT 1000
+#define DEFAULT_WAIT_STR "1000"
+
+#define PARAM_ID_FLAG 'i'
+#define PARAM_ID "id"
+#define HELP_ID "<n> id [integer]"
+#define DEFAULT_ID 1
+#define DEFAULT_ID_STR "1"
+
+#define PARAM_REQU_FLAG 'r'
+#define PARAM_REQU "requests"
+#define HELP_REQU "<n> number of requests [integer]"
+#define DEFAULT_REQU 1
+#define DEFAULT_REQU_STR "1"
+
+#define PARAM_SERV_FLAG 's'
+#define PARAM_SERV "server"
+#define HELP_SERV "<host-name> rasdaman server"
+#define DEFAULT_SERV "localhost"
+
+#define PARAM_PORT_FLAG 'p'
+#define PARAM_PORT "port"
+#define HELP_PORT "<p> rasmgr port number"
+#define DEFAULT_PORT 7001
+#define DEFAULT_PORT_STR "7001"
+
+#define PARAM_DB_FLAG 'd'
+#define PARAM_DB "database"
+#define HELP_DB "<db-name> name of database"
+#define DEFAULT_DB "RASBASE"
+
+#define PARAM_USER "user"
+#define HELP_USER "<user-name> name of user"
+#define DEFAULT_USER "rasguest"
+
+#define PARAM_PASSWD "passwd"
+#define HELP_PASSWD "<user-passwd> password of user"
+#define DEFAULT_PASSWD "rasguest"
+
+#define PARAM_DEBUG "debug"
+#define HELP_DEBUG "generate diagnostic output"
+
+// name to be tested in touch()
+const char* MDD_TYPE_NAME = "RGBImage";
+
+// global variables and default settings
+// -------------------------------------
+
+bool keepOn = true; // while true: keep in loop; reset by interrupt
+
+r_Database db;
+r_Transaction ta;
+
+bool dbIsOpen = false;
+bool taIsOpen = false;
+
+unsigned int id = DEFAULT_ID;
+unsigned long waitTime = DEFAULT_WAIT;
+unsigned int requests = DEFAULT_REQU;
+
+const char *serverName = DEFAULT_SERV;
+r_ULong serverPort = DEFAULT_PORT;
+const char *baseName = DEFAULT_DB;
+
+const char *user = DEFAULT_USER;
+const char *passwd = DEFAULT_PASSWD;
+
+const char *fileName = NULL;
+const char *queryString=NULL;
+
+// query result set.
+// we define it here because on empty results the set seems to be corrupt which kills the default destructor
+r_Set< r_Ref_Any > result_set;
+
+// end of globals
+
+void
+parseParams(int argc, char** argv) throw (r_Error)
+{
+ CommandLineParser &cmlInter = CommandLineParser::getInstance();
+
+ CommandLineParameter &clp_help = cmlInter.addFlagParameter( PARAM_HELP_FLAG, PARAM_HELP, HELP_HELP );
+
+ CommandLineParameter &clp_wait = cmlInter.addStringParameter( PARAM_WAIT_FLAG, PARAM_WAIT, HELP_WAIT, DEFAULT_WAIT_STR );
+
+ CommandLineParameter &clp_id = cmlInter.addStringParameter( PARAM_ID_FLAG, PARAM_ID, HELP_ID, DEFAULT_ID_STR );
+
+ CommandLineParameter &clp_requ = cmlInter.addStringParameter( PARAM_REQU_FLAG, PARAM_REQU, HELP_REQU, DEFAULT_REQU_STR );
+
+ CommandLineParameter &clp_server = cmlInter.addStringParameter( PARAM_SERV_FLAG, PARAM_SERV, HELP_SERV, DEFAULT_SERV );
+ CommandLineParameter &clp_port = cmlInter.addStringParameter( PARAM_PORT_FLAG, PARAM_PORT, HELP_PORT, DEFAULT_PORT_STR);
+ CommandLineParameter &clp_database = cmlInter.addStringParameter( PARAM_DB_FLAG, PARAM_DB, HELP_DB, DEFAULT_DB );
+ CommandLineParameter &clp_user = cmlInter.addStringParameter(CommandLineParser::noShortName, PARAM_USER, HELP_USER, DEFAULT_USER );
+ CommandLineParameter &clp_passwd = cmlInter.addStringParameter(CommandLineParser::noShortName, PARAM_PASSWD, HELP_PASSWD, DEFAULT_PASSWD );
+
+#ifdef DEBUG
+ CommandLineParameter &clp_debug = cmlInter.addFlagParameter( CommandLineParser::noShortName, PARAM_DEBUG, HELP_DEBUG );
+#endif
+
+ try
+ {
+ cmlInter.processCommandLine(argc, argv);
+
+ if (cmlInter.isPresent( PARAM_HELP_FLAG ))
+ {
+ cout << "usage: " << argv[0] << " [options]" << endl;
+ cout << "options:" << endl;
+ cmlInter.printHelp();
+ exit( EXIT_USAGE );
+ }
+
+ // check mandatory parameters ====================================================
+
+ // evaluate optional parameter server --------------------------------------
+ if (cmlInter.isPresent( PARAM_WAIT ))
+ waitTime = cmlInter.getValueAsLong( PARAM_WAIT );
+
+ // check optional parameters ====================================================
+
+ // evaluate optional parameter id --------------------------------------
+ if (cmlInter.isPresent( PARAM_ID ))
+ id = cmlInter.getValueAsLong( PARAM_ID );
+
+ // evaluate optional parameter requests --------------------------------------
+ if (cmlInter.isPresent( PARAM_REQU ))
+ requests = cmlInter.getValueAsLong( PARAM_REQU );
+
+ // evaluate optional parameter server --------------------------------------
+ if (cmlInter.isPresent( PARAM_SERV ))
+ serverName = cmlInter.getValueAsString( PARAM_SERV );
+
+ // evaluate optional parameter port --------------------------------------
+ if (cmlInter.isPresent( PARAM_PORT ))
+ serverPort = cmlInter.getValueAsLong( PARAM_PORT );
+
+ // evaluate optional parameter database --------------------------------------
+ if (cmlInter.isPresent( PARAM_DB ))
+ baseName = cmlInter.getValueAsString( PARAM_DB );
+
+ // evaluate optional parameter user --------------------------------------
+ if (cmlInter.isPresent( PARAM_USER ))
+ user = cmlInter.getValueAsString( PARAM_USER );
+
+ // evaluate optional parameter passwd --------------------------------------
+ if (cmlInter.isPresent( PARAM_PASSWD ))
+ passwd = cmlInter.getValueAsString( PARAM_PASSWD );
+
+#ifdef DEBUG
+ // evaluate optional parameter MDD type name --------------------------------------
+ SET_OUTPUT( cmlInter.isPresent( PARAM_DEBUG ) );
+#endif
+
+ }
+ catch(CmlException& err)
+ {
+ cout << argv[0] << ": " << err.what() << endl;
+ throw;
+ }
+} // parseParams()
+
+
+void catchInterrupt( int n )
+{
+ keepOn = false;
+}
+
+void
+openDatabase() throw (r_Error)
+{
+ ENTER( "openDatabase -- db is " << (dbIsOpen?"":"not ") << "open." );
+
+ db.set_servername(serverName, serverPort);
+ db.set_useridentification(user, passwd);
+ TALK( "database was closed, opening database=" << baseName << ", server=" << serverName << ", port=" << serverPort << ", user=" << user << ", passwd=" << passwd << "." );
+ db.open(baseName);
+ dbIsOpen = true;
+
+ LEAVE( "openDatabase" );
+} // openDatabase()
+
+void
+closeDatabase() throw (r_Error)
+{
+ ENTER( "closeDatabase -- db is " << (dbIsOpen?"":"not ") << "open." );
+
+ db.close();
+ dbIsOpen = false;
+
+ LEAVE( "closeDatabase" );
+ return;
+} // closeDatabase()
+
+void
+openTransaction(bool readwrite) throw (r_Error)
+{
+ ENTER( "openTransaction, readwrite=" << (readwrite?"rw":"ro") << ", ta is " << (taIsOpen?"":"not ") << "open." );
+
+ if (readwrite)
+ ta.begin(r_Transaction::read_write);
+ else
+ ta.begin(r_Transaction::read_only);
+ taIsOpen = true;
+
+ LEAVE( "openTransaction" );
+} // openTransaction()
+
+void
+closeTransaction() throw (r_Error)
+{
+ ENTER( "closeTransaction: aborting ta; ta is " << (taIsOpen?"":"not ") << "open." );
+
+ ta.abort();
+ taIsOpen = false;
+
+ LEAVE( "closeTransaction" );
+ return;
+} // closeTransaction()
+
+int
+touch() throw (r_Error)
+{
+ int returnValue = EXIT_SUCCESS;
+
+ ENTER( "touch -- fetching type information for " << MDD_TYPE_NAME << "." );
+
+ char* typeStructure = NULL;
+
+ // get type structure from database just to touch it
+ ClientComm *cc = db.getComm();
+ if (cc == NULL)
+ {
+ cout << "got NULL communication object from db...";
+ returnValue = EXIT_FAILURE;
+ }
+ else
+ {
+ typeStructure = cc->getTypeStructure( MDD_TYPE_NAME, ClientComm::r_MDDType_Type );
+ TALK( "type structure is " << typeStructure );
+ }
+
+ LEAVE( "touch -> " << returnValue );
+ return( returnValue );
+}
+
+void wait( unsigned long w )
+{
+ timeval tv;
+ tv.tv_sec = w / 1000;
+ tv.tv_usec = w * 1000;
+
+ select(0,NULL,NULL,NULL,&tv); // wait <tv> time
+}
+
+
+/*
+ * main prog: evaluate cmd line, access db.
+ * returns:
+ * EXIT_SUCCESS all went fine
+ * EXIT_HELP help was requested
+ * EXIT_FAILURE something went wrong
+ */
+int main(int argc, char** argv)
+{
+ SET_OUTPUT( true );
+
+ int retval = EXIT_SUCCESS; // overall result status
+
+ signal( SIGTERM, catchInterrupt );
+
+ try
+ {
+ parseParams( argc, argv );
+
+ cout << argv[0] << " id=" << id << ", " << requests << " requests...";
+ openDatabase();
+ openTransaction( false );
+
+ while (keepOn && requests > 0 && retval == EXIT_SUCCESS)
+ {
+ cout << id << ":" << flush;
+ retval = touch();
+ cout << TOUCH_SUCCESS << " " << flush;
+ wait( waitTime );
+ requests--;
+ }
+
+ closeTransaction();
+ closeDatabase();
+ }
+ catch (const r_Error& e)
+ {
+ cout << argv[0] << ": " << ERROR_INDICATOR << ": " << e.get_errorno() << ": " << e.what() << endl;
+ retval = EXIT_FAILURE;
+ }
+ catch (...)
+ {
+ cerr << argv[0] << ERROR_INDICATOR << ": panic: unexpected internal exception." << endl;
+ retval = EXIT_FAILURE;
+ }
+
+ if (retval != EXIT_SUCCESS && (dbIsOpen || taIsOpen) )
+ {
+ closeTransaction(); // abort transaction and close database, ignore any further exceptions
+ closeDatabase();
+ }
+
+ cout << " id=" << id << " done." << endl;
+
+ return retval;
+} // main()
+
+// end of test_error-par.cc
+
diff --git a/systemtest/scripts/test_error-seq.old b/systemtest/scripts/test_error-seq.old
new file mode 100644
index 0000000..c258bbc
--- /dev/null
+++ b/systemtest/scripts/test_error-seq.old
@@ -0,0 +1,13 @@
+test_error-seq.sh: testing client/server communication for open/close db/ta, Fri Sep 2 22:02:32 CEST 2005
+test_error-seq/test_error-seq v1.0, rasdaman v5 -- generated on 02.09.2005 21:49:12.
+- good cycle...ok
+- bad cycle: do not close db, reopen...ok: 0: Exception: Database Open
+- bad cycle: do not close ta, reopen...ok: 0: Exception: Transaction Open
+- bad cycle: do not open ta, touch...ok: 0: Exception: Transaction Not Open
+- bad cycle: double open ta, touch...ok: 0: Exception: Transaction Open
+- bad cycle: double open db, touch...ok: 0: Exception: Database Open
+- bad cycle: double open ta, touch...ok: 0: Exception: Transaction Open
+- bad cycle: double abort ta (handled gracefully)...ok: 0: Exception: Transaction Not Open
+- bad cycle: double close db (handled gracefully)...ok
+- bad cycle: touch without any db/ta open...got NULL communication object from db...ok
+test_error-seq/test_error-seq done.
diff --git a/systemtest/scripts/test_error-seq.sh b/systemtest/scripts/test_error-seq.sh
new file mode 100644
index 0000000..9d0813e
--- /dev/null
+++ b/systemtest/scripts/test_error-seq.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+# test_errors-seq.sh - test single-client errors due to bad client behavior
+#
+# SYNOPSIS:
+# test_errors-seq.sh
+#
+# DESCRIPTION
+# Performs test queries to check proper handling of error conditions.
+# - Errors on query level are handled by rasql.
+# - Errors on protocol level are triggered via a test program.
+# Ater provoking an error, it is tested whether the server remains
+# available fur same/other clients (whatever is appropriate).
+#
+# RESPONDING TO INCIDENT
+# none
+#
+# PROCEDURE
+# perform invocations, checks response and subsequent server availbility.
+#
+# PRECONDITIONS
+# - rasql utility available
+# - rasdaman up and running, with database having user/password as defined below
+#
+# RETURN CODES
+ RC_OK=0 # everything went fine
+ RC_ERROR=1 # something went wrong
+#
+RCTEXT_OK="OK"
+RCTEXT_ERROR="NOT_OK"
+
+# --- CONSTANTS -----------------------------------------------------
+
+# name of script
+PROG=`basename $0`
+
+# name of test program
+TESTPROG=`basename $0 .sh`
+
+# log output
+LOGFILE=/tmp/`basename $PROG .sh`.log
+
+# old log file for regression comparison:
+OLDFILE=`basename $PROG .sh`.old
+
+# how to react on error
+function raiseError() { echo "$PROG: fatal error, aborting."; exit $RC_ERROR; }
+#function raiseError() { echo "$PROG: error in test; resuming."; RC=$RC_ERROR; }
+
+# --- ACTION --------------------------------------------------------
+
+echo $PROG: testing client/server communication for open/close db/ta
+echo $PROG: testing client/server communication for open/close db/ta, `date` >$LOGFILE
+
+# initialize overall return code
+RC=$RC_OK
+
+# --- test
+(cd $TESTPROG; make )
+$TESTPROG/$TESTPROG 2>&1 >>$LOGFILE || raiseError
+
+# --- compare files against old ones
+if [ `cmp -s $OLDFILE $LOGFILE` ]
+then
+ echo "Error: regression discrepancy between files $OLDDIR/$i and $LOGDIR/$i -- $RCTEXT_ERROR"
+fi
+
+# --- cleanup and summarise
+if [ $RC -eq $RC_OK ]
+then
+ rm -f $LOGFILE
+ RCTEXT=$RCTEXT_OK
+else
+ RCTEXT=$RCTEXT_ERROR
+fi
+
+echo $PROG: done, result is $RCTEXT.
+exit $RC
+
diff --git a/systemtest/scripts/test_error-seq/Makefile b/systemtest/scripts/test_error-seq/Makefile
new file mode 100644
index 0000000..09826d6
--- /dev/null
+++ b/systemtest/scripts/test_error-seq/Makefile
@@ -0,0 +1,70 @@
+# -*-Makefile-*-
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>. # Top Level makefile. This points to the various modules that have to be build
+# and/or deployed
+#
+# MAKEFILE FOR:
+# test_error-seq
+#
+# COMMENTS:
+#
+##################################################################
+
+######################### Definitions ############################
+
+# use client specific flags
+CXXFLAGS := $(CLIENTCXXFLAGS)
+LDFLAGS := $(CLIENTLDFLAGS)
+
+# add communication flags
+CXXFLAGS += $(COMMCXXFLAGS)
+LDFLAGS += $(COMMLDFLAGS)
+
+LIBS = $(RASODMG) $(CLIENTCOMM) $(RASLIB) \
+ $(CONVERSION) $(LIBAKINSIDE) $(LIBAKNET)
+
+IMGLIBS = $(l_SYM)tiff $(l_SYM)jpeg $(l_SYM)png $(l_SYM)crypto $(l_SYM)z \
+ $(l_SYM)mfhdf $(l_SYM)df $(l_SYM)ppm $(l_SYM)pgm $(l_SYM)pbm
+
+LDFLAGS += $(L_SYM)$(SUPPORT_BASE)/lib
+
+SRCCXX= test_error-seq.cc
+OBJS = ${SRCCXX:%.cc=%.o}
+
+ifeq ($(OSTYPE),$(OSTYPE_SOLARIS))
+ LDFLAGS+= -lsocket
+endif
+
+MISCCLEAN = test_error-seq
+
+########################### Targets ##############################
+# main target
+.PHONY: all
+all: test_error-seq
+
+test_error-seq: test_error-seq.o $(LIBS)
+ $(PURIFY) $(CXX) $(LDFLAGS) -o test_error-seq $^ $(LIBS) $(IMGLIBS) -lm
+
+.PHONY: clean
+clean:
+ -rm $(OBJS) $(MISCCLEAN)
+
diff --git a/systemtest/scripts/test_error-seq/test_error-seq.cc b/systemtest/scripts/test_error-seq/test_error-seq.cc
new file mode 100644
index 0000000..79d889f
--- /dev/null
+++ b/systemtest/scripts/test_error-seq/test_error-seq.cc
@@ -0,0 +1,515 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+
+/*************************************************************
+ *
+ *
+ * PURPOSE:
+ * test behavior on erroneous API calls on a single server
+ * (ie, sequential behavior - parallel behavior is tested in
+ * the twin program test_rasgeo-par.cc).
+ *
+ *
+ * PRECONDITIONS:
+ * - have a rasdaman server running, with std types inserted
+ * - use exactly 1 rasserver
+ *
+ * COMMENTS:
+ *
+ * BUGS:
+ *
+ ************************************************************/
+
+static const char test_error_seq_rcsid[] = "@(#)test_test_error-seq,test_error-seq.cc: $Id: test_error-seq.cc,v 1.1 2003/12/27 19:30:23 rasdev Exp $";
+
+// error indicator - should eventually go into a central systemtest include
+static const char MSG_OK[] = "ok";
+static const char MSG_FAILED[] = "error";
+
+/*
+COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
+and -DCOMPDATE="\"$(COMPDATE)\"" when compiling
+*/
+#ifndef RMANVERSION
+#error "Please specify RMANVERSION variable!"
+#endif
+
+#ifndef COMPDATE
+#error "Please specify the COMPDATE variable!"
+#endif
+
+
+#ifdef EARLY_TEMPLATE
+#define __EXECUTABLE__
+#include "raslib/template_inst.hh"
+#endif
+
+#ifdef __VISUALC__
+#include <strstrea.h>
+#else
+#include <strstream>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sstream>
+#include <fstream>
+
+using namespace std;
+
+#ifdef __VISUALC__
+ #define __EXECUTABLE__
+#endif
+
+#include "rasodmg/transaction.hh"
+#include "rasodmg/database.hh"
+
+#include "rasodmg/ref.hh"
+#include "raslib/marraytype.hh"
+#include "rasodmg/set.hh"
+#include "rasodmg/marray.hh"
+#include "rasodmg/iterator.hh"
+#include "rasodmg/oqlquery.hh"
+
+#include "raslib/type.hh"
+
+#include "raslib/minterval.hh"
+
+#include "raslib/primitive.hh"
+#include "raslib/complex.hh"
+#include "raslib/structure.hh"
+
+#include "raslib/structuretype.hh"
+#include "raslib/primitivetype.hh"
+
+#include "cmlparser.hh"
+
+#ifdef __VISUALC__
+ #undef __EXECUTABLE__
+#endif
+
+// debug facility; relies on -DDEBUG at compile time
+// tell debug that here is the place for the variables (to be done in the main() src file)
+#define DEBUG_MAIN
+#include "debug-clt.hh"
+
+const int MAX_STR_LEN = 255;
+const int MAX_QUERY_LEN = 10240;
+
+
+/// program exit codes
+#define EXIT_SUCCESS 0
+#define EXIT_USAGE 2
+#define EXIT_FAILURE -1
+
+// parameter names, defaults, and help texts
+
+#define PARAM_HELP_FLAG 'h'
+#define PARAM_HELP "help"
+#define HELP_HELP "show command line switches"
+
+#define PARAM_SERV_FLAG 's'
+#define PARAM_SERV "server"
+#define HELP_SERV "<host-name> rasdaman server"
+#define DEFAULT_SERV "localhost"
+
+#define PARAM_PORT_FLAG 'p'
+#define PARAM_PORT "port"
+#define HELP_PORT "<p> rasmgr port number"
+#define DEFAULT_PORT 7001
+#define DEFAULT_PORT_STR "7001"
+
+#define PARAM_DB_FLAG 'd'
+#define PARAM_DB "database"
+#define HELP_DB "<db-name> name of database"
+#define DEFAULT_DB "RASBASE"
+
+#define PARAM_USER "user"
+#define HELP_USER "<user-name> name of user"
+#define DEFAULT_USER "rasguest"
+
+#define PARAM_PASSWD "passwd"
+#define HELP_PASSWD "<user-passwd> password of user"
+#define DEFAULT_PASSWD "rasguest"
+
+#define PARAM_DEBUG "debug"
+#define HELP_DEBUG "generate diagnostic output"
+
+// name to be tested in touch()
+const char* MDD_TYPE_NAME = "RGBImage";
+
+// global variables and default settings
+// -------------------------------------
+
+r_Database db;
+r_Transaction ta;
+
+bool dbIsOpen = false;
+bool taIsOpen = false;
+
+const char *serverName = DEFAULT_SERV;
+r_ULong serverPort = DEFAULT_PORT;
+const char *baseName = DEFAULT_DB;
+
+const char *user = DEFAULT_USER;
+const char *passwd = DEFAULT_PASSWD;
+
+const char *fileName = NULL;
+const char *queryString=NULL;
+
+// query result set.
+// we define it here because on empty results the set seems to be corrupt which kills the default destructor
+r_Set< r_Ref_Any > result_set;
+
+// end of globals
+
+void
+parseParams(int argc, char** argv) throw (r_Error)
+{
+ CommandLineParser &cmlInter = CommandLineParser::getInstance();
+
+ CommandLineParameter &clp_help = cmlInter.addFlagParameter( PARAM_HELP_FLAG, PARAM_HELP, HELP_HELP );
+
+ CommandLineParameter &clp_server = cmlInter.addStringParameter( PARAM_SERV_FLAG, PARAM_SERV, HELP_SERV, DEFAULT_SERV );
+ CommandLineParameter &clp_port = cmlInter.addStringParameter( PARAM_PORT_FLAG, PARAM_PORT, HELP_PORT, DEFAULT_PORT_STR);
+ CommandLineParameter &clp_database = cmlInter.addStringParameter( PARAM_DB_FLAG, PARAM_DB, HELP_DB, DEFAULT_DB );
+ CommandLineParameter &clp_user = cmlInter.addStringParameter(CommandLineParser::noShortName, PARAM_USER, HELP_USER, DEFAULT_USER );
+ CommandLineParameter &clp_passwd = cmlInter.addStringParameter(CommandLineParser::noShortName, PARAM_PASSWD, HELP_PASSWD, DEFAULT_PASSWD );
+
+#ifdef DEBUG
+ CommandLineParameter &clp_debug = cmlInter.addFlagParameter( CommandLineParser::noShortName, PARAM_DEBUG, HELP_DEBUG );
+#endif
+
+ try
+ {
+ cmlInter.processCommandLine(argc, argv);
+
+ if (cmlInter.isPresent( PARAM_HELP_FLAG ))
+ {
+ cout << "usage: " << argv[0] << " [options]" << endl;
+ cout << "options:" << endl;
+ cmlInter.printHelp();
+ exit( EXIT_USAGE );
+ }
+
+ // check optional parameters ====================================================
+
+ // evaluate optional parameter server --------------------------------------
+ if (cmlInter.isPresent( PARAM_SERV ))
+ serverName = cmlInter.getValueAsString( PARAM_SERV );
+
+ // evaluate optional parameter port --------------------------------------
+ if (cmlInter.isPresent( PARAM_PORT ))
+ serverPort = cmlInter.getValueAsLong( PARAM_PORT );
+
+ // evaluate optional parameter database --------------------------------------
+ if (cmlInter.isPresent( PARAM_DB ))
+ baseName = cmlInter.getValueAsString( PARAM_DB );
+
+ // evaluate optional parameter user --------------------------------------
+ if (cmlInter.isPresent( PARAM_USER ))
+ user = cmlInter.getValueAsString( PARAM_USER );
+
+ // evaluate optional parameter passwd --------------------------------------
+ if (cmlInter.isPresent( PARAM_PASSWD ))
+ passwd = cmlInter.getValueAsString( PARAM_PASSWD );
+
+#ifdef DEBUG
+ // evaluate optional parameter MDD type name --------------------------------------
+ SET_OUTPUT( cmlInter.isPresent( PARAM_DEBUG ) );
+#endif
+
+ }
+ catch(CmlException& err)
+ {
+ cout << argv[0] << ": " << err.what() << endl;
+ throw;
+ }
+} // parseParams()
+
+
+void
+openDatabase() throw (r_Error)
+{
+ ENTER( "openDatabase -- db is " << (dbIsOpen?"":"not ") << "open." );
+
+ db.set_servername(serverName, serverPort);
+ db.set_useridentification(user, passwd);
+ TALK( "database was closed, opening database=" << baseName << ", server=" << serverName << ", port=" << serverPort << ", user=" << user << ", passwd=" << passwd << "." );
+ db.open(baseName);
+ dbIsOpen = true;
+
+ LEAVE( "openDatabase" );
+} // openDatabase()
+
+void
+closeDatabase() throw (r_Error)
+{
+ ENTER( "closeDatabase -- db is " << (dbIsOpen?"":"not ") << "open." );
+
+ db.close();
+ dbIsOpen = false;
+
+ LEAVE( "closeDatabase" );
+ return;
+} // closeDatabase()
+
+void
+openTransaction(bool readwrite) throw (r_Error)
+{
+ ENTER( "openTransaction, readwrite=" << (readwrite?"rw":"ro") << ", ta is " << (taIsOpen?"":"not ") << "open." );
+
+ if (readwrite)
+ ta.begin(r_Transaction::read_write);
+ else
+ ta.begin(r_Transaction::read_only);
+ taIsOpen = true;
+
+ LEAVE( "openTransaction" );
+} // openTransaction()
+
+void
+closeTransaction() throw (r_Error)
+{
+ ENTER( "closeTransaction: aborting ta; ta is " << (taIsOpen?"":"not ") << "open." );
+
+ ta.abort();
+ taIsOpen = false;
+
+ LEAVE( "closeTransaction" );
+ return;
+} // closeTransaction()
+
+void
+touch() throw (r_Error)
+{
+ ENTER( "touch -- fetching type information for " << MDD_TYPE_NAME << "." );
+
+ char* typeStructure = NULL;
+
+ // get type structure from database just to touch it
+ ClientComm *cc = db.getComm();
+ if (cc == NULL)
+ cout << "got NULL communication object from db...";
+ else
+ {
+ typeStructure = cc->getTypeStructure( MDD_TYPE_NAME, ClientComm::r_MDDType_Type );
+ TALK( "type structure is " << typeStructure );
+ }
+
+ LEAVE( "touch" );
+}
+
+void
+doStuff() throw (r_Error)
+{
+ ENTER( "doStuff" );
+
+ cout << "- good cycle..." << flush;
+ openDatabase();
+ openTransaction( false );
+ touch();
+ closeTransaction();
+ closeDatabase();
+ cout << MSG_OK << endl;
+
+ cout << "- bad cycle: do not close db, reopen..." << flush;
+ openDatabase();
+ openTransaction( false );
+ touch();
+ closeTransaction();
+ try
+ {
+ openDatabase();
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ closeDatabase();
+
+ cout << "- bad cycle: do not close ta, reopen..." << flush;
+ openDatabase();
+ openTransaction( false );
+ touch();
+ try
+ {
+ openTransaction( false );
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ closeDatabase();
+
+ cout << "- bad cycle: do not open ta, touch..." << flush;
+ openDatabase();
+ try
+ {
+ touch();
+ closeTransaction();
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ closeDatabase();
+
+ cout << "- bad cycle: double open ta, touch..." << flush;
+ openDatabase();
+ openTransaction( false );
+ try
+ {
+ openTransaction( false );
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ touch();
+ closeDatabase();
+
+ cout << "- bad cycle: double open db, touch..." << flush;
+ openDatabase();
+ try
+ {
+ openDatabase();
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ openTransaction( false );
+ touch();
+ closeDatabase();
+
+ cout << "- bad cycle: double open ta, touch..." << flush;
+ openDatabase();
+ openTransaction( false );
+ try
+ {
+ openTransaction( false );
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ touch();
+ closeTransaction();
+ closeDatabase();
+
+ cout << "- bad cycle: double abort ta (handled gracefully)..." << flush;
+ openDatabase();
+ openTransaction( false );
+ touch();
+ closeTransaction();
+ try
+ {
+ closeTransaction();
+ cout << MSG_FAILED << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_OK << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+ closeDatabase();
+
+ cout << "- bad cycle: double close db (handled gracefully)..." << flush;
+ openDatabase();
+ openTransaction( false );
+ touch();
+ closeTransaction();
+ closeDatabase();
+ try
+ {
+ closeDatabase();
+ cout << MSG_OK << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_FAILED << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+
+ cout << "- bad cycle: touch without any db/ta open..." << flush;
+ try
+ {
+ touch();
+ cout << MSG_OK << endl;
+ }
+ catch (r_Error& e)
+ {
+ cout << MSG_FAILED << ": " << e.get_errorno() << ": " << e.what() << endl;
+ }
+
+ LEAVE( "doStuff" );
+}
+
+/*
+ * returns 0 on success, -1 on error
+ */
+int main(int argc, char** argv)
+{
+ SET_OUTPUT( true );
+
+ int retval = EXIT_SUCCESS; // overall result status
+
+ try
+ {
+ parseParams( argc, argv );
+
+ cout << argv[0] << " v1.0, rasdaman v" << RMANVERSION/1000 << " -- generated on " << COMPDATE << "." << endl;
+
+ doStuff();
+ retval = EXIT_SUCCESS;
+ cout << argv[0] << " done." << endl;
+ }
+ catch (const r_Error& e)
+ {
+ cout << argv[0] << ": error " << e.get_errorno() << ": " << e.what() << endl;
+ retval = EXIT_FAILURE;
+ }
+ catch (...)
+ {
+ cerr << argv[0] << ": panic: unexpected internal exception." << endl;
+ retval = EXIT_FAILURE;
+ }
+
+ if (retval != EXIT_SUCCESS && (dbIsOpen || taIsOpen) )
+ {
+ cout << "aborting transaction..." << flush;
+ closeTransaction(); // abort transaction and close database, ignore any further exceptions
+ cout << "ok" << endl;
+ closeDatabase();
+ }
+
+ return retval;
+} // main()
+
+// end of test_error-seq.cc
+
diff --git a/systemtest/scripts/test_ql-extend.sh b/systemtest/scripts/test_ql-extend.sh
new file mode 100644
index 0000000..6a8a9ff
--- /dev/null
+++ b/systemtest/scripts/test_ql-extend.sh
@@ -0,0 +1,131 @@
+#!/bin/ksh
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+# test_ql-extend.sh - test extend() function of rasql
+#
+# SYNOPSIS:
+# test_ql-extend.sh
+#
+# DESCRIPTION
+# Performs test queries to check whether extend() function works.
+echo not yet done!
+exit
+#
+# RESPONDING TO INCIDENT
+# Incident_2005-07-12_IGN_png-transparency
+#
+# PROCEDURE
+# Perform rasql calls, check output and, where applicable, the image generated.
+# Output checking inspects target domain and image contents
+# (original area unchanged, new areas set to 0; contents check just by dumping
+# and relying on regression comparison)
+#
+# PRECONDITIONS
+# - rasql utility available
+# - rasdaman up and running, with database having user/password as defined below
+# - ImageMagick installed to have 'identify' utility
+#
+# RETURN CODES
+ RC_OK=0 # everything went fine
+ RC_ERROR=1 # something went wrong
+#
+# CHANGE HISTORY
+# 2005-jul-16 P.Baumann created
+#
+# RESTRICTIONS
+# test only with 2D, should be extended
+# test only with RGB, should be extended to cover all pixel types
+#
+
+
+# --- CONSTANTS -----------------------------------------------------
+
+RCTEXT_OK="OK"
+RCTEXT_ERROR="NOT_OK"
+
+# name of script
+PROG=`basename $0`
+
+# temp file for getcap response:
+TMPFILE=/tmp/`basename $PROG .sh`.tmp
+
+# --- TEST SETTINGS -------------------------------------------------
+
+# login (must allow r/w)
+USER=rasadmin
+PASSWD=rasadmin
+
+# test collection
+TESTCOLL=ExtendTestCollection
+
+# test image boxes
+BOX_ALLPOS=[10:20,30:40]
+BOX_ALLNEG=[-20:-10,-40:-30]
+BOX_MIXED=[-10:20,-30:40]
+
+# extend boxes, good cases: top right
+EXTEND_GOOD_TOPRIGHT_ALLPOS=[10:20,30:40] ??
+EXTEND_GOOD_TOPRIGHT_ALLNEG=[-20:-10,-40:-30] ??
+EXTEND_GOOD_TOPRIGHT_MIXED=[-10:20,-30:40] ??
+
+...
+
+# bad test cases: extend area inside image
+EXTED_BAD_INSIDE_ALLPOS=[11:19,31:39]
+EXTED_BAD_INSIDE_ALLNEG=[-19:-11,-39:-31]
+EXTED_BAD_INSIDE_MIXED=[-11:19,-29:39]
+
+# --- ACTION --------------------------------------------------------
+
+echo $PROG: Verify rasql extend function
+
+# delete eventually preexisting test collection
+# create test collection
+# create white test images
+# - all corner points in positive quadrant
+# - corner points in all quadrants
+# - all corner points in negative quadrant
+# extend each test image, good cases
+# - extend top right (cross origin for neg locations!)
+# - extend bottom left (cross origin for pos locations!)
+# - extend in all directions
+# extend each test image, bad cases
+# - extend area completely inside test image
+
+# delete test collection
+
+# search for proper string in response
+if [ ...... ]
+then
+ RC=$RC_ERROR
+ RCTEXT=$RCTEXT_ERROR
+else
+ RC=$RC_OK
+ RCTEXT=$RCTEXT_OK
+fi
+
+# clean up
+rm -f $TMPFILE
+
+echo $PROG: done, result is $RCTEXT.
+exit $RC
+
diff --git a/systemtest/scripts/test_ql-png-options.sh b/systemtest/scripts/test_ql-png-options.sh
new file mode 100644
index 0000000..ba6421c
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.sh
@@ -0,0 +1,251 @@
+#!/bin/bash
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+# test_ql-png-options.sh - test png(mdd,options) function of rasql
+#
+# SYNOPSIS:
+# test_ql-png-options.sh
+#
+# DESCRIPTION
+# Performs test queries to check whether transparency and background
+# option works in function png(_,_).
+#Write log to stdout/stderr for ???
+# Does not test general image encoding!
+#
+# RESPONDING TO INCIDENT
+# Incident_2005-07-12_IGN_png-transparency
+#
+# PROCEDURE
+# - create test collections and objects
+# - perform rasql calls, check output and, where applicable, the image generated
+# check that (i) file is generated, (ii) has transparency color set appropriately
+# - remove output files and test collections
+#
+# PRECONDITIONS
+# - rasql binary available in the $RMANBASE/applications/rasql development directory
+# - rasdaman up and running,
+# - database allows write access using user/password as defined below
+# - ImageMagick installed to have 'identify' utility
+# - can create subdir in cwd
+#
+# RETURN CODES
+ RC_OK=0 # everything went fine
+ RC_ERROR=1 # something went wrong
+#
+# CHANGE HISTORY
+# 2005-jul-26 P.Baumann created
+# 2005-aug-25 P.Baumann use raiseError() to centralize bailout behavior
+#
+# COMMENTS
+# - add test for INV_PNG()
+#
+
+
+# --- CONSTANTS -----------------------------------------------------
+
+# textual representation of error conditions
+RCTEXT_OK="OK"
+RCTEXT_ERROR="NOT_OK"
+
+# name of script
+PROG=`basename $0`
+
+# reference data directory
+OLDDIR=./`basename $PROG .sh`.old
+
+# temp dir for image files
+TMPDIR=./`basename $PROG .sh`.test
+
+# user/password (must have r/w rights!)
+USER=rasadmin
+PASSWD=rasadmin
+
+# test collections for monochrome/gray/color images
+TESTCOLL_MONO=TestPngMono
+TESTCOLL_GRAY=TestPngGray
+TESTCOLL_COLOR=TestPngColor
+
+# the rasql utility, suppressing unnecessarily verbose output
+RMANBASE=~rasdev/Compile/rasdaman
+RASQL="$RMANBASE/applications/rasql/rasql --quiet"
+
+# to get error messages (from $RMANHOME/bin/errtxts):
+RMANHOME=$RMANBASE
+
+# how to react on error
+function raiseError() { echo "$PROG: fatal error, aborting."; exit $RC_ERROR; }
+#function raiseError() { echo "$PROG: error in test; resuming."; RC=$RC_ERROR; }
+
+# --- ACTION --------------------------------------------------------
+
+echo "$PROG: test rasql PNG() function"
+
+# --- preparation
+
+echo "$PROG: create test dir"
+mkdir -p $TMPDIR
+
+# initialize overall return code
+RC=$RC_OK
+
+# --- cleanup to prepare
+# delete test collection & image & temp data
+$RASQL -q "drop collection $TESTCOLL_MONO" --user $USER --passwd $PASSWD
+$RASQL -q "drop collection $TESTCOLL_GRAY" --user $USER --passwd $PASSWD
+$RASQL -q "drop collection $TESTCOLL_COLOR" --user $USER --passwd $PASSWD
+
+# create test collections
+# - mono
+$RASQL -q "create collection $TESTCOLL_MONO BoolSet" --user $USER --passwd $PASSWD || raiseError
+# - gray
+$RASQL -q "create collection $TESTCOLL_GRAY GreySet" --user $USER --passwd $PASSWD || raiseError
+# - color
+$RASQL -q "create collection $TESTCOLL_COLOR RGBSet" --user $USER --passwd $PASSWD || raiseError
+
+# create test objects
+# - mono
+$RASQL -q "insert into $TESTCOLL_MONO values marray x in [0:3,0:3] values (x[0]+x[1]) = 1" --user $USER --passwd $PASSWD || raiseError
+# - gray
+$RASQL -q "insert into $TESTCOLL_GRAY values marray x in [0:3,0:3] values (char) (x[0]*x[1])" --user $USER --passwd $PASSWD || raiseError
+# - color
+$RASQL -q "insert into $TESTCOLL_COLOR values marray x in [0:3,0:3] values ((char)(x[0]*x[1]))*{1c,1c,1c}" --user $USER --passwd $PASSWD || raiseError
+
+# --- tests
+
+echo "$PROG: test good cases pf transp / non-transp, bg colors"
+echo "$PROG: --- set bg to transparent"
+echo "$PROG: --- --- mono"
+echo "$PROG: --- --- --- dec"
+$RASQL -q "select png(a,\"tRNS=0)\" ) from $TESTCOLL_MONO as a" --out file --outfile $TMPDIR/png-mono-trns_1 || raiseError
+if [ `identify -verbose $TMPDIR/png-mono-trns_1.png | grep Opacity | grep 0 | wc -l` -eq 0 ]
+then
+ echo "Error: transparency not set in PNG file $TMPDIR/pngmono-trns_1.png -- $RCTEXT_ERROR"
+ raiseError
+fi
+if [ ! `cmp -s $OLDDIR/png-mono-trns_1.png $TMPDIR/png-mono-trns_1.png` ]
+then
+ echo "Error: PNG file contents in file $TMPDIR/pngmono-trns_1.png does not match regression source -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+# ==== complete down here:
+$RASQL -q "select png(a,\"tRNS=1)\" ) from $TESTCOLL_MONO as a" --out file --outfile $TMPDIR/png-mono-trns_2 || raiseError
+
+echo "$PROG: --- --- gray"
+echo "$PROG: --- --- --- dec"
+$RASQL -q "select png(a,\"tRNS=0)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_1 || raiseError
+$RASQL -q "select png(a,\"tRNS=2)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_2 || raiseError
+$RASQL -q "select png(a,\"tRNS=255)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_3 || raiseError
+echo "$PROG: --- --- --- oct"
+$RASQL -q "select png(a,\"tRNS=00)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_4 || raiseError
+$RASQL -q "select png(a,\"tRNS=02)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_5 || raiseError
+$RASQL -q "select png(a,\"tRNS=07777)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_6 || raiseError
+echo "$PROG: --- --- --- hex"
+$RASQL -q "select png(a,\"tRNS=0x0)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_7 || raiseError
+$RASQL -q "select png(a,\"tRNS=0x2)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_8 || raiseError
+$RASQL -q "select png(a,\"tRNS=0xff)\" ) from $TESTCOLL_GRAY as a" --out file --outfile $TMPDIR/png-gray-trns_9 || raiseError
+
+echo "$PROG: --- --- color"
+echo "$PROG: --- --- --- dec"
+$RASQL -q "select png(a,\"tRNS=(1;2;3)\" ) from $TESTCOLL_COLOR as a" --out file --outfile $TMPDIR/png-color-trns_1 || raiseError
+echo "$PROG: --- --- --- hex"
+$RASQL -q "select png(a,\"tRNS=(0x77;0xd0;0xf8)\" ) from rgb as a" --out file || raiseError
+echo "$PROG: --- --- --- mixed"
+$RASQL -q "select png(a,\"tRNS=(1;02;0x3)\" ) from $TESTCOLL_COLOR as a" --out file --outfile $TMPDIR/png-color-trns_10 || raiseError
+
+
+echo "$PROG: test bad cases: syntax errors, overflow in bg colors"
+
+echo "$PROG: --- tRNS tag wrong"
+if [ `$RASQL -q "select png(a,\"XXX=(1;2;3)\" ) from $TESTCOLL_COLOR as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+echo "$PROG: --- no number, gray"
+if [ `$RASQL -q "select png(a,\"tRNS=zzz\" ) from $TESTCOLL_GRAY as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+echo "$PROG: --- no number, color"
+if [ `$RASQL -q "select png(a,\"tRNS=(q;w;s)\" ) from $TESTCOLL_GRAY as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+echo "$PROG: --- color/gray mismatch"
+if [ `$RASQL -q "select png(a,\"tRNS=12\" ) from $TESTCOLL_COLOR as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+if [ `$RASQL -q "select png(a,\"tRNS=(1;2;3)\" ) from $TESTCOLL_GRAY as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+echo "$PROG: --- paren error (not recognized currently)"
+if [ `$RASQL -q "select png(a,\"tRNS=12;13;14)\" ) from $TESTCOLL_GRAY as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+echo "$PROG: --- number overflow"
+if [ `$RASQL -q "select png(a,\"tRNS=1000000000;2000000000;30000000000000)\" ) from $TESTCOLL_COLOR as a" 2>&1 | grep "Execution error 381" | wc -l` -ne 1 ]
+then
+ echo "Error: cannot sense proper error message -- $RCTEXT_ERROR"
+ raiseError
+fi
+
+
+# compare files against old ones
+for i in `(cd $TMPDIR; ls *.png)`
+do
+ if [ `cmp -s $OLDDIR/$i $TMPDIR/$i` ]
+ then
+ echo "Error: regression discrepancy between files $OLDDIR/$i and $TMPDIR/$i -- $RCTEXT_ERROR"
+ fi
+done
+
+# --- cleanup and summarise
+# delete test collection & image & temp data
+$RASQL -q "drop collection $TESTCOLL_MONO" --user $USER --passwd $PASSWD || raiseError
+$RASQL -q "drop collection $TESTCOLL_GRAY" --user $USER --passwd $PASSWD || raiseError
+$RASQL -q "drop collection $TESTCOLL_COLOR" --user $USER --passwd $PASSWD || raiseError
+
+if [ $RC -eq $RC_OK ]
+then
+ rm -rf $TMPDIR
+ RCTEXT=$RCTEXT_OK
+else
+ RCTEXT=$RCTEXT_ERROR
+fi
+
+echo $PROG: done, result is $RCTEXT.
+exit $RC
diff --git a/systemtest/scripts/test_ql-png-options.test/png-color-trns_1.png b/systemtest/scripts/test_ql-png-options.test/png-color-trns_1.png
new file mode 100644
index 0000000..adf7769
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-color-trns_1.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-color-trns_10.png b/systemtest/scripts/test_ql-png-options.test/png-color-trns_10.png
new file mode 100644
index 0000000..adf7769
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-color-trns_10.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_1.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_1.png
new file mode 100644
index 0000000..70a5bd6
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_1.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_2.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_2.png
new file mode 100644
index 0000000..036b6ec
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_2.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_3.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_3.png
new file mode 100644
index 0000000..3b57c56
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_3.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_4.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_4.png
new file mode 100644
index 0000000..70a5bd6
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_4.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_5.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_5.png
new file mode 100644
index 0000000..036b6ec
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_5.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_6.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_6.png
new file mode 100644
index 0000000..3b57c56
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_6.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_7.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_7.png
new file mode 100644
index 0000000..70a5bd6
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_7.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_8.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_8.png
new file mode 100644
index 0000000..036b6ec
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_8.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-gray-trns_9.png b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_9.png
new file mode 100644
index 0000000..3b57c56
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-gray-trns_9.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-mono-trns_1.png b/systemtest/scripts/test_ql-png-options.test/png-mono-trns_1.png
new file mode 100644
index 0000000..e6c26c9
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-mono-trns_1.png
Binary files differ
diff --git a/systemtest/scripts/test_ql-png-options.test/png-mono-trns_2.png b/systemtest/scripts/test_ql-png-options.test/png-mono-trns_2.png
new file mode 100644
index 0000000..583edee
--- /dev/null
+++ b/systemtest/scripts/test_ql-png-options.test/png-mono-trns_2.png
Binary files differ
diff --git a/systemtest/scripts/test_user.sh b/systemtest/scripts/test_user.sh
new file mode 100644
index 0000000..d6a4e7e
--- /dev/null
+++ b/systemtest/scripts/test_user.sh
@@ -0,0 +1,157 @@
+#!/bin/ksh
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+# test_user - test rasdaman server authentication
+#
+# SYNOPSIS:
+# test_user.sh
+#
+# DESCRIPTION
+# Performs rasql test queries to check whether authentication is observed.
+#
+# RESPONDING TO INCIDENT
+# -none-
+#
+# PROCEDURE
+# Perform rasql calls performing different operations types requiring
+# different authentication. check whether operations are recejcted/accepted
+# properly.
+#
+# PRECONDITIONS
+# - rasql utility available
+# - rasdaman up and running, with database having user/password as defined below
+#
+# RETURN CODES
+ RC_OK=0 # everything went fine
+ RC_ERROR=1 # something went wrong
+#
+# CHANGE HISTORY
+# 2006-jan-02 P.Baumann created
+#
+# RESTRICTIONS
+# -/-
+#
+
+
+# --- CONSTANTS -----------------------------------------------------
+
+RCTEXT_OK="OK"
+RCTEXT_ERROR="NOT_OK"
+
+ERROR=ERROR
+INDENT="+++"
+
+# name of script
+PROG=`basename $0`
+PROGBASE=`basename $0 .sh`
+
+# log file output
+LOG=$PROGBASE.log
+
+# reference log file
+REFLOG=$LOG.reference
+# save old log here if it exists
+SAVELOG=$LOG.save
+
+# --- TEST SETTINGS -------------------------------------------------
+
+# r/o login
+USER_RO=rasguest
+PASSWD_RO=rasguest
+
+# r/w login
+USER_RW=rasadmin
+PASSWD_RW=rasadmin
+
+# nonex login
+USER_NONEX=nonex
+PASSWD_NONEX=nonex
+
+# test collection
+TESTCOLL=AuthentTestCollection
+TESTCOLL_TYPE=GreySet
+
+# --- ACTION --------------------------------------------------------
+
+# save old log if present
+if [ -f $LOG ]
+then
+ echo found old log file, shifting it to $SAVELOG
+ mv $LOG $SAVELOG
+fi
+
+echo $PROG: testing rasdaman authentication at `date` | tee $LOG
+
+# good cases
+echo $INDENT good cases | tee -a $LOG
+echo $INDENT $INDENT write
+( rasql --quiet -q "create collection $TESTCOLL $TESTCOLL_TYPE" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "insert into $TESTCOLL values marray x in [1:10,1:10] values (char) x[0]" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "update $TESTCOLL as m set m[1:1,1:1] assign marray x in [1:1,1:1] values 42c" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+echo $INDENT $INDENT read
+( rasql --quiet -q "select a[1,1] from $TESTCOLL as a" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "select a[1,1] from $TESTCOLL as a" --user $USER_RO --passwd $PASSWD_RO \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+echo $INDENT $INDENT "write (2)"
+# not yet supported by server:
+# ( rasql --quiet -q "delete from $TESTCOLL" --user $USER_RW --passwd $PASSWD_RW \
+( rasql --quiet -q "delete from $TESTCOLL where true" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "drop collection $TESTCOLL" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+echo $INDENT $INDENT set up test env for subsequent cases
+( rasql --quiet -q "create collection $TESTCOLL $TESTCOLL_TYPE" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "insert into $TESTCOLL values marray x in [1:10,1:10] values (char) x[0]" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+echo $INDENT good cases done. | tee -a $LOG
+
+# bad cases
+echo $INDENT bad cases | tee -a $LOG
+echo $INDENT $INDENT nonex login
+( rasql --quiet -q "select a[1,1] from $TESTCOLL as a" --user $USER_NONEX --passwd $PASSWD_NONEX \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+echo $INDENT $INDENT write op with r/o login
+( rasql --quiet -q "update $TESTCOLL as m set m[1:1,1:1] assign marray x in [1:1,1:1] values 42c" --user $USER_RO --passwd $PASSWD_RO \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "insert into $TESTCOLL values marray x in [1:10,1:10] values (char) x[0]" --user $USER_RO --passwd $PASSWD_RO \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "delete from $TESTCOLL where true" --user $USER_RO --passwd $PASSWD_RO \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+echo $INDENT $INDENT wrong passwd
+( rasql --quiet -q "select a[1,1] from $TESTCOLL as a" --user $USER_RO --passwd $PASSWD_NONEX \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+( rasql --quiet -q "update $TESTCOLL as m set m[1:1,1:1] assign marray x in [1:1,1:1] values 42c" --user $USER_RW --passwd $PASSWD_RO \
+ || (export RC=$?; echo Recognized bad case, exit code $RC) ) | tee -a $LOG
+echo $INDENT bad cases done. | tee -a $LOG
+
+echo $INDENT cleanup:
+( rasql --quiet -q "drop collection $TESTCOLL" --user $USER_RW --passwd $PASSWD_RW \
+ || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG
+
+echo $PROG: done at `date`.
+exit $RC
+
diff --git a/systemtest/scripts/testoid.sh b/systemtest/scripts/testoid.sh
new file mode 100644
index 0000000..b8cdbb4
--- /dev/null
+++ b/systemtest/scripts/testoid.sh
@@ -0,0 +1,114 @@
+#!/bin/ksh
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>.
+if [[ $1 = "" || $2 = "" ]]; then
+ echo "usage: testoid.sh <server name> <base name>"
+ return
+fi
+
+SERVER=$1
+BASENAME=$2
+
+# test programs
+insert="$RMANBASE/rasodmg/test/test_insert3 -server $SERVER -base $BASENAME "
+query="$RMANBASE/rasodmg/test/test_query -server $SERVER -base $BASENAME "
+lookup="$RMANBASE/rasodmg/test/test_lookup -server $SERVER -base $BASENAME "
+
+
+testExitStatus()
+{
+ if [[ ( $2 = 0 && $1 = 0 ) || ( $2 != 0 && $1 != 0 ) ]]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo "\nProgram output:"
+ cat log
+ echo "\n\n"
+ fi
+}
+
+
+#
+# main
+#
+
+setOId=""
+imageOId=""
+
+echo "-- Testbed start block."
+echo "Delete test set oidSet ... " ;
+echo "10\n" | $insert -setname oidSet > log ;
+testExitStatus $? -1;
+
+echo "Insert test image into oidSet ... " ;
+echo "5\n 0\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname oidSet -testbed > log ;
+testExitStatus $? 0;
+echo "-- Testbed end block."
+
+# get oids
+setOId=`grep set_oid log | sed 's/-- Testbed:.*=//g' `
+imageOId=`grep image_oid log | sed 's/-- Testbed:.*=//g' `
+
+echo "Set OId: " $setOId
+echo "Image OId: " $imageOId
+
+echo "-- Testbed start block."
+echo "Get set by oid ... "
+$lookup -oid $setOId -testbed -nooutput > log;
+testExitStatus $? 0;
+
+echo "Get image by oid ... "
+$lookup -oid $imageOId -testbed -nooutput > log;
+testExitStatus $? 0;
+
+echo "Get set by name ... "
+$lookup -setname oidSet -testbed -nooutput > log;
+testExitStatus $? 0;
+
+echo "Remove image from oidSet ... " ;
+echo "11\n 1\n" | $insert -setname oidSet > log ;
+testExitStatus $? 0;
+
+echo "Try to access image by oid again ... "
+$lookup -oid $imageOId -testbed -nooutput > log;
+testExitStatus $? -1;
+
+echo "Delete test set oidSet ... " ;
+echo "10\n" | $insert -setname oidSet > log ;
+testExitStatus $? 0;
+
+echo "Try to access set by oid again ... "
+$lookup -oid $setOId -testbed -nooutput > log;
+testExitStatus $? -1;
+
+echo "Try to access set by name again ... "
+$lookup -setname oidSet -testbed -nooutput > log;
+testExitStatus $? -1;
+echo "-- Testbed end block."
+
+echo "\nTesting finnished."
+
+
+
+
+
+