summaryrefslogtreecommitdiff
path: root/cpp/test/IceGrid/replication/AllTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/IceGrid/replication/AllTests.cpp')
-rw-r--r--cpp/test/IceGrid/replication/AllTests.cpp1730
1 files changed, 865 insertions, 865 deletions
diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp
index 6ea8a923372..2ebf0731d48 100644
--- a/cpp/test/IceGrid/replication/AllTests.cpp
+++ b/cpp/test/IceGrid/replication/AllTests.cpp
@@ -28,7 +28,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)
{
@@ -43,15 +43,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -78,13 +78,13 @@ waitForServerState(const IceGrid::AdminPrx& admin, const std::string& server, bo
int nRetry = 0;
while(nRetry < 30)
{
- if(admin->getServerState(server) == (up ? Active : Inactive))
- {
- return;
- }
+ if(admin->getServerState(server) == (up ? Active : Inactive))
+ {
+ return;
+ }
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
test(false);
}
@@ -95,41 +95,41 @@ waitForNodeState(const IceGrid::AdminPrx& admin, const std::string& node, bool u
int nRetry = 0;
while(nRetry < 30)
{
- try
- {
- if(admin->pingNode(node) == up) // Wait for the node to be removed.
- {
- return;
- }
- }
- catch(const NodeNotExistException&)
- {
- if(!up)
- {
- return;
- }
- }
-
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ try
+ {
+ if(admin->pingNode(node) == up) // Wait for the node to be removed.
+ {
+ return;
+ }
+ }
+ catch(const NodeNotExistException&)
+ {
+ if(!up)
+ {
+ return;
+ }
+ }
+
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
try
{
- if(admin->pingNode(node) != up)
- {
- cerr << "node state change timed out:" << endl;
- cerr << "node: " << node << endl;
- cerr << "state: " << up << endl;
- }
+ if(admin->pingNode(node) != up)
+ {
+ cerr << "node state change timed out:" << endl;
+ cerr << "node: " << node << endl;
+ cerr << "state: " << up << endl;
+ }
}
catch(NodeNotExistException&)
{
- if(up)
- {
- cerr << "node state change timed out:" << endl;
- cerr << "node: " << node << endl;
- cerr << "state: " << up << endl;
- }
+ if(up)
+ {
+ cerr << "node state change timed out:" << endl;
+ cerr << "node: " << node << endl;
+ cerr << "state: " << up << endl;
+ }
}
}
@@ -147,17 +147,17 @@ instantiateServer(const AdminPrx& admin, const string& templ, const map<string,
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
}
@@ -166,7 +166,7 @@ removeServer(const AdminPrx& admin, const string& id)
{
try
{
- admin->stopServer(id);
+ admin->stopServer(id);
}
catch(const ServerStopException&)
{
@@ -176,8 +176,8 @@ removeServer(const AdminPrx& admin, const string& id)
}
catch(const Ice::UserException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
NodeUpdateDescriptor nodeUpdate;
@@ -188,12 +188,12 @@ removeServer(const AdminPrx& admin, const string& id)
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
}
@@ -203,16 +203,16 @@ waitAndPing(const Ice::ObjectPrx& obj)
int nRetry = 0;
while(nRetry < 30)
{
- try
- {
- obj->ice_ping();
- return true;
- }
- catch(const Ice::LocalException&)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
+ try
+ {
+ obj->ice_ping();
+ return true;
+ }
+ catch(const Ice::LocalException&)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
}
return false;
}
@@ -225,7 +225,7 @@ createAdminSession(const Ice::LocatorPrx& locator, const string& replica)
string registryStr("TestIceGrid/Registry");
if(!replica.empty() && replica != "Master")
{
- registryStr += "-" + replica;
+ registryStr += "-" + replica;
}
Ice::ObjectPrx obj = locator->ice_getCommunicator()->stringToProxy(registryStr)->ice_locator(locator);
RegistryPrx registry = RegistryPrx::checkedCast(obj);
@@ -270,14 +270,14 @@ allTests(const Ice::CommunicatorPtr& comm)
instantiateServer(admin, "IceGridRegistry", params);
Ice::LocatorPrx masterLocator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12050"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12050"));
Ice::LocatorPrx slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
Ice::LocatorPrx slave2Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave2:default -p 12052"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave2:default -p 12052"));
Ice::LocatorPrx replicatedLocator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator:default -p 12050:default -p 12051"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator:default -p 12050:default -p 12051"));
AdminPrx masterAdmin, slave1Admin, slave2Admin;
@@ -300,203 +300,203 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing replicated locator and query interface... " << flush;
{
- Ice::EndpointSeq endpoints;
- ObjectInfo info;
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- ObjectInfo info1 = slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- int nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 3);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
- test(endpoints[2]->toString().find("-p 12052") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 3);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
- test(endpoints[2]->toString().find("-p 12052") != string::npos);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- QueryPrx query;
- query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[0]->toString()));
- Ice::ObjectProxySeq objs = query->findAllObjectsByType("::IceGrid::Registry");
- test(objs.size() == 2);
- query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[1]->toString()));
- test(objs == query->findAllObjectsByType("::IceGrid::Registry"));
+ Ice::EndpointSeq endpoints;
+ ObjectInfo info;
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ ObjectInfo info1 = slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ int nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 3);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+ test(endpoints[2]->toString().find("-p 12052") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 3);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+ test(endpoints[2]->toString().find("-p 12052") != string::npos);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ QueryPrx query;
+ query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[0]->toString()));
+ Ice::ObjectProxySeq objs = query->findAllObjectsByType("::IceGrid::Registry");
+ test(objs.size() == 2);
+ query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[1]->toString()));
+ test(objs == query->findAllObjectsByType("::IceGrid::Registry"));
}
cout << "ok" << endl;
cout << "testing well-known IceGrid objects... " << flush;
{
- //
- // Test Registry well-known object (we have already tested
- // admin session creation for the creation of the admin
- // session above!)
- //
- RegistryPrx masterRegistry = RegistryPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/Registry")->ice_locator(replicatedLocator));
- RegistryPrx slave1Registry = RegistryPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/Registry-Slave1")->ice_locator(replicatedLocator));
-
- SessionPrx session = masterRegistry->createSession("dummy", "dummy");
- session->destroy();
- if(comm->getProperties()->getProperty("Ice.Default.Protocol") == "ssl")
- {
- session = masterRegistry->createSessionFromSecureConnection();
- session->destroy();
- }
- else
- {
- try
- {
- masterRegistry->createSessionFromSecureConnection();
- }
- catch(const PermissionDeniedException&)
- {
- }
- }
-
- try
- {
- slave1Registry->createSession("dummy", "");
- }
- catch(const PermissionDeniedException&)
- {
- }
- try
- {
- slave1Registry->createSessionFromSecureConnection();
- }
- catch(const PermissionDeniedException&)
- {
- }
-
- //
- // Test registry user-account mapper.
- //
- UserAccountMapperPrx masterMapper = UserAccountMapperPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper")->ice_locator(replicatedLocator));
- UserAccountMapperPrx slave1Mapper = UserAccountMapperPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper-Slave1")->ice_locator(replicatedLocator));
-
- test(masterMapper->getUserAccount("Dummy User Account1") == "dummy1");
- test(masterMapper->getUserAccount("Dummy User Account2") == "dummy2");
- test(slave1Mapper->getUserAccount("Dummy User Account1") == "dummy1");
- test(slave1Mapper->getUserAccount("Dummy User Account2") == "dummy2");
- try
- {
- masterMapper->getUserAccount("unknown");
- test(false);
- }
- catch(UserAccountNotFoundException&)
- {
- }
- try
- {
- slave1Mapper->getUserAccount("unknown");
- test(false);
- }
- catch(UserAccountNotFoundException&)
- {
- }
-
- //
- // Test SessionManager, SSLSessionManager,
- // AdminSessionManager, AdminSSLSessionManager
- //
- comm->stringToProxy("TestIceGrid/SessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/SSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- try
- {
- comm->stringToProxy("TestIceGrid/SessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
- try
- {
- comm->stringToProxy("TestIceGrid/SSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
-
- comm->stringToProxy("TestIceGrid/AdminSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ //
+ // Test Registry well-known object (we have already tested
+ // admin session creation for the creation of the admin
+ // session above!)
+ //
+ RegistryPrx masterRegistry = RegistryPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/Registry")->ice_locator(replicatedLocator));
+ RegistryPrx slave1Registry = RegistryPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/Registry-Slave1")->ice_locator(replicatedLocator));
+
+ SessionPrx session = masterRegistry->createSession("dummy", "dummy");
+ session->destroy();
+ if(comm->getProperties()->getProperty("Ice.Default.Protocol") == "ssl")
+ {
+ session = masterRegistry->createSessionFromSecureConnection();
+ session->destroy();
+ }
+ else
+ {
+ try
+ {
+ masterRegistry->createSessionFromSecureConnection();
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+ }
+
+ try
+ {
+ slave1Registry->createSession("dummy", "");
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+ try
+ {
+ slave1Registry->createSessionFromSecureConnection();
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+
+ //
+ // Test registry user-account mapper.
+ //
+ UserAccountMapperPrx masterMapper = UserAccountMapperPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper")->ice_locator(replicatedLocator));
+ UserAccountMapperPrx slave1Mapper = UserAccountMapperPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper-Slave1")->ice_locator(replicatedLocator));
+
+ test(masterMapper->getUserAccount("Dummy User Account1") == "dummy1");
+ test(masterMapper->getUserAccount("Dummy User Account2") == "dummy2");
+ test(slave1Mapper->getUserAccount("Dummy User Account1") == "dummy1");
+ test(slave1Mapper->getUserAccount("Dummy User Account2") == "dummy2");
+ try
+ {
+ masterMapper->getUserAccount("unknown");
+ test(false);
+ }
+ catch(UserAccountNotFoundException&)
+ {
+ }
+ try
+ {
+ slave1Mapper->getUserAccount("unknown");
+ test(false);
+ }
+ catch(UserAccountNotFoundException&)
+ {
+ }
+
+ //
+ // Test SessionManager, SSLSessionManager,
+ // AdminSessionManager, AdminSSLSessionManager
+ //
+ comm->stringToProxy("TestIceGrid/SessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/SSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ try
+ {
+ comm->stringToProxy("TestIceGrid/SessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+ try
+ {
+ comm->stringToProxy("TestIceGrid/SSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+
+ comm->stringToProxy("TestIceGrid/AdminSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
}
cout << "ok" << endl;
@@ -511,257 +511,257 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing registry updates... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- AdapterInfo adpt;
- adpt.id = "TestAdpt";
- adpt.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
-
- ObjectInfo obj;
- obj.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
- obj.type = "::Hello";
-
- //
- // We use the locator registry from Slave1 to ensure that the
- // forwarding to the master work (the slave locator registry
- // forwards everything to the master).
- //
- Ice::LocatorRegistryPrx locatorRegistry = slave1Locator->getRegistry();
-
- //
- // Test addition of application, adapter, object.
- //
-
- try
- {
- slave1Admin->addApplication(app);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->addApplication(app);
-
- locatorRegistry->setAdapterDirectProxy(adpt.id, adpt.proxy);
-
- try
- {
- slave1Admin->addObjectWithType(obj.proxy, obj.type);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database
- }
- masterAdmin->addObjectWithType(obj.proxy, obj.type);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "added application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
-
- test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
-
- test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test sync of application.
- //
-
- app.description = "updated1 application";
- try
- {
- slave1Admin->syncApplication(app);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->syncApplication(app);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test update of application, adapter, object.
- //
-
- ApplicationUpdateDescriptor appUpdate;
- appUpdate.name = "TestApp";
- appUpdate.description = new BoxedString("updated2 application");
- try
- {
- slave1Admin->updateApplication(appUpdate);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->updateApplication(appUpdate);
-
- adpt.replicaGroupId = "TestReplicaGroup";
- locatorRegistry->setReplicatedAdapterDirectProxy(adpt.id, adpt.replicaGroupId, adpt.proxy);
-
- obj.proxy = comm->stringToProxy("dummy:tcp -p 12346 -h 127.0.0.1");
- try
- {
- slave1Admin->updateObject(obj.proxy);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database
- }
- masterAdmin->updateObject(obj.proxy);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
-
- test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
-
- test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test removal of application, adapter and object.
-
- try
- {
- slave1Admin->removeApplication("TestApp");
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeApplication("TestApp");
-
- try
- {
- slave1Admin->removeAdapter("TestAdpt");
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeAdapter("TestAdpt");
- try
- {
- slave1Admin->removeObject(obj.proxy->ice_getIdentity());
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeObject(obj.proxy->ice_getIdentity());
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- masterAdmin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- slave1Admin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- slave2Admin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- masterAdmin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- slave1Admin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- slave2Admin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- try
- {
- slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- try
- {
- slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ AdapterInfo adpt;
+ adpt.id = "TestAdpt";
+ adpt.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
+
+ ObjectInfo obj;
+ obj.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
+ obj.type = "::Hello";
+
+ //
+ // We use the locator registry from Slave1 to ensure that the
+ // forwarding to the master work (the slave locator registry
+ // forwards everything to the master).
+ //
+ Ice::LocatorRegistryPrx locatorRegistry = slave1Locator->getRegistry();
+
+ //
+ // Test addition of application, adapter, object.
+ //
+
+ try
+ {
+ slave1Admin->addApplication(app);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->addApplication(app);
+
+ locatorRegistry->setAdapterDirectProxy(adpt.id, adpt.proxy);
+
+ try
+ {
+ slave1Admin->addObjectWithType(obj.proxy, obj.type);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database
+ }
+ masterAdmin->addObjectWithType(obj.proxy, obj.type);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "added application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
+
+ test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+
+ test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test sync of application.
+ //
+
+ app.description = "updated1 application";
+ try
+ {
+ slave1Admin->syncApplication(app);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->syncApplication(app);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test update of application, adapter, object.
+ //
+
+ ApplicationUpdateDescriptor appUpdate;
+ appUpdate.name = "TestApp";
+ appUpdate.description = new BoxedString("updated2 application");
+ try
+ {
+ slave1Admin->updateApplication(appUpdate);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->updateApplication(appUpdate);
+
+ adpt.replicaGroupId = "TestReplicaGroup";
+ locatorRegistry->setReplicatedAdapterDirectProxy(adpt.id, adpt.replicaGroupId, adpt.proxy);
+
+ obj.proxy = comm->stringToProxy("dummy:tcp -p 12346 -h 127.0.0.1");
+ try
+ {
+ slave1Admin->updateObject(obj.proxy);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database
+ }
+ masterAdmin->updateObject(obj.proxy);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+
+ test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+
+ test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test removal of application, adapter and object.
+
+ try
+ {
+ slave1Admin->removeApplication("TestApp");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeApplication("TestApp");
+
+ try
+ {
+ slave1Admin->removeAdapter("TestAdpt");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeAdapter("TestAdpt");
+ try
+ {
+ slave1Admin->removeObject(obj.proxy->ice_getIdentity());
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeObject(obj.proxy->ice_getIdentity());
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ masterAdmin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ masterAdmin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
}
cout << "ok" << endl;
@@ -779,12 +779,12 @@ allTests(const Ice::CommunicatorPtr& comm)
app.nodes["Node1"].description = "dummy node";
try
{
- masterAdmin->addApplication(app);
+ masterAdmin->addApplication(app);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
//
@@ -800,104 +800,104 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing node session establishment... " << flush;
{
- admin->startServer("Node1");
-
- waitForNodeState(masterAdmin, "Node1", true);
- waitForNodeState(slave1Admin, "Node1", true);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- waitForNodeState(slave2Admin, "Node1", true); // Node should connect.
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- try
- {
- test(slave2Admin->pingNode("Node1")); // Node should be re-connected even if the master is down.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- try
- {
- test(masterAdmin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- try
- {
- test(masterAdmin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- try
- {
- test(slave2Admin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- test(slave2Admin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
+ admin->startServer("Node1");
+
+ waitForNodeState(masterAdmin, "Node1", true);
+ waitForNodeState(slave1Admin, "Node1", true);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ waitForNodeState(slave2Admin, "Node1", true); // Node should connect.
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ try
+ {
+ test(slave2Admin->pingNode("Node1")); // Node should be re-connected even if the master is down.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ try
+ {
+ test(masterAdmin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test(masterAdmin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test(slave2Admin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ test(slave2Admin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
@@ -906,267 +906,267 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing out-of-date replicas... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "Server";
- server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
- server->pwd = ".";
- server->activation = "on-demand";
- AdapterDescriptor adapter;
- adapter.name = "TestAdapter";
- adapter.id = "TestAdapter.Server";
- adapter.registerProcess = true;
- PropertyDescriptor property;
- property.name = "Ice.OA.TestAdapter.Endpoints";
- property.value = "default";
- server->propertySet.properties.push_back(property);
- property.name = "Identity";
- property.value = "test";
- server->propertySet.properties.push_back(property);
- ObjectDescriptor object;
- object.id = comm->stringToIdentity("test");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- app.nodes["Node1"].servers.push_back(server);
-
- masterAdmin->addApplication(app);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- masterAdmin->stopServer("Server");
-
- //
- // Shutdown Slave2 and update application.
- //
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "Node1";
- node.servers.push_back(server);
- update.nodes.push_back(node);
- property.name = "Dummy";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- masterAdmin->updateApplication(update);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- slave2Admin->startServer("Server");
- test(false);
- }
- catch(const DeploymentException&)
- {
- }
- try
- {
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- //
- // Shutdown Node1 and update the application, then, shutdown
- // the master.
- //
- slave1Admin->shutdownNode("Node1");
- waitForServerState(admin, "Node1", false);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- property.name = "Dummy2";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- masterAdmin->updateApplication(update);
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- //
- // Restart Node1 and Slave2, Slave2 still has the old version
- // of the server so it should be able to load it. Slave1 has
- // a more recent version, so it can't load it.
- //
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- admin->startServer("Node1");
-
- waitForNodeState(slave2Admin, "Node1", true);
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- slave2Admin->stopServer("Server");
-
- //
- // Start the master. This will re-load the server on the node
- // and update the out-of-date replicas.
- //
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- slave2Admin->shutdownNode("Node1");
- waitForServerState(admin, "Node1", false);
- admin->startServer("Node1");
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- waitForNodeState(masterAdmin, "Node1", true);
- waitForNodeState(slave1Admin, "Node1", true);
- waitForNodeState(slave2Admin, "Node1", true);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- slave2Admin->stopServer("Server");
-
- masterAdmin->removeApplication("TestApp");
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ server->activation = "on-demand";
+ AdapterDescriptor adapter;
+ adapter.name = "TestAdapter";
+ adapter.id = "TestAdapter.Server";
+ adapter.registerProcess = true;
+ PropertyDescriptor property;
+ property.name = "Ice.OA.TestAdapter.Endpoints";
+ property.value = "default";
+ server->propertySet.properties.push_back(property);
+ property.name = "Identity";
+ property.value = "test";
+ server->propertySet.properties.push_back(property);
+ ObjectDescriptor object;
+ object.id = comm->stringToIdentity("test");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ app.nodes["Node1"].servers.push_back(server);
+
+ masterAdmin->addApplication(app);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ masterAdmin->stopServer("Server");
+
+ //
+ // Shutdown Slave2 and update application.
+ //
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "Node1";
+ node.servers.push_back(server);
+ update.nodes.push_back(node);
+ property.name = "Dummy";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ masterAdmin->updateApplication(update);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ slave2Admin->startServer("Server");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ }
+ try
+ {
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ //
+ // Shutdown Node1 and update the application, then, shutdown
+ // the master.
+ //
+ slave1Admin->shutdownNode("Node1");
+ waitForServerState(admin, "Node1", false);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ property.name = "Dummy2";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ masterAdmin->updateApplication(update);
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ //
+ // Restart Node1 and Slave2, Slave2 still has the old version
+ // of the server so it should be able to load it. Slave1 has
+ // a more recent version, so it can't load it.
+ //
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ admin->startServer("Node1");
+
+ waitForNodeState(slave2Admin, "Node1", true);
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ slave2Admin->stopServer("Server");
+
+ //
+ // Start the master. This will re-load the server on the node
+ // and update the out-of-date replicas.
+ //
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ slave2Admin->shutdownNode("Node1");
+ waitForServerState(admin, "Node1", false);
+ admin->startServer("Node1");
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ waitForNodeState(masterAdmin, "Node1", true);
+ waitForNodeState(slave1Admin, "Node1", true);
+ waitForNodeState(slave2Admin, "Node1", true);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ slave2Admin->stopServer("Server");
+
+ masterAdmin->removeApplication("TestApp");
}
cout << "ok" << endl;
cout << "testing master upgrade... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "Server";
- server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
- server->pwd = ".";
- server->activation = "on-demand";
- AdapterDescriptor adapter;
- adapter.name = "TestAdapter";
- adapter.id = "TestAdapter.Server";
- adapter.registerProcess = true;
- PropertyDescriptor property;
- property.name = "Ice.OA.TestAdapter.Endpoints";
- property.value = "default";
- server->propertySet.properties.push_back(property);
- property.name = "Identity";
- property.value = "test";
- server->propertySet.properties.push_back(property);
- ObjectDescriptor object;
- object.id = comm->stringToIdentity("test");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- app.nodes["Node1"].servers.push_back(server);
-
- masterAdmin->addApplication(app);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- masterAdmin->stopServer("Server");
-
- //
- // Shutdown the Master, update Slave1 to be the Master.
- //
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- params["id"] = "Slave1";
- params["port"] = "12051";
- params["replicaName"] = "Master";
- instantiateServer(admin, "IceGridRegistry", params);
-
- admin->startServer("Slave1");
- slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12051"));
- slave1Admin = createAdminSession(slave1Locator, "");
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "Node1";
- node.servers.push_back(server);
- update.nodes.push_back(node);
- property.name = "Dummy";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- slave1Admin->updateApplication(update);
-
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- params["id"] = "Slave1";
- params["replicaName"] = "Slave1";
- params["port"] = "12051";
- instantiateServer(admin, "IceGridRegistry", params);
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- admin->startServer("Slave1");
- slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- masterAdmin->stopServer("Server");
-
- masterAdmin->removeApplication("TestApp");
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ server->activation = "on-demand";
+ AdapterDescriptor adapter;
+ adapter.name = "TestAdapter";
+ adapter.id = "TestAdapter.Server";
+ adapter.registerProcess = true;
+ PropertyDescriptor property;
+ property.name = "Ice.OA.TestAdapter.Endpoints";
+ property.value = "default";
+ server->propertySet.properties.push_back(property);
+ property.name = "Identity";
+ property.value = "test";
+ server->propertySet.properties.push_back(property);
+ ObjectDescriptor object;
+ object.id = comm->stringToIdentity("test");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ app.nodes["Node1"].servers.push_back(server);
+
+ masterAdmin->addApplication(app);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ masterAdmin->stopServer("Server");
+
+ //
+ // Shutdown the Master, update Slave1 to be the Master.
+ //
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ params["id"] = "Slave1";
+ params["port"] = "12051";
+ params["replicaName"] = "Master";
+ instantiateServer(admin, "IceGridRegistry", params);
+
+ admin->startServer("Slave1");
+ slave1Locator =
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12051"));
+ slave1Admin = createAdminSession(slave1Locator, "");
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "Node1";
+ node.servers.push_back(server);
+ update.nodes.push_back(node);
+ property.name = "Dummy";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ slave1Admin->updateApplication(update);
+
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ params["id"] = "Slave1";
+ params["replicaName"] = "Slave1";
+ params["port"] = "12051";
+ instantiateServer(admin, "IceGridRegistry", params);
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ admin->startServer("Slave1");
+ slave1Locator =
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ masterAdmin->stopServer("Server");
+
+ masterAdmin->removeApplication("TestApp");
}
cout << "ok" << endl;