summaryrefslogtreecommitdiffstats
path: root/servercomm/test
diff options
context:
space:
mode:
authorConstantin Jucovschi <cj@ubuntu.localdomain>2009-04-24 07:20:22 -0400
committerConstantin Jucovschi <cj@ubuntu.localdomain>2009-04-24 07:20:22 -0400
commit8f27e65bddd7d4b8515ce620fb485fdd78fcdf89 (patch)
treebd328a4dd4f92d32202241b5e3a7f36177792c5f /servercomm/test
downloadrasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.tar.gz
rasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.tar.xz
rasdaman-upstream-8f27e65bddd7d4b8515ce620fb485fdd78fcdf89.zip
Initial commitv8.0
Diffstat (limited to 'servercomm/test')
-rw-r--r--servercomm/test/Makefile117
-rw-r--r--servercomm/test/template_inst.hh138
-rw-r--r--servercomm/test/test_dbcontent.cc161
-rw-r--r--servercomm/test/test_oid.cc229
-rw-r--r--servercomm/test/test_servercomm.cc128
5 files changed, 773 insertions, 0 deletions
diff --git a/servercomm/test/Makefile b/servercomm/test/Makefile
new file mode 100644
index 0000000..bf035b4
--- /dev/null
+++ b/servercomm/test/Makefile
@@ -0,0 +1,117 @@
+# -*-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 programs of module servercomm
+######################### Definitions ############################
+
+# standard include with general options
+include $(RMANBASE)/Makefile.inc
+
+# all test programs
+SRCCXX = test_servercomm.cc test_dbcontent.cc test_oid.cc
+OBJS = ${SRCCXX:%.cc=%.o}
+ALLTESTS = ${SRCCXX:%.cc=%}
+
+# some additional flags for compiling and linking
+
+CXXFLAGS += -I$(RMANBASE)/servercomm
+LDFLAGS := -I$(RMANBASE)/servercomm $(LDFLAGS)
+
+# add communication flags
+CXXFLAGS += $(COMMCXXFLAGS)
+LDFLAGS += $(COMMLDFLAGS)
+
+# add compile and link options for STL
+CXXFLAGS += $(STLCXXFLAGS)
+LDFLAGS += $(STLLDFLAGS)
+
+########################### Targets ##############################
+
+# test target for servercomm
+.PHONY : servercomm
+servercomm: adminif raslib test_module test_servercomm
+
+# test target for dbcontent
+.PHONY : dbcontent
+dbcontent: adminif raslib test_module test_dbcontent
+
+.PHONY : adminif
+adminif:
+ cd $(RMANBASE)/reladminif; $(MAKE)
+
+.PHONY : raslib
+raslib:
+ cd $(RMANBASE)/raslib; $(MAKE)
+
+.PHONY : qlparser
+qlparser:
+ cd $(RMANBASE)/qlparser; $(MAKE)
+
+.PHONY : test_module
+test_module:
+ cd $(RMANBASE)/servercomm; $(MAKE)
+
+test_servercomm: test_servercomm.o \
+ $(QLPARSER) \
+ $(SERVERCOMM) \
+ $(CACHETAMGR) \
+ $(MDDIF) \
+ $(CATALOGIF) \
+ $(INDEXIF) \
+ $(INDEXMGR) \
+ $(BLOBIF) \
+ $(ADMINIF) \
+ $(PREPROCESSOR) \
+ $(STORAGEMGR) \
+ $(TILEMGR) \
+ $(RASLIB) \
+ $(RELINDEX) \
+ $(INDEXIF)
+ $(CXX) $(LDFLAGS) -o $@ $^ $(QLPARSER) $(INDEXMGR) $(CACHETAMGR) $(RELINDEX) $(RELSTORAGEIF) $(RELADMINIF) $(STORAGEMGR) $(CONVERSION) $(INDEXIF) $(RELCATALOGIF) /usr/local/pgsql/lib/libpq.a /usr/local/pgsql/lib/libecpg.a -lssl -lcrypt /usr/local/pgsql/lib/libpgtypes.a -lm -ljpeg -ltiff -lpng -lmfhdf -ldf -lz -ldl -lcrypto
+
+test_dbcontent: test_dbcontent.o \
+ $(QLPARSER) \
+ $(SERVERCOMM) \
+ $(RASLIB) \
+ $(CACHETAMGR) \
+ $(MDDIF) \
+ $(CATALOGIF) \
+ $(INDEXIF) \
+ $(INDEXMGR) \
+ $(BLOBIF) \
+ $(ADMINIF)
+ $(CXX) $(LDFLAGS) $(O2LDFLAGS) -o $@ $^ $(QLPARSER) $(INDEXMGR) $(CACHETAMGR) -lm
+
+test_oid: test_oid.o $(RASLIB) $(CACHETAMGR)\
+ $(MDDIF) $(CATALOGIF) $(INDEXIF) $(INDEXMGR) $(BLOBIF) $(ADMINIF)
+ $(PURIFY) $(CXX) $(O2LDFLAGS) $(LDFLAGS) -o $@ $^ \
+ $(RASLIB) -lm -L$(SUPPORT_BASE)/lib -lz
+
+
+# general rules
+include $(RMANBASE)/Makefile.rel
+
+# automatically created dependencies
+include Makefile.dep
diff --git a/servercomm/test/template_inst.hh b/servercomm/test/template_inst.hh
new file mode 100644
index 0000000..569c0bf
--- /dev/null
+++ b/servercomm/test/template_inst.hh
@@ -0,0 +1,138 @@
+/*
+* 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>.
+*/
+
+//for rb_tree, select1st
+#include <function.h>
+#include <tree.h>
+#include <vector>
+#include <utility>
+#include <memory>
+
+#if(__GNUC__==2 &&__GNUC_MINOR__==95)
+using std::rb_tree;
+using std::select1st;
+#else
+using __gnu_cxx::rb_tree;
+using __gnu_cxx::select1st;
+#endif
+
+using std::vector;
+using std::pair;
+
+// commented by Constantin Jucovschi (gcc 3.4+ no longer supports __default_alloc_template)
+//using std::__default_alloc_template;
+using std::fill_n;
+
+#include "qlparser/symtab.hh"
+
+#include "raslib/attribute.hh"
+#include "raslib/itertype.hh"
+#include "raslib/dlist.hh"
+
+#include "tile.hh"
+
+#include "indexmgr/keyobject.hh"
+
+#include "reladminif/dbref.hh"
+#include "reladminif/dbobjectiditerator.hh"
+
+#include "relblobif/blobtile.hh"
+#include "relblobif/dbtile.hh"
+#include "relblobif/inlinetile.hh"
+
+#include "relcatalogif/typeiterator.hh"
+#include "relcatalogif/settype.hh"
+#include "relcatalogif/structtype.hh"
+#include "relcatalogif/mddtype.hh"
+#include "relcatalogif/inlineminterval.hh"
+#include "relcatalogif/dbminterval.hh"
+
+#include "relindexif/dbtcindex.hh"
+#include "relindexif/hierindex.hh"
+#include "relindexif/dbrcindexds.hh"
+
+#include "relmddif/dbmddobj.hh"
+#include "relmddif/dbmddset.hh"
+
+#include "relstorageif/dbudfds.hh"
+#include "relstorageif/dbudfpackageds.hh"
+#include "relstorageif/dbstoragelayout.hh"
+
+template class SymbolTable<int>;
+
+template class r_IterType<r_Attribute>;
+
+template class DBRef<DBHierIndex>;
+template class DBRef<DBRCIndexDS>;
+template class DBRef<DBTCIndex>;
+template class DBRef<BLOBTile>;
+template class DBRef<DBTile>;
+template class DBRef<InlineTile>;
+template class DBRef<DBMDDSet>;
+template class DBRef<DBMinterval>;
+template class DBRef<DBStorageLayout>;
+template class DBRef<DBUDFDS>;
+template class DBRef<DBUDFPackageDS>;
+//template class DBRef<DBMDDObj>;
+// template bool operator< (const DBRef<DBMDDObj>&, const DBRef<DBMDDObj>&);
+
+//template TypeIterator<StructType>;
+//template TypeIterator<SetType>;
+template class TypeIterator<MDDType>;
+template class DBRef<DBMDDObj>;
+template class DBRef<DBObject>;
+
+template class DBObjectIdIterator<DBMDDObj>;
+template class DBObjectIterator<DBMDDObj>;
+template class DBObjectIterator<DBMDDSet>;
+template class DBObjectIterator<StructType>;
+template class DBObjectIterator<SetType>;
+template class DBRef<StructType>;
+template class DBRef<SetType>;
+template class DBRef<MDDType>;
+
+template std::ostream& operator<< (const vector<KeyObject>&, std::ostream&);
+template std::ostream& operator<< (std::ostream &, const vector<KeyObject>&);
+template std::ostream& operator << (std::ostream& os, const std::vector<double>& list);
+template std::ostream& operator << (std::ostream& os, const std::vector<r_Minterval>& list);
+
+template class rb_tree<OId, pair<OId const, DBMDDObj *>, select1st<pair<OId const, DBMDDObj *> >, less<OId> >;
+template class rb_tree<OId, pair<OId const, DBMinterval *>, select1st<pair<OId const, DBMinterval *> >, less<OId> >;
+template class rb_tree<OId, pair<OId const, DBRef<DBMDDObj> >, select1st<pair<OId const, DBRef<DBMDDObj> > >, less<OId> >;
+template class rb_tree<OId, pair<OId const, DBMDDSet *>, select1st<pair<OId const, DBMDDSet *> >, less<OId> >;
+template class rb_tree<OId, pair<OId const, MDDType *>, select1st<pair<OId const, MDDType *> >, less<OId> >;
+template class rb_tree<OId, pair<OId const, SetType *>, select1st<pair<OId const, SetType *> >, less<OId> >;
+template class rb_tree<OId, pair<OId const, StructType *>, select1st<pair<OId const, StructType *> >, less<OId> >;
+template class rb_tree<long, pair<long const, BLOBTile *>, select1st<pair<long const, BLOBTile *> >, less<long> >;
+template class rb_tree<long, pair<long const, InlineTile *>, select1st<pair<long const, InlineTile *> >, less<long> >;
+template class vector<BaseType const * >;
+template class vector<OId >;
+template class vector<Tile * >;
+template class vector<Type * >;
+template class vector<char * >;
+template class vector<char >;
+template class vector<r_Data_Format >;
+template class vector<unsigned int >;
+
+template class Tile ** fill_n<Tile **, unsigned int, Tile *>(Tile **, unsigned int, Tile * const &);
+
diff --git a/servercomm/test/test_dbcontent.cc b/servercomm/test/test_dbcontent.cc
new file mode 100644
index 0000000..a0bd6da
--- /dev/null
+++ b/servercomm/test/test_dbcontent.cc
@@ -0,0 +1,161 @@
+/*
+* 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>.
+/
+/**
+ * SOURCE: test_dbcontent.cc
+ *
+ * MODULE: test
+ *
+ * PURPOSE:
+ * Reads the contents of the specified collection and prints
+ * it on the screen.
+ *
+ * COMMENTS:
+ * none
+ *
+*/
+
+#include <stdlib.h>
+#include <iostream.h>
+
+#include "o2template_CC.hxx" // declaration of O2 ref and coll classes
+
+#include "ulongtype.hh"
+
+#include "cachetamgr/persmddcoll.hh"
+#include "cachetamgr/persmddobj.hh"
+#include "cachetamgr/perstile.hh"
+
+#include "cachetamgr/persmddcolliter.hh"
+
+#include "adminif.hh"
+#include "databaseif.hh"
+#include "transactionif.hh"
+
+#include <unistd.h>
+
+extern char* myExecArgv0 = "";
+
+static void testAccessing( const char* collName );
+
+/*************************************************************
+ * Function name.: int main( int argc, char** argv)
+ *
+ * Arguments.....:
+ * argc: number of arguments given to program
+ * argv: array of char* with arguments
+ * Return value..: exit status
+ * Description...: none
+ ************************************************************/
+
+void
+main( int ac, char** av)
+{
+ char baseName[255];
+ char collName[255];
+
+ if( ac > 1 )
+ strcpy( baseName, av[1] );
+ else
+ strcpy( baseName, "RasDaBase" );
+
+ if( ac > 2 )
+ strcpy( collName, av[2] );
+ else
+ strcpy( collName, "Images" );
+
+ pid_t cpid;
+ cout << "Parent process id is " << getpid() << endl;
+
+ cpid = fork();
+
+ if( !cpid )
+ {
+ cout << "Child process id is " << getpid() << endl;
+ // sleep(1);
+ }
+
+ // variables representing O2 database, ta and session
+ DatabaseIf database;
+ TransactionIf ta;
+
+ // don't forget to initialize before using AdminIf!
+ myExecArgv0 = av[0];
+ AdminIf* myAdmin = AdminIf::instance();
+
+ // connect to the database
+ cout << getpid() << " Connecting to database " << baseName << "..." << endl;
+ database.open( baseName );
+
+ // read coll and print contents
+ cout << getpid() << " Read collection and print contents..." << endl;
+ ta.begin();
+ testAccessing( collName );
+ ta.commit();
+
+ cout << getpid() << " closing db ... "; cout.flush();
+ database.close();
+ cout << getpid() << " OK" << endl;
+
+ cout << getpid() << " Ending O2 session..." << endl;
+ delete myAdmin;
+ cout << getpid() << " OK" << endl;
+
+ return;
+}
+
+
+
+/*************************************************************
+ * Function......: testAccessing()
+ *
+ * Arguments.....: none
+ * Return value..: none
+ * Description...: reads DirTilesIx's and shows contents
+ ************************************************************/
+
+static void testAccessing( const char* collName )
+{
+ PersMDDObj* accessedObj;
+
+ cout << getpid() << " ....testAccessing" << endl;
+ /*
+ PersMDDColl objsSet( collName );
+
+ // To test PersMDDColl::printStatus( )
+ objsSet.printStatus( );
+
+ // To test PersMDDObj::printStatus( ), MDDCollIter::createIterator( ) and
+ // MDDCollIter methods :
+ MDDCollIter* objsIt = objsSet.createIterator( );
+
+ for( int i = 1 ; objsIt->notDone( ); i++, objsIt->advance( ))
+ {
+ accessedObj = (PersMDDObj*) objsIt->getElement();
+ cout << " --"<<i<<". MDD object in set:" << endl;
+ accessedObj->printStatus();
+ }
+ delete objsIt;
+ */
+}
+
+
diff --git a/servercomm/test/test_oid.cc b/servercomm/test/test_oid.cc
new file mode 100644
index 0000000..280b499
--- /dev/null
+++ b/servercomm/test/test_oid.cc
@@ -0,0 +1,229 @@
+/*
+* 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>.
+/
+/**
+ * SOURCE: test_dbcontent.cc
+ *
+ * MODULE: test
+ *
+ * PURPOSE:
+ * Reads the contents of the specified collection and prints
+ * it on the screen.
+ *
+ * COMMENTS:
+ * none
+ *
+*/
+
+#include <stdlib.h>
+#include <iostream.h>
+
+#include "o2template_CC.hxx" // declaration of O2 ref and coll classes
+
+#include "ulongtype.hh"
+
+#include "cachetamgr/persmddcoll.hh"
+#include "cachetamgr/persmddobj.hh"
+#include "cachetamgr/perstile.hh"
+
+#include "cachetamgr/persmddcolliter.hh"
+
+#include "adminif.hh"
+#include "databaseif.hh"
+#include "transactionif.hh"
+
+#include <unistd.h>
+
+RMINITGLOBALS('C')
+
+extern char* myExecArgv0 = "";
+
+static void
+insertObj( char* dbName, OId o, char* cn )
+{
+ MDDBaseType* mddType = (MDDBaseType*)TypeFactory::mapMDDType( "GreyImage" );
+ r_Minterval domain( "[0:9,0:9]" );
+
+ // cout << " " << o << "," << cn << " ... " << flush;
+
+ PersMDDObj* obj = new PersMDDObj( mddType, domain, dbName, o );
+ PersMDDColl objsSet( cn );
+ objsSet.insert( obj );
+ delete obj;
+}
+
+
+static void removeObj( char* dbName, char* collName, OId o )
+{
+ // open collection
+ PersMDDColl* coll = 0;
+
+ char answer = 'n';
+ cout << endl << "SCAN (y/n) ?" << flush;
+ cin >> answer;
+
+ if( answer == 'y' )
+ {
+ coll = new PersMDDColl( collName );
+ MDDCollIter* collIter = coll->createIterator();
+ MDDObj* mddObj;
+ for( collIter->reset(); collIter->notDone(); collIter->advance() )
+ {
+ mddObj = collIter->getElement();
+ /*
+ if( mddObj->isPersistent() )
+ {
+ EOId eOId;
+ ((PersMDDObj*)mddObj)->getEOId( &eOId );
+
+ cout << "MDD " << eOId.getOId() << flush;
+ }
+ */
+
+ }
+ /*
+ cout << endl << "PRINT OBJECT (y/n) ?" << flush;
+ cin >> answer;
+ if( answer == 'y' )
+ mddObj->printStatus( );
+ */
+ delete collIter;
+
+ coll->releaseAll();
+ delete coll;
+
+ cout << endl << "SCAN end" << endl;
+ }
+
+ coll = new PersMDDColl( collName );
+
+ if( coll )
+ {
+ cout <<"o == " << o << " dbName == " << dbName << endl;
+ coll->remove( o, dbName );
+
+ coll->releaseAll();
+ delete coll;
+ }
+}
+
+
+int checkArguments( int argc, char** argv, const char* searchText, int& optionValueIndex )
+{
+ int found = 0;
+ int i=1;
+
+ while( !found && i<argc )
+ found = !strcmp( searchText, argv[i++] );
+
+ if( found && i<argc && !strchr(argv[i],'-') )
+ optionValueIndex = i;
+ else
+ optionValueIndex = 0;
+
+ return found;
+}
+
+
+int
+main( int ac, char** av)
+{
+ int optionValueIndex;
+ char dbName[255];
+ char collName[255];
+
+ if( ac < 3 || checkArguments( ac, av, "-h", optionValueIndex ) )
+ {
+ cout << "Usage: test_oid base_name collection_name [options]" << endl << endl;
+ cout << "Options: -h ... this help" << endl;
+ cout << endl;
+ return 0;
+ }
+
+ strcpy( dbName, av[1] );
+ strcpy( collName, av[2] );
+
+ // variables representing O2 database, ta and session
+ DatabaseIf database;
+ TransactionIf ta;
+
+ // don't forget to initialize before using AdminIf!
+ myExecArgv0 = av[0];
+ AdminIf* myAdmin = AdminIf::instance();
+
+ // connect to the database
+ cout << "Connecting to database " << dbName << "..." << flush;
+ database.open( dbName );
+ cout << "OK" << endl;
+
+ // create collection with one object
+ cout << "Create collection ... " << flush;
+ ta.begin( &database );
+ cout << "getting type ... " << flush;
+ CollectionType* collType = (CollectionType*)TypeFactory::mapSetType( "GreySet" );
+ cout << "getting oid ... " << flush;
+ OId oidColl;
+ if( !OId::allocateMDDCollOId( &oidColl ) ) cout << oidColl << " ... " << flush;
+ PersMDDColl* pc = PersMDDColl::createRoot( collName, oidColl, collType, &database );
+ delete pc;
+ cout << "comitting ... " << flush;
+ ta.commit();
+ cout << "OK" << endl;
+
+ cout << "Insert object into collection ... " << flush;
+ ta.begin( &database );
+ cout << "getting oid ... " << flush;
+ OId oidMDD;
+ if( !OId::allocateMDDOId( &oidMDD ) ) cout << oidMDD << " ... " << flush;
+ cout << "inserting ..." << flush;
+ insertObj( dbName, oidMDD, collName );
+ cout << "comitting ... " << flush;
+ ta.commit();
+ cout << "OK" << endl;
+
+ cout << "Remove object again ... " << flush;
+ ta.begin( &database );
+ cout << "removing oid " << oidMDD << " ... " << flush;
+ removeObj( dbName, collName, oidMDD );
+ cout << "comitting ... " << flush;
+ ta.commit();
+ cout << "OK" << endl;
+
+ cout << "Delete collection ... " << flush;
+ ta.begin( &database );
+ cout << "destroying ... " << flush;
+ PersMDDColl::destroyRoot( collName, &database );
+ cout << "comitting ... " << flush;
+ ta.commit();
+ cout << "OK" << endl;
+
+ cout << "Closing db ... " << flush;
+ database.close();
+ cout << "OK" << endl;
+
+ cout << "Ending O2 session ... " << flush;
+ delete myAdmin;
+ cout << "OK" << endl;
+
+ return 0;
+}
+
diff --git a/servercomm/test/test_servercomm.cc b/servercomm/test/test_servercomm.cc
new file mode 100644
index 0000000..0be4610
--- /dev/null
+++ b/servercomm/test/test_servercomm.cc
@@ -0,0 +1,128 @@
+/*
+* 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>.
+/
+/**
+ * SOURCE: test_servercomm.cc
+ *
+ * MODULE: servercomm
+ *
+ * COMMENTS:
+ * None
+*/
+
+
+
+#include <iostream.h>
+
+#define __EXECUTABLE__
+#define EARLY_TEMPLATE
+#define DEBUG_MAIN
+#define DEBUG
+#include "debug.hh"
+#include "template_inst.hh"
+
+#include "raslib/rmdebug.hh"
+#include "qlparser/qtscalardata.hh"
+
+#include "servercomm/servercomm.hh"
+
+
+extern char* myExecArgv0 = "";
+extern int tiling = 1;
+extern unsigned long maxTransferBufferSize = 4000000;
+extern int globalOptimizationLevel = 4;
+extern char* dbSchema = 0;
+extern int noTimeOut = 0;
+char globalConnectId[255] = {0};
+bool udfEnabled = true;
+
+RMINITGLOBALS('C');
+
+#include <signal.h>
+
+
+int checkArguments( int argc, char** argv, const char* searchText, int& optionValueIndex )
+{
+ int found = 0;
+ int i=1;
+
+ while( !found && i<argc )
+ found = !strcmp( searchText, argv[i++] );
+
+ if( found && i<argc && !strchr(argv[i],'-') )
+ optionValueIndex = i;
+ else
+ optionValueIndex = 0;
+
+ return found;
+}
+
+
+int main( int argc, char** argv )
+{
+ strcpy(globalConnectId, "tcp:postgresql://localhost:5432/RASBASE");
+
+ ServerComm server(300, 120, 7013, "rasmgr", 7001, "N1");
+ ExecuteQueryRes result;
+
+ DatabaseIf database;
+ TransactionIf ta;
+ AdminIf* myAdmin = AdminIf::instance();
+ database.open( "RASSERVICE");
+ ta.begin( &database );
+
+ ServerComm::ClientTblElt *r = new ServerComm::ClientTblElt("testclient", 2);
+
+ server.addClientTblEntry (r);
+
+ accessControl.setServerName("NT1");
+ accessControl.crunchCapability("$I1$ER.$BRASBASE$T1:3:2008:23:39:24$NNT1$D983893f406445a922cba0301bc5a85ec$K");
+ server.openDB(2, "RASBASE", "costea");
+ SET_OUTPUT(TRUE);
+
+ char *buff = new char[1000];
+ unsigned int size;
+
+ QtScalarData* t;
+
+ try
+ {
+ server.executeQuery(2, "SELECT a from RAS_COLLECTIONNAMES as a", result );
+ vector<QtData*>::iterator i;
+ /* for (i=r->transferData->begin(); i!=r->transferData->end(); ++i) {
+ // t = (QtScalarData*)(*i);
+ // t->printStatus();
+ }*/
+ }
+ catch ( r_Error& errorObj )
+ {
+ cerr << errorObj.what() << endl;
+ return -1;
+ }
+ catch ( ... )
+ {
+ cerr << "Unknown exception caught in main." << endl;
+ return -1;
+ }
+
+ return 0;
+}