diff options
Diffstat (limited to 'cpp/demo/Freeze/backup/Client.cpp')
-rw-r--r-- | cpp/demo/Freeze/backup/Client.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/cpp/demo/Freeze/backup/Client.cpp b/cpp/demo/Freeze/backup/Client.cpp deleted file mode 100644 index 23915431ce7..00000000000 --- a/cpp/demo/Freeze/backup/Client.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <IceUtil/IceUtil.h> -#include <Freeze/Freeze.h> -#include <IntLongMap.h> - -using namespace std; - -static void -testFailed(const char* expr, const char* file, unsigned int line) -{ - cout << "failed!" << endl; - cout << file << ':' << line << ": assertion `" << expr << "' failed" << endl; - abort(); -} - -#define test(ex) ((ex) ? ((void)0) : testFailed(#ex, __FILE__, __LINE__)) - -int -main(int argc, char* argv[]) -{ - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - initData.properties->load("config"); - - Ice::CommunicatorPtr communicator = Ice::initialize(argc, argv, initData); - if(argc > 1) - { - cerr << argv[0] << ": too many arguments" << endl; - return EXIT_FAILURE; - } - - Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, "backup"); - IntLongMap m(connection, "IntLongMap", true); - - const int size = 10000; - - if(m.size() == 0) - { - cout << "********* Creating new map ***********" << endl; - Freeze::TransactionHolder txHolder(connection); - - IceUtil::Time time = IceUtil::Time::now(); - IceUtil::Int64 ms = time.toMilliSeconds(); - - for(int i = 0; i < size; ++i) - { - m.insert(IntLongMap::value_type(i, ms)); - } - txHolder.commit(); - } - - cout << "Updating map" << endl; - - for(;;) - { - int count = 0; - - Freeze::TransactionHolder txHolder(connection); - IceUtil::Time time = IceUtil::Time::now(); - IceUtil::Int64 ms = time.toMilliSeconds(); - - IntLongMap::iterator p = m.begin(); - IceUtil::Int64 oldMs = p->second; - do - { - if(p->second != oldMs) - { - cerr << "old time (ms) == " << oldMs << endl; - cerr << "current current (ms) == " << p->second << endl; - } - - test(p->second == oldMs); - p.set(ms); - count++; - } while(++p != m.end()); - - cout << "Read " << IceUtil::Time::milliSeconds(oldMs).toDateTime() << " in all records;" - << " updating with " << time.toDateTime() << " ... " << flush; - - txHolder.commit(); - cout << "done" << endl; - test(count == size); - } - - // - // Since above loop never exits this code is unreachable and causes - // warnings with some compilers. - // - //connection->close(); - //communicator->destroy(); - // - //return EXIT_SUCCESS; -} |