summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/timeout
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/timeout')
-rw-r--r--cpp/test/Ice/timeout/AllTests.cpp462
-rw-r--r--cpp/test/Ice/timeout/Client.cpp52
-rw-r--r--cpp/test/Ice/timeout/Server.cpp38
-rw-r--r--cpp/test/Ice/timeout/TestI.cpp6
4 files changed, 279 insertions, 279 deletions
diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp
index 71af9e97b60..694604304f9 100644
--- a/cpp/test/Ice/timeout/AllTests.cpp
+++ b/cpp/test/Ice/timeout/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -62,12 +62,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
typedef IceUtil::Handle<AMISendData> AMISendDataPtr;
@@ -78,13 +78,13 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const Ice::TimeoutException*>(&ex));
- called();
+ test(dynamic_cast<const Ice::TimeoutException*>(&ex));
+ called();
}
};
typedef IceUtil::Handle<AMISendDataEx> AMISendDataExPtr;
@@ -95,12 +95,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
typedef IceUtil::Handle<AMISleep> AMISleepPtr;
@@ -111,13 +111,13 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const Ice::TimeoutException*>(&ex));
- called();
+ test(dynamic_cast<const Ice::TimeoutException*>(&ex));
+ called();
}
};
typedef IceUtil::Handle<AMISleepEx> AMISleepExPtr;
@@ -134,249 +134,249 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing connect timeout... " << flush;
{
- //
- // Expect ConnectTimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(750);
- to->ice_getConnection()->close(true); // Force a reconnect.
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect ConnectTimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(750);
+ to->ice_getConnection()->close(true); // Force a reconnect.
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- to->ice_getConnection()->close(true); // Force a reconnect.
- try
- {
- to->op();
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ to->ice_getConnection()->close(true); // Force a reconnect.
+ try
+ {
+ to->op();
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing read timeout... " << flush;
{
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- try
- {
- to->sleep(500);
- }
- catch(const Ice::TimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ try
+ {
+ to->sleep(500);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing write timeout... " << flush;
{
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(750);
- try
- {
- ByteSeq seq(100000);
- to->sendData(seq);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(750);
+ try
+ {
+ ByteSeq seq(100000);
+ to->sendData(seq);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- try
- {
- ByteSeq seq(100000);
- to->sendData(seq);
- }
- catch(const Ice::TimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ try
+ {
+ ByteSeq seq(100000);
+ to->sendData(seq);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing AMI read timeout... " << flush;
{
- //
- // The resolution of AMI timeouts is limited by the connection monitor
- // thread. We set Ice.MonitorConnections=1 (one second) in main().
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- AMISleepExPtr cb = new AMISleepEx;
- to->sleep_async(cb, 2000);
- test(cb->check());
+ //
+ // The resolution of AMI timeouts is limited by the connection monitor
+ // thread. We set Ice.MonitorConnections=1 (one second) in main().
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ AMISleepExPtr cb = new AMISleepEx;
+ to->sleep_async(cb, 2000);
+ test(cb->check());
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- AMISleepPtr cb = new AMISleep;
- to->sleep_async(cb, 500);
- test(cb->check());
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ AMISleepPtr cb = new AMISleep;
+ to->sleep_async(cb, 500);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "testing AMI write timeout... " << flush;
{
- //
- // The resolution of AMI timeouts is limited by the connection monitor
- // thread. We set Ice.MonitorConnections=1 (one second) in main().
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(2000);
- ByteSeq seq(100000);
- AMISendDataExPtr cb = new AMISendDataEx;
- to->sendData_async(cb, seq);
- test(cb->check());
+ //
+ // The resolution of AMI timeouts is limited by the connection monitor
+ // thread. We set Ice.MonitorConnections=1 (one second) in main().
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(2000);
+ ByteSeq seq(100000);
+ AMISendDataExPtr cb = new AMISendDataEx;
+ to->sendData_async(cb, seq);
+ test(cb->check());
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- ByteSeq seq(100000);
- AMISendDataPtr cb = new AMISendData;
- to->sendData_async(cb, seq);
- test(cb->check());
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ ByteSeq seq(100000);
+ AMISendDataPtr cb = new AMISendData;
+ to->sendData_async(cb, seq);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "testing timeout overrides... " << flush;
{
- //
- // Test Ice.Override.Timeout. This property overrides all
- // endpoint timeouts.
- //
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.Override.Timeout", "500");
- Ice::CommunicatorPtr comm = Ice::initialize(initData);
- TimeoutPrx to = TimeoutPrx::checkedCast(comm->stringToProxy(sref));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- //
- // Calling ice_timeout() should have no effect.
- //
- timeout->op(); // Ensure adapter is active.
- to = TimeoutPrx::checkedCast(to->ice_timeout(1000));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- comm->destroy();
+ //
+ // Test Ice.Override.Timeout. This property overrides all
+ // endpoint timeouts.
+ //
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.Override.Timeout", "500");
+ Ice::CommunicatorPtr comm = Ice::initialize(initData);
+ TimeoutPrx to = TimeoutPrx::checkedCast(comm->stringToProxy(sref));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect.
+ //
+ timeout->op(); // Ensure adapter is active.
+ to = TimeoutPrx::checkedCast(to->ice_timeout(1000));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ comm->destroy();
}
{
- //
- // Test Ice.Override.ConnectTimeout.
- //
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.Override.ConnectTimeout", "750");
- Ice::CommunicatorPtr comm = Ice::initialize(initData);
- timeout->holdAdapter(1000);
- TimeoutPrx to = TimeoutPrx::uncheckedCast(comm->stringToProxy(sref));
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
- //
- // Calling ice_timeout() should have no effect on the connect timeout.
- //
- timeout->op(); // Ensure adapter is active.
- timeout->holdAdapter(1000);
- to = TimeoutPrx::uncheckedCast(to->ice_timeout(1250));
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
- //
- // Verify that timeout set via ice_timeout() is still used for requests.
- //
- to->op(); // Force connection.
- try
- {
- to->sleep(1500);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- comm->destroy();
+ //
+ // Test Ice.Override.ConnectTimeout.
+ //
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.Override.ConnectTimeout", "750");
+ Ice::CommunicatorPtr comm = Ice::initialize(initData);
+ timeout->holdAdapter(1000);
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(comm->stringToProxy(sref));
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect on the connect timeout.
+ //
+ timeout->op(); // Ensure adapter is active.
+ timeout->holdAdapter(1000);
+ to = TimeoutPrx::uncheckedCast(to->ice_timeout(1250));
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Verify that timeout set via ice_timeout() is still used for requests.
+ //
+ to->op(); // Force connection.
+ try
+ {
+ to->sleep(1500);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ comm->destroy();
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/timeout/Client.cpp b/cpp/test/Ice/timeout/Client.cpp
index fef4d9c797e..b3c9c744c72 100644
--- a/cpp/test/Ice/timeout/Client.cpp
+++ b/cpp/test/Ice/timeout/Client.cpp
@@ -31,44 +31,44 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // For this test, we want to disable retries.
- //
- initData.properties->setProperty("Ice.RetryIntervals", "-1");
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties->setProperty("Ice.RetryIntervals", "-1");
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- //
- // Check for AMI timeouts every second.
- //
- initData.properties->setProperty("Ice.MonitorConnections", "1");
+ //
+ // Check for AMI timeouts every second.
+ //
+ initData.properties->setProperty("Ice.MonitorConnections", "1");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/timeout/Server.cpp b/cpp/test/Ice/timeout/Server.cpp
index bed1e7aeeaf..cd1d2159c86 100644
--- a/cpp/test/Ice/timeout/Server.cpp
+++ b/cpp/test/Ice/timeout/Server.cpp
@@ -32,34 +32,34 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/timeout/TestI.cpp b/cpp/test/Ice/timeout/TestI.cpp
index 23356bfb4a8..b69ac089a70 100644
--- a/cpp/test/Ice/timeout/TestI.cpp
+++ b/cpp/test/Ice/timeout/TestI.cpp
@@ -19,15 +19,15 @@ class ActivateAdapterThread : public IceUtil::Thread
public:
ActivateAdapterThread(const ObjectAdapterPtr& adapter, int timeout) :
- _adapter(adapter), _timeout(timeout)
+ _adapter(adapter), _timeout(timeout)
{
}
virtual void
run()
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));
- _adapter->activate();
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));
+ _adapter->activate();
}
private: