summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-08-27 18:54:22 +0000
committerMark Spruiell <mes@zeroc.com>2002-08-27 18:54:22 +0000
commit3da21da286efccfe217d80ba05bc3fd11e44eb70 (patch)
treed585b2b65d8bae82355a6d1ec579b2aa4d3d5359 /cpp
parentuse XML as default for freeze dictionaries (diff)
downloadice-3da21da286efccfe217d80ba05bc3fd11e44eb70.tar.bz2
ice-3da21da286efccfe217d80ba05bc3fd11e44eb70.tar.xz
ice-3da21da286efccfe217d80ba05bc3fd11e44eb70.zip
test both XML and binary encodings
Diffstat (limited to 'cpp')
-rw-r--r--cpp/test/Freeze/dbmap/.depend4
-rw-r--r--cpp/test/Freeze/dbmap/Client.cpp235
-rw-r--r--cpp/test/Freeze/dbmap/Makefile18
-rw-r--r--cpp/test/Freeze/dbmap/dbmap.dsp73
-rw-r--r--cpp/test/Freeze/dbmap/dummy.ice0
5 files changed, 192 insertions, 138 deletions
diff --git a/cpp/test/Freeze/dbmap/.depend b/cpp/test/Freeze/dbmap/.depend
index ef487713b70..a53df470cfd 100644
--- a/cpp/test/Freeze/dbmap/.depend
+++ b/cpp/test/Freeze/dbmap/.depend
@@ -1 +1,3 @@
-Client.o: Client.cpp ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h ../../../include/IceXML/StreamI.h ../../../include/Ice/Stream.h ../../../include/IceUtil/OutputUtil.h ../../include/TestCommon.h
+Client.o: Client.cpp ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h ../../include/TestCommon.h ByteIntMapXML.h ByteIntMapBinary.h
+ByteIntMapXML.o: ByteIntMapXML.cpp ../../../include/IceXML/StreamI.h ../../../include/Ice/Stream.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/CommunicatorF.h ../../../include/IceUtil/OutputUtil.h ByteIntMapXML.h ../../../include/Freeze/Map.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h
+ByteIntMapBinary.o: ByteIntMapBinary.cpp ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ByteIntMapBinary.h ../../../include/Freeze/Map.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h
diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp
index a8cd760e550..c20729156c1 100644
--- a/cpp/test/Freeze/dbmap/Client.cpp
+++ b/cpp/test/Freeze/dbmap/Client.cpp
@@ -9,8 +9,9 @@
// **********************************************************************
#include <Freeze/Freeze.h>
-#include <IceXML/StreamI.h>
#include <TestCommon.h>
+#include <ByteIntMapXML.h>
+#include <ByteIntMapBinary.h>
#include <algorithm>
@@ -18,114 +19,56 @@ using namespace std;
using namespace Ice;
using namespace Freeze;
-class KeyCodec
-{
-public:
-
- typedef char value_type;
-
- static void
- write(const char& key, Freeze::Key& bytes, const ::Ice::CommunicatorPtr& communicator)
- {
- ostringstream os;
- os << "<data>";
- Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, os);
- stream->writeByte("Key", key);
- os << "</data>";
- bytes.resize(os.str().size());
- memcpy(&bytes[0], os.str().data(), os.str().size());
- }
-
- static void
- read(char& key, const Freeze::Key& bytes, const ::Ice::CommunicatorPtr& communicator)
- {
- //
- // COMPILERFIX: string data(bytes.begin(), bytes.end());
- //
- // This won't link with STLport 4.5.3 stldebug version.
- //
- string data;
- data.assign(&bytes[0], bytes.size());
-
- istringstream is(data);
- Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, is, false);
- key = stream->readByte("Key");
- }
-};
+static Byte alphabetChars[] = "abcdefghijklmnopqrstuvwxyz";
+vector<Byte> alphabet;
-class ValueCodec
+static void
+ForEachTest(const pair<Byte, Int>&)
{
-public:
-
- typedef Ice::Int value_type;
-
- static void
- write(const Ice::Int& value, Freeze::Value& bytes, const ::Ice::CommunicatorPtr& communicator)
- {
- ostringstream os;
- os << "<data>";
- Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, os);
- stream->writeInt("Value", value);
- os << "</data>";
- bytes.resize(os.str().size());
- memcpy(&bytes[0], os.str().data(), os.str().size());
- }
-
- static void
- read(Ice::Int& value, const Freeze::Value& bytes, const ::Ice::CommunicatorPtr& communicator)
- {
- //
- // COMPILERFIX: string data(bytes.begin(), bytes.end());
- //
- // This won't link with STLport 4.5.3 stldebug version.
- //
- string data;
- data.assign(&bytes[0], bytes.size());
-
- istringstream is(data);
- Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, is, false);
- value = stream->readInt("Value");
- }
-};
+}
-typedef DBMap<char, int, KeyCodec, ValueCodec> CharIntMap;
+static bool
+FindIfTest(const pair<Byte, Int>& p)
+{
+ return p.first == 'b';
+}
-static char alphabetChars[] = "abcdefghijklmnopqrstuvwxyz";
-vector<char> alphabet;
+static bool
+FindFirstOfTest(const pair<Byte, Int>& p, Byte q)
+{
+ return p.first == q;
+}
+template<class MAP>
static void
-populateDB(CharIntMap& m)
+populateDB(MAP& m)
{
- alphabet.assign(alphabetChars, alphabetChars + sizeof(alphabetChars)-1);
+ alphabet.assign(alphabetChars, alphabetChars + sizeof(alphabetChars) - 1);
- for(vector<char>::const_iterator j = alphabet.begin() ; j != alphabet.end(); ++j)
+ for(vector<Byte>::const_iterator j = alphabet.begin(); j != alphabet.end(); ++j)
{
m.insert(make_pair(*j, j-alphabet.begin()));
}
}
+template<class MAP>
static int
-run(int argc, char* argv[], const DBPtr& db)
+run(int argc, char* argv[], MAP& m)
{
- CharIntMap m(db);
-
//
// Populate the database with the alphabet
//
populateDB(m);
- //char key;
- //int value;
+ vector<Byte>::const_iterator j;
+ typename MAP::iterator p;
+ typename MAP::iterator cp;
- vector<char>::const_iterator j;
- CharIntMap::iterator p;
- CharIntMap::const_iterator cp;
-
- cout << "testing populate... ";
+ cout << " testing populate... ";
//
// First try non-const iterator
//
- for(j = alphabet.begin() ; j != alphabet.end() ; ++j)
+ for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
p = m.find(*j);
test(p != m.end());
@@ -134,7 +77,7 @@ run(int argc, char* argv[], const DBPtr& db)
//
// Next try const iterator
//
- for(j = alphabet.begin() ; j != alphabet.end() ; ++j)
+ for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
cp = m.find(*j);
test(cp != m.end());
@@ -145,7 +88,7 @@ run(int argc, char* argv[], const DBPtr& db)
test(m.size() == alphabet.size());
cout << "ok" << endl;
- cout << "testing map::find... ";
+ cout << " testing map::find... ";
j = find(alphabet.begin(), alphabet.end(), 'n');
cp = m.find(*j);
@@ -153,7 +96,7 @@ run(int argc, char* argv[], const DBPtr& db)
test(cp->first == 'n' && cp->second == j - alphabet.begin());
cout << "ok" << endl;
- cout << "testing erase... ";
+ cout << " testing erase... ";
//
// erase first offset characters (first offset characters is
@@ -161,23 +104,23 @@ run(int argc, char* argv[], const DBPtr& db)
// the map).
//
int offset = 3;
- vector<char> chars;
- chars.push_back('a');
- chars.push_back('b');
- chars.push_back('c');
- for(j = chars.begin(); j != chars.end(); ++j)
+ vector<Byte> bytes;
+ bytes.push_back('a');
+ bytes.push_back('b');
+ bytes.push_back('c');
+ for(j = bytes.begin(); j != bytes.end(); ++j)
{
p = m.find(*j);
test(p != m.end());
m.erase(p);
p = m.find(*j);
test(p == m.end());
- vector<char>::iterator r = find(alphabet.begin(), alphabet.end(), *j);
+ vector<Byte>::iterator r = find(alphabet.begin(), alphabet.end(), *j);
test(r != alphabet.end());
alphabet.erase(r);
}
- for(j = alphabet.begin() ; j != alphabet.end() ; ++j)
+ for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
cp = m.find(*j);
test(cp != m.end());
@@ -187,16 +130,16 @@ run(int argc, char* argv[], const DBPtr& db)
cout << "ok" << endl;
//
- // Get a iterator for the deleted element - this should fail.
+ // Get an iterator for the deleted element - this should fail.
//
- cout << "testing map::find (again)... ";
+ cout << " testing map::find (again)... ";
cp = m.find('a');
test(cp == m.end());
cout << "ok" << endl;
- cout << "testing iterators... ";
+ cout << " testing iterators... ";
p = m.begin();
- CharIntMap::iterator p2 = p;
+ typename MAP::iterator p2 = p;
//
// Verify both iterators point at the same element, and that
@@ -230,7 +173,7 @@ run(int argc, char* argv[], const DBPtr& db)
// Verify cloned cursors are independent
//
test(p->first != 'n' && p->second != 13);
- pair<char, int> data = *p;
+ pair<Byte, Int> data = *p;
++p;
test(p->first != data.first && p->second != data.second);
@@ -252,18 +195,28 @@ run(int argc, char* argv[], const DBPtr& db)
//
// Test writing into an iterator.
//
- cout << "testing iterator.set... ";
+ cout << " testing iterator.set... ";
p = m.find('d');
test(p != m.end() && p->second == 3);
test(m.find('a') == m.end());
- m.insert(CharIntMap::value_type('a', 1));
+ typename MAP::value_type i1('a', 1);
+ m.insert(i1);
+ //
+ // Note: VC++ won't accept this
+ //
+ //m.insert(typename MAP::value_type('a', 1));
p = m.find('a');
test(p != m.end() && p->second == 1);
- m.insert(CharIntMap::value_type('a', 0));
+ typename MAP::value_type i2('a', 0);
+ m.insert(i2);
+ //
+ // Note: VC++ won't accept this
+ //
+ //m.insert(typename MAP::value_type('a', 0));
p = m.find('a');
test(p != m.end() && p->second == 0);
@@ -280,16 +233,15 @@ run(int argc, char* argv[], const DBPtr& db)
//
populateDB(m);
- cout << "testing algorithms... ";
+ cout << " testing algorithms... ";
- void ForEachTest(const CharIntMap::value_type&);
for_each(m.begin(), m.end(), ForEachTest);
//
// Inefficient, but this is just a test. Ensure that both forms of
// operator== & != are tested.
//
- CharIntMap::value_type toFind('n', 13);
+ typename MAP::value_type toFind('n', 13);
p = find(m.begin(), m.end(), toFind);
test(p != m.end());
@@ -298,8 +250,6 @@ run(int argc, char* argv[], const DBPtr& db)
test(!(*p != toFind));
test(!(toFind != *p));
-
- bool FindIfTest(const CharIntMap::value_type&);
p = find_if(m.begin(), m.end(), FindIfTest);
test(p->first == 'b');
@@ -310,7 +260,7 @@ run(int argc, char* argv[], const DBPtr& db)
// order).
//
j = find(alphabet.begin(), alphabet.end(), 'n');
- vector< pair <char, int> > pairs;
+ vector< pair <Byte, Int> > pairs;
pairs.push_back(make_pair(*j, j - alphabet.begin()));
++j;
pairs.push_back(make_pair(*j, j - alphabet.begin()));
@@ -324,7 +274,6 @@ run(int argc, char* argv[], const DBPtr& db)
test(p->first == 'n' || p->first == 'o' || p->first == 'p' || p->first == 'q');
j = find(alphabet.begin(), alphabet.end(), 'n');
- bool FindFirstOfTest(const CharIntMap::value_type& p, char q);
p = find_first_of(m.begin(), m.end(), j, j + 4, FindFirstOfTest);
test(p != m.end());
test(p->first == 'n' || p->first == 'o' || p->first == 'p' || p->first == 'q');
@@ -333,8 +282,8 @@ run(int argc, char* argv[], const DBPtr& db)
copy(m.begin(), m.end(), back_inserter(pairs));
test(pairs.size() == m.size());
- vector<pair<char, int> >::const_iterator pit;
- for(pit = pairs.begin() ; pit != pairs.end() ; ++pit)
+ vector<pair<Byte, Int> >::const_iterator pit;
+ for(pit = pairs.begin(); pit != pairs.end(); ++pit)
{
p = m.find(pit->first);
test(p != m.end());
@@ -344,23 +293,6 @@ run(int argc, char* argv[], const DBPtr& db)
return EXIT_SUCCESS;
}
-void
-ForEachTest(const CharIntMap::value_type&)
-{
-}
-
-bool
-FindIfTest(const CharIntMap::value_type& p)
-{
- return p.first == 'b';
-}
-
-bool
-FindFirstOfTest(const CharIntMap::value_type& p, char q)
-{
- return p.first == q;
-}
-
int
main(int argc, char* argv[])
{
@@ -368,7 +300,7 @@ main(int argc, char* argv[])
Ice::CommunicatorPtr communicator;
DBEnvironmentPtr dbEnv;
string dbEnvDir = "db";
- DBPtr db;
+ DBPtr xmlDB, binaryDB;
try
{
@@ -380,8 +312,17 @@ main(int argc, char* argv[])
dbEnvDir += "db";
}
dbEnv = Freeze::initialize(communicator, dbEnvDir);
- db = dbEnv->openDB("test", true);
- status = run(argc, argv, db);
+ xmlDB = dbEnv->openDB("xml", true);
+ ByteIntMapXML xml(xmlDB);
+ cout << "testing XML encoding..." << endl;
+ status = run(argc, argv, xml);
+ if(status == EXIT_SUCCESS)
+ {
+ binaryDB = dbEnv->openDB("binary", true);
+ ByteIntMapBinary binary(binaryDB);
+ cout << "testing binary encoding..." << endl;
+ status = run(argc, argv, binary);
+ }
}
catch(const Ice::Exception& ex)
{
@@ -389,11 +330,35 @@ main(int argc, char* argv[])
status = EXIT_FAILURE;
}
- if(db)
+ if(xmlDB)
+ {
+ try
+ {
+ xmlDB->close();
+ }
+ catch(const DBException& ex)
+ {
+ cerr << argv[0] << ": " << ex << ": " << ex.message << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const Exception& ex)
+ {
+ cerr << argv[0] << ": " << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(...)
+ {
+ cerr << argv[0] << ": unknown exception" << endl;
+ status = EXIT_FAILURE;
+ }
+ xmlDB = 0;
+ }
+
+ if(binaryDB)
{
try
{
- db->close();
+ binaryDB->close();
}
catch(const DBException& ex)
{
@@ -410,7 +375,7 @@ main(int argc, char* argv[])
cerr << argv[0] << ": unknown exception" << endl;
status = EXIT_FAILURE;
}
- db = 0;
+ binaryDB = 0;
}
if(dbEnv)
diff --git a/cpp/test/Freeze/dbmap/Makefile b/cpp/test/Freeze/dbmap/Makefile
index ac7b3b9d3de..95722b4aeef 100644
--- a/cpp/test/Freeze/dbmap/Makefile
+++ b/cpp/test/Freeze/dbmap/Makefile
@@ -14,7 +14,9 @@ CLIENT = client
TARGETS = $(CLIENT)
-OBJS = Client.o
+OBJS = Client.o \
+ ByteIntMapXML.o \
+ ByteIntMapBinary.o
SRCS = $(OBJS:.o=.cpp)
@@ -25,6 +27,18 @@ LDFLAGS := $(LDFLAGS) -L$(DB_HOME)/lib
$(CLIENT): $(OBJS)
rm -f $@
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lIceXML -lFreeze $(LIBS) -ldb
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lFreeze -lIceXML $(LIBS) -ldb
+
+ByteIntMapXML.h ByteIntMapXML.cpp: $(SLICE2FREEZE)
+ rm -f ByteIntMapXML.h ByteIntMapXML.cpp
+ $(SLICE2FREEZE) --dict ByteIntMapXML,byte,int ByteIntMapXML
+
+ByteIntMapBinary.h ByteIntMapBinary.cpp: $(SLICE2FREEZE)
+ rm -f ByteIntMapBinary.h ByteIntMapBinary.cpp
+ $(SLICE2FREEZE) --binary --dict ByteIntMapBinary,byte,int ByteIntMapBinary
+
+clean::
+ rm -f ByteIntMapXML.h ByteIntMapXML.cpp
+ rm -f ByteIntMapBinary.h ByteIntMapBinary.cpp
include .depend
diff --git a/cpp/test/Freeze/dbmap/dbmap.dsp b/cpp/test/Freeze/dbmap/dbmap.dsp
index f21dc21e2c8..890bbb4e3c6 100644
--- a/cpp/test/Freeze/dbmap/dbmap.dsp
+++ b/cpp/test/Freeze/dbmap/dbmap.dsp
@@ -91,16 +91,89 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\ByteIntMapBinary.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ByteIntMapXML.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Client.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\ByteIntMapBinary.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ByteIntMapXML.h
+# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=dummy.ice
+
+!IF "$(CFG)" == "dbmap - Win32 Release"
+
+USERDEP__DUMMY="..\..\..\bin\slice2freeze.exe"
+# Begin Custom Build
+InputPath=dummy.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2freeze.exe --dict ByteIntMapXML,byte,int ByteIntMapXML \
+ ..\..\..\bin\slice2freeze.exe --binary --dict ByteIntMapBinary,byte,int ByteIntMapBinary \
+
+
+"ByteIntMapXML.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapXML.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapBinary.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapBinary.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "dbmap - Win32 Debug"
+
+USERDEP__DUMMY="..\..\..\bin\slice2freeze.exe"
+# Begin Custom Build
+InputPath=dummy.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2freeze.exe --dict ByteIntMapXML,byte,int ByteIntMapXML \
+ ..\..\..\bin\slice2freeze.exe --binary --dict ByteIntMapBinary,byte,int ByteIntMapBinary \
+
+
+"ByteIntMapXML.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapXML.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapBinary.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"ByteIntMapBinary.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
# End Group
# End Target
# End Project
diff --git a/cpp/test/Freeze/dbmap/dummy.ice b/cpp/test/Freeze/dbmap/dummy.ice
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/cpp/test/Freeze/dbmap/dummy.ice