summaryrefslogtreecommitdiff
path: root/cpp/test/IceGrid/activation
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/IceGrid/activation')
-rw-r--r--cpp/test/IceGrid/activation/AllTests.cpp844
-rw-r--r--cpp/test/IceGrid/activation/Client.cpp26
-rw-r--r--cpp/test/IceGrid/activation/Server.cpp8
3 files changed, 439 insertions, 439 deletions
diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp
index 26460fe700f..8777ab9cba7 100644
--- a/cpp/test/IceGrid/activation/AllTests.cpp
+++ b/cpp/test/IceGrid/activation/AllTests.cpp
@@ -23,14 +23,14 @@ waitForServerState(const IceGrid::AdminPrx& admin, const std::string& server, Ic
int nRetry = 0;
while(admin->getServerState(server) != state && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
if(admin->getServerState(server) != state)
{
- cerr << "server state change timed out:" << endl;
- cerr << "server: " << server << endl;
- cerr << "state: " << state << endl;
+ cerr << "server state change timed out:" << endl;
+ cerr << "server: " << server << endl;
+ cerr << "state: " << state << endl;
}
}
@@ -39,42 +39,42 @@ class PingThread : public IceUtil::Thread, IceUtil::Monitor<IceUtil::Mutex>
public:
PingThread(const Ice::ObjectPrx& proxy, int nRepetitions) :
- _proxy(proxy), _finished(false), _nRepetitions(nRepetitions)
+ _proxy(proxy), _finished(false), _nRepetitions(nRepetitions)
{
}
virtual void run()
{
- for(int i = 0; i < _nRepetitions; ++i)
- {
- try
- {
- _proxy->ice_ping();
- }
- catch(const Ice::LocalException& ex)
- {
- _exception.reset(dynamic_cast<Ice::LocalException*>(ex.ice_clone()));
- }
- catch(...)
- {
- assert(false);
- }
- }
-
- Lock sync(*this);
- _finished = true;
- notifyAll();
+ for(int i = 0; i < _nRepetitions; ++i)
+ {
+ try
+ {
+ _proxy->ice_ping();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ _exception.reset(dynamic_cast<Ice::LocalException*>(ex.ice_clone()));
+ }
+ catch(...)
+ {
+ assert(false);
+ }
+ }
+
+ Lock sync(*this);
+ _finished = true;
+ notifyAll();
}
auto_ptr<Ice::LocalException>
waitUntilFinished()
{
- Lock sync(*this);
- while(!_finished)
- {
- wait();
- }
- return _exception;
+ Lock sync(*this);
+ while(!_finished)
+ {
+ wait();
+ }
+ return _exception;
}
private:
@@ -91,7 +91,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -106,15 +106,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -155,220 +155,220 @@ allTests(const Ice::CommunicatorPtr& communicator)
int nRetry = 0;
while(!admin->pingNode("node-1") && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ ++nRetry;
}
nRetry = 0;
while(!admin->pingNode("node-2") && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ ++nRetry;
}
cout << "testing on-demand activation... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
- waitForServerState(admin, "server", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server", IceGrid::Inactive);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- waitForServerState(admin, "server", IceGrid::Inactive);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
+ waitForServerState(admin, "server", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server", IceGrid::Inactive);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ waitForServerState(admin, "server", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing manual activation... " << flush;
try
{
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- TestIntfPrx obj;
- try
- {
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->startServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
- test(admin->getServerState("server-manual") == IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-manual", IceGrid::Inactive);
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ TestIntfPrx obj;
+ try
+ {
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->startServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-manual", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing always activation... " << flush;
try
{
- waitForServerState(admin, "server-always", IceGrid::Active);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
- admin->stopServer("server-always");
- waitForServerState(admin, "server-always", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-always", IceGrid::Active);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- waitForServerState(admin, "server-always", IceGrid::Active);
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
+ admin->stopServer("server-always");
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ waitForServerState(admin, "server-always", IceGrid::Active);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing session activation... " << flush;
try
{
- IceGrid::SessionPrx session = registry->createSession("test", "");
-
- test(admin->getServerState("server-session") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-session"));
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- session->allocateObjectById(obj->ice_getIdentity());
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-session", IceGrid::Inactive);
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- session->releaseObject(obj->ice_getIdentity());
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- waitForServerState(admin, "server-session", IceGrid::Inactive);
-
- session->allocateObjectById(obj->ice_getIdentity());
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- session->destroy();
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- waitForServerState(admin, "server-session", IceGrid::Inactive);
+ IceGrid::SessionPrx session = registry->createSession("test", "");
+
+ test(admin->getServerState("server-session") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-session"));
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ session->allocateObjectById(obj->ice_getIdentity());
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ session->releaseObject(obj->ice_getIdentity());
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
+
+ session->allocateObjectById(obj->ice_getIdentity());
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ session->destroy();
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing server disable... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->enableServer("server", false);
- try
- {
- communicator->stringToProxy("server")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server") == IceGrid::Inactive);
-
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->enableServer("server-manual", false);
- try
- {
- communicator->stringToProxy("server-manual")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server-manual");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
-
- test(admin->getServerState("server-always") == IceGrid::Active);
- admin->enableServer("server-always", false);
- admin->stopServer("server-always");
- test(admin->getServerState("server-always") == IceGrid::Inactive);
- try
- {
- communicator->stringToProxy("server-always")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server-always");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-always") == IceGrid::Inactive);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->enableServer("server", false);
+ try
+ {
+ communicator->stringToProxy("server")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->enableServer("server-manual", false);
+ try
+ {
+ communicator->stringToProxy("server-manual")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-manual");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ admin->enableServer("server-always", false);
+ admin->stopServer("server-always");
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
+ try
+ {
+ communicator->stringToProxy("server-always")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-always");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -376,277 +376,277 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing server enable... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->enableServer("server", true);
- communicator->stringToProxy("server")->ice_ping();
- admin->stopServer("server");
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->startServer("server");
- test(admin->getServerState("server") == IceGrid::Active);
- admin->stopServer("server");
- test(admin->getServerState("server") == IceGrid::Inactive);
-
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->enableServer("server-manual", true);
- try
- {
- communicator->stringToProxy("server-manual")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->startServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Active);
- admin->stopServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
-
- test(admin->getServerState("server-always") == IceGrid::Inactive);
- admin->enableServer("server-always", true);
- waitForServerState(admin, "server-always", IceGrid::Active);
- admin->stopServer("server-always");
- try
- {
- admin->startServer("server-always");
-// test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-always") == IceGrid::Active);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->enableServer("server", true);
+ communicator->stringToProxy("server")->ice_ping();
+ admin->stopServer("server");
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->startServer("server");
+ test(admin->getServerState("server") == IceGrid::Active);
+ admin->stopServer("server");
+ test(admin->getServerState("server") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->enableServer("server-manual", true);
+ try
+ {
+ communicator->stringToProxy("server-manual")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->startServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ admin->stopServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
+ admin->enableServer("server-always", true);
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ admin->stopServer("server-always");
+ try
+ {
+ admin->startServer("server-always");
+// test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing activation failure... " << flush;
try
{
- int i;
- const int nThreads = 3;
- Ice::ObjectPrx invalid = communicator->stringToProxy("invalid-exe");
-
- vector<PingThreadPtr> threads;
- threads.reserve(nThreads);
- vector<PingThreadPtr>::const_iterator p;
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 10));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
-
- invalid = communicator->stringToProxy("invalid-pwd");
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 10));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
-
- invalid = communicator->stringToProxy("fail-on-startup");
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 5));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
+ int i;
+ const int nThreads = 3;
+ Ice::ObjectPrx invalid = communicator->stringToProxy("invalid-exe");
+
+ vector<PingThreadPtr> threads;
+ threads.reserve(nThreads);
+ vector<PingThreadPtr>::const_iterator p;
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 10));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
+
+ invalid = communicator->stringToProxy("invalid-pwd");
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 10));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
+
+ invalid = communicator->stringToProxy("fail-on-startup");
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 5));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing activation timeout... " << flush;
try
{
- test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive);
- const int nThreads = 5;
- Ice::ObjectPrx proxy = communicator->stringToProxy("server-activation-timeout");
- vector<PingThreadPtr> threads;
- threads.reserve(nThreads);
- vector<PingThreadPtr>::const_iterator p;
- int i;
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(proxy, 1));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- admin->stopServer("server-activation-timeout");
+ test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive);
+ const int nThreads = 5;
+ Ice::ObjectPrx proxy = communicator->stringToProxy("server-activation-timeout");
+ vector<PingThreadPtr> threads;
+ threads.reserve(nThreads);
+ vector<PingThreadPtr>::const_iterator p;
+ int i;
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(proxy, 1));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ admin->stopServer("server-activation-timeout");
}
catch(const IceGrid::ServerStopException& ex)
{
- cerr << ex << ": " << ex.reason << endl;
- test(false);
+ cerr << ex << ": " << ex.reason << endl;
+ test(false);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing deactivation timeout... " << flush;
try
{
- test(admin->getServerState("server-deactivation-timeout") == IceGrid::Inactive);
- communicator->stringToProxy("server-deactivation-timeout")->ice_ping();
- admin->stopServer("server-deactivation-timeout");
+ test(admin->getServerState("server-deactivation-timeout") == IceGrid::Inactive);
+ communicator->stringToProxy("server-deactivation-timeout")->ice_ping();
+ admin->stopServer("server-deactivation-timeout");
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing permanent disable on failure... " << flush;
try
{
- test(admin->getServerState("server1") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1"));
- waitForServerState(admin, "server1", IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server1", IceGrid::Inactive);
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(!admin->isServerEnabled("server1"));
-
- test(admin->getServerState("server1-manual") == IceGrid::Inactive);
- admin->startServer("server1-manual");
- test(admin->getServerState("server1-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-manual"));
- test(admin->getServerState("server1-manual") == IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server1-manual", IceGrid::Inactive);
- test(!admin->isServerEnabled("server1-manual"));
-
- test(admin->getServerState("server1-always") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-always"));
- obj->fail();
- waitForServerState(admin, "server1-always", IceGrid::Inactive);
- test(!admin->isServerEnabled("server1-always"));
+ test(admin->getServerState("server1") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1"));
+ waitForServerState(admin, "server1", IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server1", IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(!admin->isServerEnabled("server1"));
+
+ test(admin->getServerState("server1-manual") == IceGrid::Inactive);
+ admin->startServer("server1-manual");
+ test(admin->getServerState("server1-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-manual"));
+ test(admin->getServerState("server1-manual") == IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server1-manual", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server1-manual"));
+
+ test(admin->getServerState("server1-always") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-always"));
+ obj->fail();
+ waitForServerState(admin, "server1-always", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server1-always"));
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing temporary disable on failure... " << flush;
try
{
- test(admin->getServerState("server2") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2"));
- waitForServerState(admin, "server2", IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server2", IceGrid::Inactive);
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(!admin->isServerEnabled("server2"));
- nRetry = 0;
- while(!admin->isServerEnabled("server2") && nRetry < 15)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- try
- {
- obj->ice_ping();
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- }
- test(admin->isServerEnabled("server2"));
- waitForServerState(admin, "server2", IceGrid::Active);
- obj->ice_ping();
- admin->stopServer("server2");
-
- test(admin->getServerState("server2-manual") == IceGrid::Inactive);
- admin->startServer("server2-manual");
- test(admin->getServerState("server2-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-manual"));
- obj->fail();
- waitForServerState(admin, "server2-manual", IceGrid::Inactive);
- test(!admin->isServerEnabled("server2-manual"));
- admin->startServer("server2-manual");
- test(admin->isServerEnabled("server2-manual"));
- test(admin->getServerState("server2-manual") == IceGrid::Active);
- admin->stopServer("server2-manual");
-
- test(admin->getServerState("server2-always") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-always"));
- obj->fail();
- waitForServerState(admin, "server2-always", IceGrid::Inactive);
- test(!admin->isServerEnabled("server2-always"));
- nRetry = 0;
- while((!admin->isServerEnabled("server2-always") ||
- admin->getServerState("server2-always") != IceGrid::Active) &&
- nRetry < 15)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(admin->isServerEnabled("server2-always") && admin->getServerState("server2-always") == IceGrid::Active);
- obj->ice_ping();
+ test(admin->getServerState("server2") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2"));
+ waitForServerState(admin, "server2", IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server2", IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(!admin->isServerEnabled("server2"));
+ nRetry = 0;
+ while(!admin->isServerEnabled("server2") && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ try
+ {
+ obj->ice_ping();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ }
+ test(admin->isServerEnabled("server2"));
+ waitForServerState(admin, "server2", IceGrid::Active);
+ obj->ice_ping();
+ admin->stopServer("server2");
+
+ test(admin->getServerState("server2-manual") == IceGrid::Inactive);
+ admin->startServer("server2-manual");
+ test(admin->getServerState("server2-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-manual"));
+ obj->fail();
+ waitForServerState(admin, "server2-manual", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server2-manual"));
+ admin->startServer("server2-manual");
+ test(admin->isServerEnabled("server2-manual"));
+ test(admin->getServerState("server2-manual") == IceGrid::Active);
+ admin->stopServer("server2-manual");
+
+ test(admin->getServerState("server2-always") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-always"));
+ obj->fail();
+ waitForServerState(admin, "server2-always", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server2-always"));
+ nRetry = 0;
+ while((!admin->isServerEnabled("server2-always") ||
+ admin->getServerState("server2-always") != IceGrid::Active) &&
+ nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->isServerEnabled("server2-always") && admin->getServerState("server2-always") == IceGrid::Active);
+ obj->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/activation/Client.cpp b/cpp/test/IceGrid/activation/Client.cpp
index aaa0e585955..0162051684d 100644
--- a/cpp/test/IceGrid/activation/Client.cpp
+++ b/cpp/test/IceGrid/activation/Client.cpp
@@ -30,26 +30,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ 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/IceGrid/activation/Server.cpp b/cpp/test/IceGrid/activation/Server.cpp
index d9e5e6e0e4c..721c2132427 100644
--- a/cpp/test/IceGrid/activation/Server.cpp
+++ b/cpp/test/IceGrid/activation/Server.cpp
@@ -30,7 +30,7 @@ Server::run(int argc, char* argv[])
Ice::stringSeqToArgs(args, argc, argv);
if(properties->getPropertyAsInt("FailOnStartup") > 0)
{
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -41,13 +41,13 @@ Server::run(int argc, char* argv[])
int delay = properties->getPropertyAsInt("ActivationDelay");
if(delay > 0)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
}
shutdownOnInterrupt();
try
{
- adapter->activate();
+ adapter->activate();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
@@ -58,7 +58,7 @@ Server::run(int argc, char* argv[])
delay = properties->getPropertyAsInt("DeactivationDelay");
if(delay > 0)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
}
return test->isFailed() ? EXIT_FAILURE : EXIT_SUCCESS;