summaryrefslogtreecommitdiff
path: root/cpp/test/IceStorm/federation2/Publisher.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-02-29 15:51:11 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-02-29 16:39:54 +0800
commitfb4132881dde7c9b135d713a06a3b64db1f706db (patch)
tree8a037e9d4cae7ed15360ab0878d14b32ac3150a4 /cpp/test/IceStorm/federation2/Publisher.cpp
parentfixing mode on php/config/Make.rules.mak (diff)
downloadice-fb4132881dde7c9b135d713a06a3b64db1f706db.tar.bz2
ice-fb4132881dde7c9b135d713a06a3b64db1f706db.tar.xz
ice-fb4132881dde7c9b135d713a06a3b64db1f706db.zip
Merge HA IceStorm branch.
- http://bugzilla/bugzilla/show_bug.cgi?id=2706 - http://bugzilla/bugzilla/show_bug.cgi?id=2705
Diffstat (limited to 'cpp/test/IceStorm/federation2/Publisher.cpp')
-rw-r--r--cpp/test/IceStorm/federation2/Publisher.cpp47
1 files changed, 39 insertions, 8 deletions
diff --git a/cpp/test/IceStorm/federation2/Publisher.cpp b/cpp/test/IceStorm/federation2/Publisher.cpp
index c53ce9f1ce9..7a8fdc4b3ba 100644
--- a/cpp/test/IceStorm/federation2/Publisher.cpp
+++ b/cpp/test/IceStorm/federation2/Publisher.cpp
@@ -7,6 +7,8 @@
//
// **********************************************************************
+#include <IceUtil/IceUtil.h>
+#include <IceUtil/Options.h>
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
#include <Event.h>
@@ -19,8 +21,21 @@ using namespace Test;
int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
+ IceUtilInternal::Options opts;
+ opts.addOpt("", "count", IceUtilInternal::Options::NeedArg);
+
+ try
+ {
+ opts.parse(argc, (const char**)argv);
+ }
+ catch(const IceUtilInternal::BadOptException& e)
+ {
+ cerr << argv[0] << ": " << e.reason << endl;
+ return EXIT_FAILURE;
+ }
+
PropertiesPtr properties = communicator->getProperties();
- const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
+ const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
@@ -50,16 +65,32 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway());
- for(int i = 0; i < 10; ++i)
+ string arg = opts.optArg("count");
+ int count = 1;
+ if(arg.empty())
{
- eventFed1->pub("fed1");
+ count = atoi(arg.c_str());
}
+
+ while(true)
+ {
+ for(int i = 0; i < 10; ++i)
+ {
+ eventFed1->pub("fed1");
+ }
+ //
+ // Before we exit, we ping all proxies as twoway, to make sure
+ // that all oneways are delivered.
+ //
+ EventPrx::uncheckedCast(eventFed1->ice_twoway())->ice_ping();
- //
- // Before we exit, we ping all proxies as twoway, to make sure
- // that all oneways are delivered.
- //
- EventPrx::uncheckedCast(eventFed1->ice_twoway())->ice_ping();
+ if(count == 0)
+ {
+ break;
+ }
+ --count;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
+ }
return EXIT_SUCCESS;
}