diff options
author | Matthew Newhook <matthew@zeroc.com> | 2007-01-31 05:20:18 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2007-01-31 05:20:18 +0000 |
commit | aee8b7cff90d42cd1151ec9911e490b0de553dd5 (patch) | |
tree | 75b49c8837bb98683d9451c5c9edc4427e22924c /cpp/test/IceStorm/single/Subscriber.cpp | |
parent | updated README. (diff) | |
download | ice-aee8b7cff90d42cd1151ec9911e490b0de553dd5.tar.bz2 ice-aee8b7cff90d42cd1151ec9911e490b0de553dd5.tar.xz ice-aee8b7cff90d42cd1151ec9911e490b0de553dd5.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1690,
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1711
Diffstat (limited to 'cpp/test/IceStorm/single/Subscriber.cpp')
-rw-r--r-- | cpp/test/IceStorm/single/Subscriber.cpp | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp index c0c8e1b4f93..b1857119707 100644 --- a/cpp/test/IceStorm/single/Subscriber.cpp +++ b/cpp/test/IceStorm/single/Subscriber.cpp @@ -34,7 +34,8 @@ public: event(int i, const Current& current) { - if((_name == "default" || _name == "oneway" || _name == "batch") && current.requestId != 0) + if((_name == "default" || _name == "oneway" || _name == "batch" || _name == "datagram" || + _name == "batch datagram") && current.requestId != 0) { cerr << endl << "expected oneway request"; test(false); @@ -48,6 +49,11 @@ public: cerr << endl << "received unordered event for `" << _name << "': " << i << " " << _last; test(false); } + if((_name == "datagram" || _name == "batch datagram") && current.con->type() != "udp") + { + cerr << endl << "expected datagram to be received over udp"; + test(false); + } Lock sync(*this); ++_last; if(++_count == 1000) @@ -61,11 +67,28 @@ public: { Lock sync(*this); cout << "testing " << _name << " reliability... " << flush; + bool datagram = _name == "datagram" || _name == "batch datagram"; + IceUtil::Time timeout = (datagram) ? IceUtil::Time::seconds(5) : IceUtil::Time::seconds(20); while(_count < 1000) { - if(!timedWait(IceUtil::Time::seconds(20))) + if(!timedWait(timeout)) { - test(false); + if(datagram && _count > 0) + { + if(_count < 100) + { + cout << "[" << _count << "/1000: This may be an error!!]"; + } + else + { + cout << "[" << _count << "/1000] "; + } + break; + } + else + { + test(false); + } } } cout << "ok" << endl; @@ -101,7 +124,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) return EXIT_FAILURE; } - ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default"); + ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:udp"); TopicPrx topic; try @@ -149,6 +172,18 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) qos["reliability"] = "twoway ordered"; topic->subscribe(qos, adapter->addWithUUID(subscribers.back())); } + { + subscribers.push_back(new SingleI(communicator, "datagram")); + IceStorm::QoS qos; + qos["reliability"] = "oneway"; + topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + } + { + subscribers.push_back(new SingleI(communicator, "batch datagram")); + IceStorm::QoS qos; + qos["reliability"] = "batch"; + topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + } // // Next we use the new API call with the new proxy semantics. // @@ -174,6 +209,14 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) qos["reliability"] = "ordered"; topic->subscribeAndGetPublisher(qos, adapter->addWithUUID(subscribers.back())); } + { + subscribers.push_back(new SingleI(communicator, "datagram")); + topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + } + { + subscribers.push_back(new SingleI(communicator, "batch datagram")); + topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchDatagram()); + } adapter->activate(); |