summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-03-10 18:11:26 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-03-10 18:11:26 +0100
commit0baa07d101186118e89219bdfd33baf1aeb39bc4 (patch)
tree607e57b47105ce65e5b499c30f0058a54ead0322 /cpp/test
parentFixed ICE-7662 - Use System.Action & System.Func classes (diff)
downloadice-0baa07d101186118e89219bdfd33baf1aeb39bc4.tar.bz2
ice-0baa07d101186118e89219bdfd33baf1aeb39bc4.tar.xz
ice-0baa07d101186118e89219bdfd33baf1aeb39bc4.zip
Fixed ICE-6792 - Added support for connectionCached/locatorCacheTimeout QoS settings
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/IceStorm/single/Publisher.cpp1
-rw-r--r--cpp/test/IceStorm/single/Subscriber.cpp24
2 files changed, 22 insertions, 3 deletions
diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp
index 624829c2a05..150abd052ec 100644
--- a/cpp/test/IceStorm/single/Publisher.cpp
+++ b/cpp/test/IceStorm/single/Publisher.cpp
@@ -46,7 +46,6 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
}
assert(topic);
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp
index 07068a99852..54fc4e71f43 100644
--- a/cpp/test/IceStorm/single/Subscriber.cpp
+++ b/cpp/test/IceStorm/single/Subscriber.cpp
@@ -53,6 +53,10 @@ public:
test(false);
}
Lock sync(*this);
+ if(_name == "per-request load balancing")
+ {
+ _connections.insert(current.con);
+ }
++_last;
if(++_count == 1000)
{
@@ -64,7 +68,7 @@ public:
waitForEvents()
{
Lock sync(*this);
- cout << "testing " << _name << " reliability... " << flush;
+ cout << "testing " << _name << " ... " << flush;
bool datagram = _name == "datagram" || _name == "batch datagram";
IceUtil::Time timeout = (datagram) ? IceUtil::Time::seconds(5) : IceUtil::Time::seconds(20);
while(_count < 1000)
@@ -89,6 +93,10 @@ public:
}
}
}
+ if(_name == "per-request load balancing")
+ {
+ test(_connections.size() == 2);
+ }
cout << "ok" << endl;
}
@@ -98,6 +106,7 @@ private:
const string _name;
int _count;
int _last;
+ set<Ice::ConnectionPtr> _connections;
};
typedef IceUtil::Handle<SingleI> SingleIPtr;
@@ -121,7 +130,8 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
return EXIT_FAILURE;
}
- ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:udp");
+ // Use 2 default endpoints to test per-request load balancing
+ ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:default:udp");
//
// Test topic name that is too long
@@ -203,6 +213,16 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
subscriberIdentities.push_back(object->ice_getIdentity());
topic->subscribeAndGetPublisher(qos, object);
}
+
+ {
+ subscribers.push_back(new SingleI(communicator, "per-request load balancing"));
+ IceStorm::QoS qos;
+ qos["locatorCacheTimeout"] = "10";
+ qos["connectionCached"] = "0";
+ Ice::ObjectPrx object = adapter->addWithUUID(subscribers.back());
+ subscriberIdentities.push_back(object->ice_getIdentity());
+ topic->subscribeAndGetPublisher(qos, object);
+ }
{
// Use a separate adapter to ensure a separate connection is used for the subscriber
// (otherwise, if multiple UDP subscribers use the same connection we might get high